Menghitung IPK
1. Algoritma
2. Struct
struct{
char makul[10];
float SKS;
float nilai_akhir;
float scor;
float NAS;
}nilai[10];
struct{
float SKS;
float NAS;
float IP;
}mhs;
3. Program C++
#include <iostream>
#include <string.h>
#include <windows.h>
using namespace std;
struct{
char makul[10];
float SKS;
float nilai_akhir;
float scor;
float NAS;
}nilai[10];
struct{
float SKS;
float NAS;
float IP;
}mhs;
main()
{
int makul, bykSks=0;
float nil=0.00, n_Total;
cout << "Jumlah Mata Kuliah : ";
cin >> makul;
string nilai[makul];
int sks[makul];
for(int h=0; h<makul; h++)
{
cin.ignore();
cout <<h+1<< ". Nilai Huruf : ";
cin >> nilai[h];
cout<<"\t Banyak SKS : ";
cin >> sks[h];
bykSks += sks[h];
}
cout<<"\n"<<endl;
for(int h=0; h<makul; h++)
{
cout<<h+1<<". "<<nilai[h]<<" \t"<<sks[h]<<" SKS"<<endl;
}
cout<<endl;
for(int h=0; h<makul; h++)
{
if(nilai[h] == "A" || nilai[h] == "a")
nil += (4*sks[h]);
else if(nilai[h] == "B+" || nilai[h] == "b+")
nil += (3.5*sks[h]);
else if(nilai[h] == "B" || nilai[h] == "b")
nil += (3*sks[h]);
else if(nilai[h] == "C+" || nilai[h] == "c+")
nil += (2.5*sks[h]);
else if(nilai[h] == "C" || nilai[h] == "c")
nil += (2*sks[h]);
else if(nilai[h] == "D" || nilai[h] == "d")
nil += (1*sks[h]);
else
nil += 0;
}
n_Total = nil/bykSks;
cout << "IPK Semester ini : " << n_Total <<endl;
system("pause");
}
- Biodata
- Lain Lain
- Portofolio ALPRO
- Tugas Pribadi
- Tugas Kelompok
- Refleksi
- DIKTAT
- Codingan Program
- Praktikum
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar