Algoritma konversi {Mengkonversikan nilai angka menjadi nilai huruf}DEKLARASI nilai : integer (input)DESKRIPSI Read (nilai) if ((nilai>=80)) then huruf =70)and (nilai<80)) then huruf =60)and(nilai<70)) then huruf <– Celse huruf <– Dendif Write (huruf)program nya sedot gan
#include <cstdlib>
#include <iostream>
using namespace std;
class konversi {
public :
void input ();
void proses ();
int nilai;
};
void konversi :: input(){
cout<<"Masukkan nilai angka : ";
cin>>nilai;
cout<<endl;
}
void konversi :: proses() {
if ((nilai>=80))
cout<<"Nilai huruf : A"<<endl;
else if ((nilai>=70)&&(nilai<80))
cout<<"Nilai huruf : B"<<endl;
else if ((nilai>=60)&&(nilai<70))
cout<<"Nilai huruf : C"<<endl;
else
cout<<"Nilai huruf : D"<<endl;
}
int main(int argc, char *argv[])
{
konversi angka;
angka.input();
angka.proses();
system("PAUSE");
return EXIT_SUCCESS;
}
0 comments:
Post a Comment