Selamat Mencoba dan semoga bermanfaat!
Program :
#include <iostream.h>
#include <conio>
#include <stdio.h>
void j1(int &jx,int t,int k)
{
jx=t*k;
}
void j2(float &j,int k)
{ j=j+k; }
void j3(float &jl,int jx)
{ jl=jl+jx; }
void p(float &i,float j,float jl)
{ i=jl/j; }
void huruf(char &nilai_huruf,int l)
{
if (l>=85
&& l<=100)
nilai_huruf='A';
else
if(l>=75 && l<=84)
nilai_huruf='B';
else
if(l>=65 && l<=74)
nilai_huruf='C';
else
if(l>=55 && l<=64)
nilai_huruf='D';
else if
(l>=0 && l<=54)
nilai_huruf='E';
}
//void bt2();
void bobot(int &t,char h)
{
if(h=='A'
|| h=='a')
t=4;
else
if(h=='B' || h=='b')
t=3;
else
if(h=='C' || h=='c')
t=2;
else
if(h=='D' || h=='d')
t=1;
else
t=0;
}
main(){
int jx,l,b,t,n,k;
float i,jl=0,j=0;
char h,mk[50];
cout<<"\nPROGRAM PERHITUNGAN IPK";
cout<<"\n=============================================================="<<endl;
cout<<"\nMasukkan Berapa Mata Kuliah Yang
Anda Ambil : ";cin>>n;
for (int y=1;y<=n;y++)
{
cout<<"\nInput Mata Kuliah :
";gets(mk);
cout<<"\nInput Nilai\t :
";cin>>l;
cout<<"\nInput SKS\t :
";cin>>k;
huruf(h,l);cout<<"\n\nNilai Huruf\t:
"<<h;
bobot(t,h);
cout<<"\nBobot Nilai\t: "<<t;
j1(jx,t,k);cout<<"\nNilai\t:
"<<jx;
cout<<"\n,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"<<endl;
j2(j,k);
j3(jl,jx);
}
//j3(jl,j1)
//j2(j,k);
cout<<"\n\n\t\tBanyak SKS Anda : "<<j;
p(i,j,jl);
cout<<"\n\t\tIPK Anda : "<<i;
//j(ml,x)
cout<<"\n=================================================================";
getch();
}
//void jl(int a, int s)
//{ int j1;
// j1=a*s;
//}Screenshot Programnya :
ko nggk bisa d run ya pak ?
BalasHapussama
Hapus