Nama : Deab Sina
NIM : 49012078
Jurusan : D4 TMD ITB Batch 6
This is video about: Array (One dimension and Multi dimension)
Link to this video:
Source code:
===================================================
+ Array One dimension
===================================================
// Modul_7: Array
// Nama : Deab Sina
// NIM : 49012078
// Jurusan: D4 TMD ITB Batch 6
// one dimension array
#include <iostream>
using namespace std;
int main()
{
// Declare int variable one dimension
int arr1dimension[10];
for (int x=0; x<10; x++)
{
cout<<"Please input value of element array number"<<x<<" : ";
cin>>arr1dimension[x];
}
cout<<"The value taht you input is : "<<endl;
for (int x=0; x<10; x++)
{
cout<<"Element number"<<x<<" = "<<arr1dimension[x]<<endl;
}
system("pause");
return 0;
}
// Nama : Deab Sina
// NIM : 49012078
// Jurusan: D4 TMD ITB Batch 6
// one dimension array
#include <iostream>
using namespace std;
int main()
{
// Declare int variable one dimension
int arr1dimension[10];
for (int x=0; x<10; x++)
{
cout<<"Please input value of element array number"<<x<<" : ";
cin>>arr1dimension[x];
}
cout<<"The value taht you input is : "<<endl;
for (int x=0; x<10; x++)
{
cout<<"Element number"<<x<<" = "<<arr1dimension[x]<<endl;
}
system("pause");
return 0;
}
===================================================
+ Array Multi dimension
===================================================
// multi_dimension.cpp : Defines the entry point for the console application.
// Nama : Deab Sina
// NIM : 49012078
// Jurusan : D4 TMD ITB Batch 6
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
// Declare char variable multi dimension
char color[7][7] = {"Red","Blue", "Yellow", "Green","Orange", "Pink", "Purple"};
for(int k=0; k<7; k++)
{
cout<<"Rainbow color is : "<<color[k]<<endl;
}
system("pause");
return 0;
}
// multi_dimension.cpp : Defines the entry point for the console application.
// Nama : Deab Sina
// NIM : 49012078
// Jurusan : D4 TMD ITB Batch 6
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
// Declare char variable multi dimension
char color[7][7] = {"Red","Blue", "Yellow", "Green","Orange", "Pink", "Purple"};
for(int k=0; k<7; k++)
{
cout<<"Rainbow color is : "<<color[k]<<endl;
}
system("pause");
return 0;
}
No comments:
Post a Comment