Program c++ untuk menentukan nilai akhir dan grade dalam huruf menggunakan struct atau simpul.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
| #include <iostream>
#include <conio.h>
#include <iomanip>
#include <windows.h>
using namespace std;
struct nilai
{
int nim;
char nama[20];
int nilai_tugas;
int nilai_uts;
int nilai_uas;
int nilai_akhir;
char nilai_huruf;
};
main()
{
nilai nil[5];
int i, data;
system("COLOR F0");
cout<<"PROGRAM MENGHITUNG NILAI AKHIR DAN GRADE MAHASISWA\n"<<endl;
cout<<"Silahkan Input NIM, Nama, Nilai Tugas, UTS serta UAS"<<endl;
cout<<"Kami akan menghitung Nilai Akhir dan Grade anda\n"<<endl;
cout<<"Jumlah Mahasiswa = ";cin>>data;
for(i=0; i<data; i++)
{
cout<<"\n====================================================="<<endl;
cout<<"NIM \t\t: ";cin>>nil[i].nim;
cout<<"Nama \t\t: ";cin>>nil[i].nama;
cout<<"Nilai Tugas \t: ";cin>>nil[i].nilai_tugas;
cout<<"Nilai UTS \t: ";cin>>nil[i].nilai_uts;
cout<<"Nilai UAS \t: ";cin>>nil[i].nilai_uas;
nil[i].nilai_akhir=(nil[i].nilai_tugas*20/100)+(nil[i].nilai_uts*35/100)+(nil[i].nilai_uas*45/100);
if(nil[i].nilai_akhir>85&&nil[i].nilai_akhir<=100)
{
nil[i].nilai_huruf='A';
}
else if(nil[i].nilai_akhir>70&&nil[i].nilai_akhir<=85)
{
nil[i].nilai_huruf='B';
}
else if(nil[i].nilai_akhir>55&&nil[i].nilai_akhir<=70)
{
nil[i].nilai_huruf='C';
}
else if(nil[i].nilai_akhir>40&&nil[i].nilai_akhir<=55)
{
nil[i].nilai_huruf='D';
}
else
{
nil[i].nilai_huruf='E';
}
cout<<endl;
}
system("CLS");
cout<<"Lembar Hasil Nilai Akhir dan Grade"<<endl;
for(i=0; i<data; i++)
{
cout<<"\n====================================================="<<endl;
cout<<"NIM \t\t: "<<nil[i].nim<<endl;
cout<<"Nama \t\t: "<<nil[i].nama<<endl;
cout<<"Nilai Tugas \t: "<<nil[i].nilai_tugas<<endl;
cout<<"Nilai UTS \t: "<<nil[i].nilai_uts<<endl;
cout<<"Nilai UAS \t: "<<nil[i].nilai_uas<<endl;
cout<<"Nilai Akhir \t: "<<nil[i].nilai_akhir<<endl;
cout<<"Grade \t\t: "<<nil[i].nilai_huruf<<endl;
}
getch();
}
|