//efek salju

Kamis, 08 November 2012

program mengihitung ipk menggunakan program c++


#include <conio.h>
#include 
<iostream.h>
#include < stdio.h>

main(){
int jml_mk,sks,bn,jn,js,nilai_angka;
char kode_mk[15],nama_mk[50],nilai;
float ipk;
jn=0;
js=0;
cout<<"\t\t\tMenghitung IPK\n"<<"\n";
cout<<"Masukkan Jumlah Mata Kuliah=";
cin>>jml_mk;
for(int i=1;i<=jml_mk;i++)
{
cout<<"Masukkan Kode Mata Kuliahnya=";
cin>>kode_mk;
cout<<"Masukkan Nama Mata Kuliahnya=";
cin>>nama_mk;
cout<<"masukkan SKS(2/4)=";
cin>>sks;
cout<<"masukkan nilainya(A/B/C/D/E)=";
cin>>nilai;
cout<<endl;

switch(nilai){
case 'A':
nilai_angka=4;
break;
case 'B':
nilai_angka=3;
break;
case 'C':
nilai_angka=2;
break;
case 'D':
nilai_angka=1;
break;
case 'E':
nilai_angka=0;
}





bn=nilai_angka*sks;
cout<<"bobot nilai anda="<<bn;
jn=jn+bn;
cout<<"\njumlah nilai anda="<<jn;
js=js+sks;
cout<<"\njumlah sks anda="<<js;
cout<<"\n\n";
}
ipk=float(jn)/js;
cout<<"\nipk anda="<<ipk;
getch();}</ipk;
</js;
</jn;
</bn;
</endl;