Example 1:
#include <iostream.h>
#include <conio.h>
main()
{
int x;
int number[ ] = {1,2,3,4,5,6,7,8,9};
char character[ ] = {'H','E','L','L','O'};
clrscr();
for(x=0;x<9;++x)
{
cout <<"\nData [" <<x <<"] = "< number[x];
}
cout<<"\n";
for(x=0;x<5;++x)
{
cout <<"\nData ["<<x<<"] = "<< character[x];
}
getch();
}
Example 2:
#include <iostream.h>
#include <conio.h>
main()
{
int number[3];
char character[3];
int index;
clrscr();
//Number
cout <<"\n****************";
cout <<"\n* INPUT NUMBER *";
cout <<"\n****************";
//input
for(index=0;index<3;index++)
{
cout <<"\nData "<<index+1 <<" = ";
cin >>number[index];
}
cout <<"\n";
//output
for(index=0;index<3;index++)
{
cout <<"\nData ke-"<<index+1 <<"] = " <<number[index];
}
//Character
cout <<"\n*******************";
cout <<"\n* INPUT CHARACTER *";
cout <<"\n*******************";
//input
for(index=0;index<3;index++)
{
cout <<"\nData "<<index+1 <<" = ";
cin >>character[index];
}
cout <<"\n";
//output
for(index=0;index<3;index++)
{
cout <<"\nData "<<index+1 <"] = " <<character[index];
}
getch();
}
Search
Categories
- Part I : Perkenalan (4)
- Part II : Operator (3)
- Part III : Percabangan (materi) (2)
- Part III : Percabangan (program) (4)
- Part IV : Perulangan (meteri) (3)
- Part IV : Perulangan (program) (3)
- Part V : Array (materi) (1)
- Part V : Array (program) (2)
- Penerapan (6)
- Pointer (2)
- Searching (pencarian) (3)
- Typedef (1)