Program C++ Mencari Bilangan Ganjil/Genap, Mencari Bilangan Terbesar dan Bobot Nilai Berkoma Menggunakan Fungsi Nested IF dan Switch Case

Berikut ini adalah Program C++ Mencari Bilangan Ganjil/Genap, Mencari Bilangan Terbesar dan Bobot Nilai Berkoma Menggunakan Fungsi Nested IF dan Switch Case, mari lihat source codenya :

#include <iostream.h>
#include <conio.h>

void main()
{
int pilih;

int bl, b1, b2, b3, tb;
double nik,niq,nit,nts,niu,na,nikm,niqm,nitm,ntsm,nium ;
char npm[9], nama[15];

 cout<<"PILIH PROGRAM \n";

 cout<<"1. Mencari bilangan ganjil dan genap\n";
 cout<<"2. Mencari bilangan Terbesar dari 3 bilangan\n";
 cout<<"3. Nilai Bobot dan Nilai Huruf Mahasiswa\n";

 cout<<"\nMasukkan pilihan :";cin>>pilih;
  switch(pilih)
   {
   case 1:
   {
   cout<<"\n\nMasukkan bilangan =";cin>>bl;
   if (bl%2==0)
   cout<<"Bilangan anda adalah bilangan genap ";
   else{
   cout<<bl<<"\nAdalah bilangan ganjil";}
   }
   break;
   case 2:
   {
   cout<<"\nMasukkan Bilangan 1= ";cin>>b1;
   cout<<"\nMasukkan Bilangan 2= ";cin>>b2;
   cout<<"\nMasukkan Bilangan 3= ";cin>>b3;
   {
   if(b1>b2)
   tb = b1;

   else
   tb=b2;

   if (b3>tb)
   tb=b3;

   cout<<endl;
   cout<<"nilai tb ="<<tb;cout<<endl;}

   }
   break;
   case 3:
   {
cout<<"\n\tNPM = ";cin>>npm;
cout<<"\n\tNama = ";cin>>nama;
cout<<"\n\tNilai Kehadiran = ";cin>>nik;
cout<<"\n\tNilai quis = ";cin>>niq;
cout<<"\n\tNilai tugas = ";cin>>nit;
cout<<"\n\tNilai UTS = ";cin>>nts;
cout<<"\n\tNilai UAS = :";cin>>niu;

nikm=nik*10/100;
niqm=niq*15/100;
nitm=nit*15/100;
ntsm=nts*25/100;
nium=niu*35/100;

na=nikm+niqm+nitm+ntsm+nium;

if(na>90.68&&na<=100)
cout<<"\n\tNilai Huruf = A";
else if(na>80&&na<=90.68)
cout<<"\n\tNilai Huruf = A-";
else if(na>70.01&&na<=80.33)
cout<<"\n\tNilai Huruf = B+";
else if(na>60.68&&na<=70.00)
cout<<"\n\tNilai Huruf = B";
else if(na>50.34&&na<=60.67)
cout<<"\n\tNilai Huruf = B-";
else if(na>40.01&&na<=50.33)
cout<<"\n\tNilai Huruf = C+";
else if(na>30.68&&na<=40.00)
cout<<"\n\tNilai Huruf = C";
else if(na>20.34&&na<=30.58)
cout<<"\n\tNilai Huruf = C-";
else if(na>10.01&&na<=30.57)
cout<<"\n\tNilai Huruf = D+";
else if(na>0.68&&na<=10.00)
cout<<"\n\tNilai Huruf = D";
else if(na>0.34&&na<=0.67)
cout<<"\n\tNilai Huruf = D-";
else if(na>0.00&&na<=0.33)
cout<<"\n\tNilai Huruf = E";

cout<<"\n\tTotal Nilai = "<<na;
}
   break;
}
getch();
}

Comments

Popular posts from this blog

Cara Membuat Halaman Login Hotspot Berbeda pada 1 Mikrotik

UltraISO Premium Edition v9.5.3

Arti OSAKMJ