1 / 7

Jawaban ujian MID

Jawaban ujian MID. #include&lt;iostream.h&gt; #include&lt;conio.h&gt; #include&lt;iomanip.h&gt; #include&lt;stdio.h&gt; int pil; char tny; main(){ menu: cout&lt;&lt;&quot;<br>MENU PILIHAN : &quot;; cout&lt;&lt;&quot;<br>[1] Hitung IPK Mahasiswa&quot;; cout&lt;&lt;&quot;<br>[2] Hitung Gaji Karyawan&quot;; cout&lt;&lt;&quot;<br>[3] Keliuar Dari Aplikasi&quot;;

lerato
Download Presentation

Jawaban ujian MID

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Jawaban ujian MID

  2. #include<iostream.h> #include<conio.h> #include<iomanip.h> #include<stdio.h> int pil; char tny; main(){ menu: cout<<"\nMENU PILIHAN : "; cout<<"\n[1] Hitung IPK Mahasiswa"; cout<<"\n[2] Hitung Gaji Karyawan"; cout<<"\n[3] Keliuar Dari Aplikasi"; cout<<"\n\nInput pilihan anda : ";cin>>pil;

  3. switch(pil) {case 1: {int n,sks=0,tsks=0; char mkul[20],ket; float nilai=0,rata,jml=0,ipk=0; cout<<"Input banyak mata kuliah =;cin>>n; for(int i=1;i<=n;i++){ cout<<"\n\nData ke = "<<i; cout<<"\n-----------------\n"; cout<<"Mata kuliah = " ;gets(mkul); cout<<"Jumlah SKS = ";cin>>sks; cout<<"Nilai huruf = ";cin>>ket; if(ket=='A'|| ket=='a') nilai+=(4*sks); else if(ket=='B' || ket=='b') nilai+=(3*sks); else if(ket=='C' || ket=='c')

  4. nilai+=(2*sks); else if(ket=='D' || ket=='d') nilai+=(1*sks); else if(ket=='E' || ket=='e') nilai+=(0*sks); else cout<<"Range nilai hanya dari A-E"; tsks+=sks; ipk=nilai/tsks; } cout<<"\nNilai total = "<<nilai; cout<<"\nTotal SKS = "<<tsks; cout<<"\nIPK = “ <<setiosflags(ios::fixed) <<setprecision(2)<<ipk; cout<<"\n\n\nAnda ingin kembali ke Menu utama ?"; cout<<"\nJawab dengan 'Y' atau 'T' ";cin>>tny; if(tny=='y' ||tny=='Y') {clrscr(); goto menu;}}

  5. case 2: {char nama_karyawan[20],nik[5],gol; float gator,pajak,gaber,gapok,tunj,makan,trans; bool status,kelamin,kendaraan; cout<<"\n*************************************"; cout<<"\n* MENGHITUNG GAJI BERSIH KARYAWAN *"; cout<<"\n*************************************"; cout<<endl<<endl; cout<<"Input nama karyawan : ";gets(nama_karyawan); cout<<"Input NIK : ";cin>>nik; cout<<"Jns kelamin[0=P,1=L]: ";cin>>kelamin; cout<<"Status[0=S,1=Nikah] : ";cin>>status; cout<<"Transport[0=S,1=Mbi]: ";cin>>kendaraan; cout<<"Golongan[A,B,C] : ";cin>>gol; cout<<"Input uang makan : Rp ";cin>>makan; if (gol=='a' || gol=='A') gapok=500; else if (gol=='b' || gol=='B')

  6. gapok=600; else if (gol=='a' || gol=='A') gapok=700; cout<<"\nGaji pokok anda : Rp "<<gapok; if(kelamin==1 && status==1) tunj=500; else tunj=0; cout<<"\nTunjangan anda : Rp "<<tunj; if(kendaraan==1) trans=1000; else if(kendaraan==0) trans=500; else trans=0; cout<<"\nTransport anda/bln : Rp "<<trans; gator=gapok+tunj+makan+trans; pajak=gator*0.05;

  7. gaber=gator-pajak; cout<<"\nGaji kotornya : Rp "<<gator; cout<<"\nPotongan pajak anda : Rp "<<pajak; cout<<endl<<endl; cout<<"\nGaji bersih adalah : Rp “ <<setiosflags(ios::fixed)<<setprecision(2) <<gaber; cout<<"\n\n\nAnda ingin kembali ke Menu utama ?"; cout<<"\nJawab dengan 'Y' atau 'T' ";cin>>tny; if(tny=='y' ||tny=='Y') {clrscr(); goto menu;} } default: return 0;} getch();}

More Related