Rabu, 13 April 2011

contoh program array c++ input data

#include <iostream.h>
int main()
{
int data[100];
int n,i;

cout<<"===PROGRAM INPUT DATA==="<<endl;
cout<<"Masukan Jumlah Data: ";
cin>>n;
cout<<endl;

for(i=1;i<=n;i++)
{
cout<<"Masukkan data ke "<<i<< " : ";
cin>>data[i];
}

cout<<"Data yang di Masukan: ";
cout<<endl;

for( i=1; i<=n; i++)
{
cout<<" "<<data[i]<<endl;
}

return 0;
}

1 komentar: