Pada Tutorial ini saya menggunakan aplikasi DEV C++.
Berikut Scriptnya :
#include <iostream>
using namespace std;
int main(){
int data,tugas[5],uts[5],uas[5],rata[5];
char nama[50][40],grade[10];
cout<<"Jumlah Mahasiswa : "; cin>>data;
for(int i=0;i<data;i++){
cout<<"\tData ke - "<<i+1<<endl;
cout<<"Masukan Nama : "; cin>>nama[i];
cout<<"Masukan Nilai Tugas : "; cin>>tugas[i];
cout<<"Masukan Nilai UTS : "; cin>>uts[i];
cout<<"Masukan Nilai UAS : "; cin>>uas[i];
cout<<endl;
rata[i]=(tugas[i]+uts[i]+uas[i])/3;
if(rata[i] >= 85){
grade[i] = 'A';
}else if(rata[i] >= 75){
grade[i] = 'B';
}else if(rata[i] >= 60){
grade [i]='C';
}else if(rata[i] >=50){
grade [i]= 'D';
}else if (rata[i] <=50){
grade [i]= 'E';
}
}
cout<<"Data Mahasiswa"<<endl;
cout<<endl;
for(int i=0;i<data;i++){
cout<<"\tData ke - "<<i+1<<endl;
cout<<"Nama Mahasiswa : "<<nama[i]<<endl;
cout<<"Nilai Tugas : "<<tugas[i]<<endl;
cout<<"Nilai UTS : "<<uts[i]<<endl;
cout<<"Nilai UAS : "<<uas[i]<<endl;
cout<<"Rata-Rata : "<<rata[i]<<endl;
cout<<"Grade : "<<grade[i]<<endl;
}
return 0 ;
}
Output :
Semoga Bermanfaat.
Sangat bermanfaat gan :)
BalasHapus