#include<iostream.h>
#include<conio.h>
void deret(){
int a, b, c;
clrscr();
cout<<"Masukkan nilai deret ";cin>>a;
for (b=1 ; b<=a; b++)
{
for (c=1 ; c<=b; c++)
{
cout<<"*";
}
cout<<" "<<endl;
}
for (b=1 ; b<=a; b++)
{
for (c=a-1 ; c>=b; --c)
{
cout<<"*";
}
cout<<" "<<endl;
}
getch();
}
void kelas(){
clrscr();
char nama [20][10];
char npm [8][10];
char kelas[5][10];
int jml;
cout<<"masukkan jumlah record:";
cin>>jml;
clrscr();
for (int i=1 ; i<=jml ;i++)
{
cout<<"\n input data ke-"<<i<<":";
cin>>nama[i];
cout<<"\n npm ke-"<<i<<":";
cin>>npm[i];
cout<<"\n kelas ke-"<<i<<":";
cin>>kelas[i];
}
for (int j=1; j<=jml;j++)
{
cout<<"\n==========================\n";
cout<<"\n input data ke-"<<j;
cout<<"\n nama : " << nama[j];
cout<<"\n npm : " << npm[j];
cout<<"\n kelas : " <<kelas[j];
cout<<"\n==========================\n";
}
getch();
}
void main(){
clrscr();
int pil;
start :
clrscr();
cout<<" Menu\n";
cout<<"============================\n";
cout<<"1. Deret\n";
cout<<"2. Kelas\n";
cout<<"3. Exit\n\n";
cout<<"============================\n";
cout<<"Masukkan Pilihan Anda :";cin>>pil;
switch(pil){
case 1:
deret();
goto start;
case 2:
kelas();
goto start;
case 3:
cout<<"\n\nProgram Selesai. Terima Kasih";
goto exit;
break;
default :
cout<<"\n\nMaaf, Pilihan Tidak Tersedia !!!";
goto start;
}
exit:
getch();
}
Tidak ada komentar:
Posting Komentar