Selasa, 17 April 2012

Program C++ Array-Satu Dimensi


contoh program array 1 dimensi
#include<iostream.h>

#include<conio.h>
main()
{
int a[5]={10,15,20,25,30};
int b[5]={10,20};
int c[5]={15,0,30};
int j;

// Menampilkan nilai dari element array
cout<<endl;
for(j=0;j<5;j++)
{
cout<<"A ["<<j<<"] = "<<a[j]<<" , B ["<<j<<"] = "<<b[j]<<" , C ["<<j<<"] = "<<c[j]<<endl;
}
getch();
}

Tidak ada komentar:

Posting Komentar