Petunjuk:
A 4
B 3
C 2
D 1
E 0
Jawab :
#include <iostream>
#include <conio.h>
using namespace std;
main()
{
char
kdmenu;
cout<<"Masukkan Nilai Huruf [ A - E ] = ";
cin>>kdmenu;
kdmenu
= toupper(kdmenu);
if
(kdmenu =='A')
{cout<<"\n++++++++++++++Konversi ke
Angka++++++++++++++\n";
cout<<"Konversi = 4";
}
else if
(kdmenu =='B')
{cout<<"\n++++++++++++++Konversi ke
Angka++++++++++++++\n";
cout<<"Konversi = 3";
}
else if
(kdmenu =='C')
{cout<<"\n++++++++++++++Konversi ke
Angka++++++++++++++\n";
cout<<"Konversi = 2";
}
else if
(kdmenu =='D')
{cout<<"\n++++++++++++++Konversi ke
Angka++++++++++++++\n";
cout<<"Konversi = 1";
}
else if
(kdmenu =='E')
{cout<<"\n++++++++++++++Konversi ke
Angka++++++++++++++\n";
cout<<"Konversi = 0";}
getch
();
}
No comments:
Post a Comment