Monday, February 14, 2011

Program Sederhana menghitung IPK

Program Penghitung IPK
/*copyright UchihaKurtz I'll amaterasu you if you copy this */
#include"iostream.h" 

#include"stdlib.h" 




using namespace std;
using std::string;


unsigned int iJMK, i, iSKS[30], iMutu[30];
float fJM, fJSKS, fIPK;
string sIndex[10], sTanya;
void disHeader();
void disInput();
void disOutput();
int main()
{
iJMK = 0;
fJSKS = 0;
fJM = 0;
i = 1;
system("cls");
disHeader();
cout<<"Jumlah Mata Kuliah Anda semester Ini [1-30]: ";
cin>>iJMK;
while (i <= iJMK)
{

disInput();
i++;
}
for (i = 1; i <= iJMK; i++)
{
disOutput();
}
for (i = 1; i <= iJMK; i++)
{
fJSKS = fJSKS + iSKS[i];
fJM = fJM + iMutu[i];
}
fIPK = fJM/fJSKS;
cout<<"\n\nJumlah MK : "<<<"\n";

cout<<"Jumlah SKS : "<<<"\n";

cout<<"Jumlah Mutu : "<<<"\n";

cout<<"IP Kumulatif: "<<<"\n";




Tanya:




cout<<"\nUlang Lagi? [Y/T] ";


cin>>sTanya;
if (sTanya == "Y" || sTanya == "y")
main();
else if (sTanya == "T" || sTanya == "t")
return(0);
else goto Tanya;
}
void disHeader()
{
cout<<"\t\tProgram Penghitung IPK\n\n";
}
void disInput()
{
i = 1;
while (i <= iJMK)
{
TryAgain:
system("cls");
disHeader();
cout<<"Mata Kuliah "<

cout<<"\n\nJumlah SKS: ";




cin>>iSKS[i];



cout<<"Masukkan Index/Code Nilai: ";


cin>>sIndex[i];
if (sIndex[i] == "A" || sIndex[i] == "a")
{
iMutu[i] = 4 * iSKS[i];
sIndex[i].assign("A");
}
else if (sIndex[i] == "B" || sIndex[i] == "b")
{
iMutu[i] = 3 * iSKS[i];
sIndex[i].assign("B");
}
else if (sIndex[i] == "C" || sIndex[i] == "c")
{
iMutu[i] = 2 * iSKS[i];
sIndex[i].assign("C");
}
else if (sIndex[i] == "D" || sIndex[i] == "d")
{
iMutu[i] = 1 * iSKS[i];
sIndex[i].assign("D");
}
else if (sIndex[i] == "E" || sIndex[i] == "e")
{
iMutu[i] = 0;
sIndex[i].assign("E");
}
else goto TryAgain;
i+=1;
}
}
void disOutput()
{
system("cls");
disHeader();
cout<<"--------------------------------------------------------------------\n";
cout<<"Mata Kuliah\t\tSKS\tIndex\t";
cout<<"\n--------------------------------------------------------------------\n";
for (i = 1; i <= iJMK; i++)
{
cout<<"MatKul "<<<"\t"<<"\t"<<<"\t"<<<"\n";




}
}

1 komentar so far

oke mas , langsung coba , haha

beri komentar anda tentang blog ini
EmoticonEmoticon