Soal:
Input nama, nim, prodi, jumlah sks yang diambil dan tampilkan hasil inputan sebanyak 3x, kemudian tampilkan total tarif yang harus dibayarkan jika tarif sks=200.000
Notasi:
//contoh kasus
//timothy
//8 jan 2023
//kamus
nm,pd,makul; ßstring
nim;ßinteger
a,mk,sks; ßinteger
total,ts=0,tarif=200000; ßinteger
//deskripsi
Output Nama
input nm;
Output NIM
input nim;
Output Prodi
input pd;
Output "Input
Jumlah makul” input mk
for (a=0; a<mk; a++){
Output " Makul “ input makul
Output < sks : input >sks
ts+=sks;
}
}
total=tarif*ts;
Output <" Total SKS : ";Output<ts<;
Output<<" Total Tarif SKS :
";Output<total<
}
Kode:
#include
<iostream>
using
namespace std;
string
nm,pd,makul;
int nim;
int a,mk,sks;
int total,ts=0,tarif=200000;
main(){
cout<<"----------------------------------------"<<endl;
cout<<" Nama : ";cin>>nm;
cout<<" NIM : ";cin>>nim;
cout<<" Prodi : ";cin>>pd;
cout<<"----------------------------------------"<<endl;
cout<<" Input Jumlah makul :
";cin>>mk
cout<<"----------------------------------------"<<endl;
for (a=0; a<mk; a++){
cout<<" Makul : ";cin>>makul;
cout<<" sks :
";cin>>sks;
ts+=sks;
}
total=tarif*ts;
cout<<"----------------------------------------"<<endl;
cout<<" Total SKS : ";cout<<ts<<endl;
cout<<" Total Tarif SKS :
";cout<<total<<endl;
cout<<"----------------------------------------"<<endl;
}
Tidak ada komentar:
Posting Komentar