0% found this document useful (0 votes)
28 views3 pages

#Include #Include #Include #Include #Include Using Namespace Float Float Char Void

This C++ program calculates a student's GPA (IPK) based on course grades and credits entered by the user. It contains functions to input course data including name, grade, credits and assign a letter grade/index. It tracks the running totals of credits and weighted grade points to calculate the cumulative GPA. The user can input multiple courses and see the output after each one, with a final display of their total credits and GPA after input is complete.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

#Include #Include #Include #Include #Include Using Namespace Float Float Char Void

This C++ program calculates a student's GPA (IPK) based on course grades and credits entered by the user. It contains functions to input course data including name, grade, credits and assign a letter grade/index. It tracks the running totals of credits and weighted grade points to calculate the cumulative GPA. The user can input multiple courses and see the output after each one, with a final display of their total credits and GPA after input is complete.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include "stdafx.

h"
#include<iostream>
#include <string>
#include<cmath>
#include<math.h>
using namespace std;
float jumlahmatkul, sks, n=0, nilaiindeks, jumlahsks = 0;
float ipk, nilai, nilaikum;
char indeks, tombol;
string namamatkul;
void hitung()
{
ipk = (nilaikum / jumlahsks);
cout << "\n";
cout << "---------------------------------------------------------------------------------------------------- \n";
cout << "| " << "total jumlah sks anda adalah " << jumlahsks << "\n";
cout << "| " << "ipk anda adalah " << ipk << "\n";
cout << "---------------------------------------------------------------------------------------------------- \n";
cout << "\n";
system("pause");
return;
}
void masukan()
{
cout << "--> " << "masukkan nama matakuliah ke-"<< n << "\t"; cin >> namamatkul;
cout << "--> " << "nilai mata kuliah : " << "\t" << "\t"; cin >> nilai;
if (nilai >= 0 && nilai < 30)
{

indeks = 'E'; nilaiindeks = 0;


}
if (nilai >= 30 && nilai < 50)
{
indeks = 'D'; nilaiindeks = 1;
}
if (nilai >= 50 && nilai < 60)
{
indeks = 'C'; nilaiindeks = 2;
}
if (nilai >= 60 && nilai < 75)
{
indeks = 'B'; nilaiindeks = 3;
}
if (nilai >= 75 && nilai < 100)
{
indeks = 'A'; nilaiindeks = 4;
}

cout << "--> " << "jumlah SKS mata kuliah = " << "\t" << "\t"; cin >> sks;

}
void masukan2()
{
do
{

cout << "--> " << "apakah sudah selesai memasukkan nilai? (y/n) "; cin >> tombol;
switch (tombol)
{
case 'y': hitung(); break;
case 'n': break;
default: break;
}
} while (tombol != 'y' && tombol != 'n');
}
int main()
{
for (;;)
{
n++;
masukan();
jumlahsks = sks + jumlahsks;
nilaikum = sks*nilaiindeks + nilaikum;
cout << "\n";
cout << "---------------------------------------------------------------------------------------------------- \n";
cout << "| " << "nama mata kuliah = " << namamatkul << "\n";
cout << "| " << "SKS mata kuliah = " << sks << "\n";
cout << "| " << "nilai = " << nilai << "\n";
cout << "| " << "indeks = " << indeks << "\n";
cout << "| " << "nilai indeks = " << nilaiindeks << "\n";
cout << "| " << "nilai kumulatif mata kuliah= " << sks*nilaiindeks << "\n";
cout << "| " << "nilai kumulatif total = " << nilaikum << "\n";
cout << "---------------------------------------------------------------------------------------------------- \n";
cout << "\n";

}
}

masukan2();

You might also like