#include<iostream.h>
#include<iomanip.h>
int x,i;
char nama[5][20],Grade[5];
float nk[5],nt[5],nuts[5],nuas[5],total[5];
inputan()
{
cout<<"Masukan Jumlah Mahasiswa : " ;
cin>>x ;
for(int i=1;i<=x;i++)
{
cout<<"Data Ke - "<<i<<endl;
cout<<"Nama Mahasiswa : "; gets (nama[i]);
cout<<"Nilai Kuis : "; cin>>nk[i];
cout<<"Nilai Tugas : "; cin>>nt[i];
cout<<"Nilai UTS : "; cin>>nuts[i];
cout<<"Nilai UAS : "; cin>>nuas[i];
cout<<endl;
}
return(0);
}
proses()
{
for(int i=1;i<=x;i++)
{
total[i]=((nk[i]+nt[i]+nuts[i]+nuas[i])/4);
}
{
for(int i=1;i<=x;i++)
if(total[i]>=80)
Grade[i]='A';
else if(total[i]>=70)
Grade[i]='B';
else if(total[i]>=59)
Grade[i]='C';
else if(total[i]>=50)
Grade[i]='D';
else
Grade[i]='E';
}
return(0);
}
output()
{
cout<<"====================================="<<endl;
for (int i=1;i<=x;i++)
{
cout<<"Data Ke - "<<i<<endl;
cout<<"Nama Mahasiswa : "<<nama[i]<<endl;
cout<<"Nilai Kuis : "<<nk[i]<<endl;
cout<<"Nilai Tugas : "<<nt[i]<<endl;
cout<<"Nilai UTS : "<<nuts[i]<<endl;
cout<<"Nilai UAS : "<<nuas[i]<<endl;
cout<<"Nilai Akhir : "<<total[i]<<endl;
cout<<"Grade : "<<Grade[i]<<endl;
}
cout<<"====================================="<<endl;
}
main()
{
inputan();
proses();
output();
getch();
}
Link File : Klik disini.
Link Flowcart : Klik disini.
Tidak ada komentar:
Posting Komentar