If-Else Multi Kondisi

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

main()
{
int nilai;
float bobot;
char huruf;
char ket;

clrscr();
cout <<"\n**************************************";
cout <<"\n* Perhitungan Indeks Prestasi (IP) *";
cout <<"\n**************************************";
cout <<"\n";
cout <<"\nMasukkan nilai Anda ! : "; cin >>nilai;

//Untuk If-Else Multi Kondisi(kondisi1 & kondisi2), maka diperlukan operator LOGIKA && untuk relasi AND, dan operator LOGIKA || untuk relasi OR

if ((nilai>=80)&&(nilai<=100))
{
ket = 'A';
bobot = 4.00;
}
else if ((nilai>=71)&&(nilai<=79))
{
ket = 'B+';
bobot = 3.50;
}
else if ((nilai>=65)&&(nilai<=70))
{
ket = 'B';
bobot = 3.00;
}
else if ((nilai>=61)&&(nilai<=64))
{
ket = 'C+';
bobot = 2.50;
}
else if ((nilai>=56)&&(nilai<=60))
{
ket = 'C';
bobot = 2.00;
}
else if ((nilai>=40)&&(nilai<=55))
{
ket = 'D';
bobot = 1.00;
}
else
{
ket = 'E';
bobot = 0.00;
}

cout <<"\n\n";
cout <<"\n================";
cout <<"\n= NILAI ANDA =";
cout <<"\n================";
cout <<"\n";
cout <<"\nAngka = " <<nilai;
cout <<"\nHuruf = " <<ket;
cout <<"\nBobot = " <<bobot;

getch();
}

Posted in . Bookmark the permalink. RSS feed for this post.

Leave a Reply

Search

Support by Blogger ITN | Converted by LiteThemes.com