I am here as a junior programmer to give an example of a simple program using C language, which can help proram by lecturers or teachers to provide the converted value of a digit into the letter obtained by the students. Soure Consider the following code:
#pragma argsused
#include
class MAHASISWA {
int NIM;
char Name[25];
int Nilai;
char grade;
public:
void SetMahasiswa(){
cout<<"masukkan NIM :";
cin>>NIM;
cout<<"masukkan Name :";
cin>>Name;
cout<<"masukkan Nilai Akhir :";
cin>>Nilai;
cout<<"\n";
}
void InfoMahasiswa(){
cout<<"NIM :"<<
cout<<"Name :"<<
cout<<"Nilai Akhir :"<<
if (Nilai > 90 && Nilai < 100)
{
grade = 'A';
}
else if (Nilai > 80 && Nilai < 90)
{
grade = 'B';
}
else if (Nilai > 70 && Nilai < 80)
{
grade = 'C';
}
else if (Nilai > 60 && Nilai < 70)
{
grade = 'D';
}
else
{
grade = 'E';
}
cout<<"Hi got grade :"<<
cout<<"\n";
}
};
int main(){
int x;
MAHASISWA M;
M.InfoMahasiswa();
M.SetMahasiswa();
cin>>x;
return 0;
}
Observe and understand source code above, hopefully this program can help semwa among those who need them ... .. may be useful ...
0 komentar:
Posting Komentar