Lebih baik mencoba lalu gagal, dari pada Anda gagal mencoba. Praktek 4 C++ Lebih baik mencoba lalu gagal, dari pada Anda gagal mencoba.
main(){ char lagi; int kode, a, b; atas : clrscr(); cout<<"1 main(){ char lagi; int kode, a, b; atas : clrscr(); cout<<"1. Perulangan FOR 1 "<<endl; cout<<"2. Perulangan FOR 2 "<<endl; cout<<"3. Perulangan FOR 3 "<<endl; cout<<"4. WHILE "<<endl; cout<<"5. DO WHILE "<<endl; cout<<"Pilih Menu [1/2/3/4/5] \t:"; cin>>kode;
switch(kode){ case 1: clrscr(); for (a=0; a <= 10 ; a++) cout<<a<<endl; cout<<"Kembali Kemenu Utama(Y/N):";cin>>lagi; if (lagi=='Y' || lagi=='y') { goto atas; } break;
case 2: clrscr(); cout<<"Menampilkan Bilangan Genap"<<endl; for (a=0; a <= 10 ; a+=2) cout<<a<<endl; cout<<"Kembali Kemenu Utama(Y/N):";cin>>lagi; if (lagi=='Y' || lagi=='y') { goto atas; } break;
struct data{ char nama[25] ; char jurusan[20] ; } redata[300] ; void main() { char pil ; int j, i=0 ; pil='Y' ; while(pil=='Y'||pil=='y'){ clrscr() ; gotoxy(30,4) ; cout<< " DATA MAHASISWA " ; gotoxy(30,5) ; cout<< "___________________________" ; gotoxy(30,6) ; cout<< "NAMA : " ; gets(redata[i].nama) ; gotoxy(30,7) ; cout<< "JURUSAN: " ; gets(redata[i].jurusan) ; gotoxy(30,9) ; cout<< "Input Data Lagi : " ; pil = getch() ; i++ ;
clrscr() ; gotoxy(2,2) ; cout<< "DATA MAHASISWA" ; gotoxy(2,3) ; cout<< "Laporan Mahasiswa" ; gotoxy(2,4) ; cout<< "______________________________" ; gotoxy(2,5) ; cout<< "No"; gotoxy(5,5) ; cout<< "NAMA"; gotoxy(20,5) ; cout<< "JURUSAN"; gotoxy(2,6) ; cout<< "_______________________" ; for(j=0 ; j<i ; j++){ gotoxy(2,7+j) ; cout<< (j + 1) <<" "<< redata[j].nama ; gotoxy(20,7+j) ; cout<< redata[j].jurusan ; } gotoxy(2,8+j) ; cout<< "_____________________" ; getch(); }
while(pil=='Y'||pil=='y'){ clrscr() ; gotoxy(30,4) ; cout<< " DATA MAHASISWA " ; gotoxy(30,5) ; cout<< "___________________________" ; gotoxy(30,6) ; cout<< "NAMA : " ; gets(redata[i].nama) ; gotoxy(30,7) ; cout<< "JURUSAN: " ; gets(redata[i].jurusan) ; gotoxy(30,8) ; cout<< "IPK : " ; cin>>redata[i].ipk ; gotoxy(30,9) ; cout<< "Input Data Lagi : " ; pil = getch() ; i++ ; }
for(j=0 ; j<i ; j++){ if(redata[j] for(j=0 ; j<i ; j++){ if(redata[j].ipk >=3){ strcpy(ket,"Bagus") ; } else if(redata[j].ipk < 3){ strcpy(ket,"Jelek") ; gotoxy(2,7+j) ; cout<< (j + 1) <<" "<< redata[j].nama ; gotoxy(20,7+j) ; cout<< redata[j].jurusan ; //colom,baris gotoxy(40,7+j) ; cout<< ket ; gotoxy(2,8+j) ; cout<< "__________________________" ; getch();
DEDEDRAMADKAMDA.WORDPRESS.COM