1. PROGRAM UNTUK MENENTUKAN NILAI MATA KULIAH
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char nama[20];
int nim,tgs,uts,uas,hasil,mhs;
cout<<"\t\t Program Nilai Akhir Mahasiswa UAD\n";
cout<<"\t\t\t O L E H :\n";
cout<<"\t\t\t Vera Wati\n";
cout<<"\t\t\t 1300018063\n\n";
cout<<"Input jumlah mahasiswa UAD : ";
cin>>mhs;
for(int i=0;i<mhs;i++){
cout<<"\nNama : ";cin>>nama;
cout<<"NIM : ";cin>>nim;
cout<<"Nilai Tugas : ";cin>>tgs;
cout<<"Nilai UTS : ";cin>>uts;
cout<<"Nilai UAS : ";cin>>uas;
hasil=(tgs+uts+uas)/3;
cout<<"\n\nNama : "<<nama<<"\nNIM : "<<nim<<"\nNilai angka : "<<hasil;
cout<<"\nNilai huruf : ";
if(hasil>=80){
cout<<"A\n";
}
else if(hasil>=65 && hasil<80){
cout<<"B\n";
}
else if(hasil>=50 && hasil<65){
cout<<"C\n";
}
else if(hasil>=35 && hasil<50){
cout<<"D\n";
}
else { cout<<"E\n";}
}
system("PAUSE");
return EXIT_SUCCESS;
}
2.PROGRAM UNTUK MENGECEK PIN ATM
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int pin1, pin2, i=1;
char jawab;
cout<<"\t\t\tAutomatic Teller Machine\n\n";
cout<<"Nama : Vera Wati \n";
cout<<"NIM : 1300018063\n";
pin2 = 112233;
do {
cout<<endl<<endl<<"Silahkan masukkan PIN anda : ";cin>>pin1;
if(pin1 == pin2){
cout<<endl<<"Anda berhak mengakses menu utama ATM"<<endl<<endl;
jawab = 'n';
}
else{
cout<<"Pin yang Anda masukkan salah. Silahkan dicoba lagi "<<i<<"x";
jawab ='y';
i=i+1;
if(i>=5){
cout<<endl<<" dan ATM anda tertelan, silahkan menghubungi coustomer service"<<endl<<endl;
jawab='n';
}
}
}
while(jawab=='y');
system("pause");
return 0;
}
Tidak ada komentar:
Posting Komentar