#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <constrea.h>
#include <math.h>
// Prototype structure
constream tampil;
struct data_tgl
{ int tgl;
int bln;
int thn;
} data_tgl1;
class data_mhs
{ private:
char nobp[11];
char nama[20];
struct data_tgl tgl_lahir;
float NLUAS, NLUTS, NLPR, NLKUIS;
public :
void Input_Data();
void Tampil_Data();
char index(int N);
float Rata_rata(float A, float B, float C, float D);
};
char data_mhs::index(int N)
{ char hrf;
if (N>=80)
hrf='A';
else if (N>=65)
hrf='B';
else if (N>=65)
hrf='B';
else if (N>=55)
hrf='C';
else if (N>=35)
hrf='D';
else if (N>=1)
hrf='E';
else if (N==0)
hrf='F';
return hrf;
}
float data_mhs::Rata_rata(float A, float B, float C, float D)
{
return((0.4*A)+(0.3*B)+(0.2*C)+(0.1*D));
}
void data_mhs::Input_Data()
{ tampil.clrscr();
textcolor(14);
tampil << "<<INPUT DATA MAHASISWA>>" << endl;
tampil << "Nobp : ";
cin >> nobp;
tampil << "Nama : ";
cin >> nama;
tampil << "Tgl Lahir [dd/mm/yy] : ";
cin >> tgl_lahir.tgl>>tgl_lahir.bln >> tgl_lahir.thn;
tampil << "Nilai UAS : ";
cin >> NLUAS;
tampil << "Nilai UTS : ";
cin >> NLUTS;
tampil << "Nilai PR : ";
cin >> NLPR;
tampil << "Nilai KUIS : ";
cin >> NLKUIS;
}
void data_mhs::Tampil_Data()
{ float NR;
tampil.clrscr();
textcolor(14);
tampil << "<< ISI DATA MAHASISWA >>" << endl;
textcolor(15);
tampil << "Nobp : " << nobp << endl;
tampil << "Nama : " << nama << endl;
tampil << "Tgl Lahir [dd/mm/yy] : " << tgl_lahir.tgl<<tgl_lahir.bln
<< tgl_lahir.thn <<endl;
tampil << "Nilai UAS : " << NLUAS << endl;
tampil << "Nilai UTS : " << NLUTS << endl;
tampil << "Nilai PR : " << NLPR << endl;
tampil << "Nilai KUIS : " << NLKUIS << endl;
textcolor(15+BLINK);
cout <<endl;
NR=Rata_rata(NLUAS,NLUTS,NLPR,NLKUIS);
tampil << "Nilai Rata-rata : "<< NR << endl;
tampil << "Nilai Huruf : "<< index(NR) << endl;
}
// main Program
int main()
{
data_mhs m;
m.Input_Data();
m.Tampil_Data();
getche();
return 0;
}
Tidak ada komentar:
Posting Komentar