SELAMAT DATANG DI BLOG HUSNY ARIFUDDIN

Selasa, 17 April 2012

C++ Program IF...Else

#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
char nama[25],npm[8];
int mid,final,prak,hasil;
cout<<"-----------------------------------";
cout<<"\nMenghitung Nilai Mata Kuliah TPT 2";
cout<<"\n-----------------------------------";
cout<<"\nNama  = ";cin>> nama;endl;
cout<<"\nNPM   = ";cin>> npm;endl;
cout<<"\nMasukkan Nilai Mid Test   = ";cin>>mid;
cout<<"\nMasukkan Nilai Final Test = ";cin>>final;
cout<<"\nMasukkan Nilai Praktek    = ";cin>>prak;
clrscr();
cout<<"\n\nNama = "<< nama;
cout<<"\n\nNPM  = "<< npm;
cout<<"\n\nNilai Mata Kuliah TPT 2 ";
hasil=(mid*0.5 + final*0.3 + prak*0.2);
if (hasil >= 80)
cout<<"Anda Mendapat  A";
else if(hasil >= 60)
cout<<"Anda Mendapat  B";
else if(hasil >= 40)
cout<<"Anda Mendapat  C";
else if(hasil >= 20)
cout<<"Anda Mendapat  D";
else
cout<<"Anda Mendapat  E";
getch();
return(0);
}



                                                         @Husny_Arifuddin

Tidak ada komentar:

Posting Komentar