int array[5],z;
struct data_mahasiswa{
char name[100];
};
data_mahasiswa data[5];
int input_data(int z){
int y;
y=z;
for(int x=0; x<y; x++){
system("cls");
cout<<"\nMasukkan Nim : "; cin>>array[x];
cout<<"\nMasukkan Nama : "; cin>>data[x].name;
system("cls");
}
for(int x=0; x<y; x++){
cout<<"\nNim : "<<array[x];
cout<<"\tNama : "<<data[x].name<<endl;
getch();
}
};
int main(){
cout<<"Berapa data yang ingin anda masukkan [1~5] : "<<endl;
cin>>z;
input_data(z);
}
Home »
» Array and Array of Struct
0 komentar:
Posting Komentar