Program c++:
#include <cstdlib>
#include <iostream>
using namespace std;
class NILAI{
public:
void konversikan();
private:
float nilai;
};
void NILAI::konversikan(){
cout<<"\n\n \t\t KONVERSI NILAI";
cout<<"\n\nmasukkan nilai = ";cin>>nilai;
if((nilai>0)&&(nilai<=20))
cout<<"Nilai E"<<endl<<endl;
else if((nilai>20)&&(nilai<=40))
cout<<"Nilai D"<<endl<<endl;
else if((nilai>40)&&(nilai<=60))
cout<<"Nilai C"<<endl<<endl;
else if((nilai>60)&&(nilai<=80))
cout<<"Nilai B"<<endl<<endl;
else if((nilai>80)&&(nilai<=100))
cout<<"Nilai A"<<endl<<endl;
else
cout<<"salah memasukkan angka (angka>100)"<<endl<<endl;
}
int main(int argc, char *argv[])
{
hehehe:
NILAI ku;
int q;
cout<<"======================PILIHAN====================="<<endl;
cout<<"1. Konversi nilai"<<endl;
cout<<"2. Keluar/Exit"<<endl;
cout<<"masukkan pilihan anda = ";cin>>q;
switch(q){
case 1: ku.konversikan();goto hehehe;
break;
case 2: return EXIT_SUCCESS;
break;
default: cout<<"\n\n \t\t PILIHAN SALAH"<<endl<<endl;goto hehehe;
}
system("pause");
return EXIT_SUCCESS;
}
Flowchart:
Tidak ada komentar:
Posting Komentar