LATIHAN MINGGU KEDUA
KONVERSI NILAI ANGKA KE HURUF#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
class Nilai{
public:
Nilai();
void input();
void output();
private:
int n;
};
Nilai :: Nilai(){
cout<<"\t\t syahrul afrizal\n\t\t 1400018135\n\n\n"<<endl;
}
void Nilai::input(){
cout<<"masukan nilai : ";
cin>>n;
}
void Nilai :: output(){
if(n>=80)
cout<<"A";
else if(n>=65 && n<80)
cout<<"B";
else if(n>=55 && n<65)
cout<<"C";
else if(n>=30 && n<55)
cout<<"D";
else
cout<<"tidak lulus";
}
int main(int argc, char *argv[]) {
Nilai x;
x.input();
x.output();
return 0;
}
0 komentar: