#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<iomanip.h>
#include <string.h>
struct
{
char
nama[10];
int
nilai;
}data[30];
main()
{
int pilih,i,j,a;
char lagi,yes;
awal :
cout<<"=============================\n";
cout<<" Pilihan: \n";
cout<<" 1. Masukkan nilai mahasiswa \n";
cout<<" 2. Cetak nilai mahasiswa \n";
pilihan :
cout<<"=============================\n";
cout<<"Masukkan pilihan : ";
cin>>pilih;
switch(pilih)
{
case 1:
{
cout<<"
Jumlah Data : "; cin>>j;
for(i=1;
i<=j; i++)
{
ulang:
cout<<"
\n Data ke- "<<i<<endl;
cout<<"
Nama \t: ";
cin>>data[i].nama;
cout<<"
Nilai \t: ";
cin>>data[i].nilai;
}
cout<<"\nMau Isi Data Lagi [Y/T] :
"; cin>>yes;
if(yes=='Y'||yes=='y')
{
goto ulang;
}
else
goto
pilihan;
break;
}
case 2:
{
for(i=1;
i<=j; i++)
{
cout<<"\nData
Ke\t : "<<setiosflags(ios::left)<<i<<endl;
cout<<"Nama\t
: "<<setiosflags(ios::left)<<data[i].nama<<endl;
cout<<"Nilai\t :
"<<setiosflags(ios::left)<<data[i].nilai<<endl;
}
}
break;
}
end:
cout<<"\nApakah
Mau Ulang ?[ Y / T ]";
cin>>lagi;
if
(lagi=='Y'||lagi=='y')
goto
awal;
else
cout<<"\n\nTerima Kasih";
getch();
}
0 komentar:
Posting Komentar