Sabtu, 12 Maret 2016

PROGRAM MENGHITUNG NILAI RATA-RATA

0

#include "iostream"
#include <windows.h>

using namespace std;
main (){
int i,nilai[2];
string nim [2],no[2];
for(i=0;i<2;i++){
cout<<"data ke :"<<i+1<<endl;
cout<<"nim  :\t";cin>>nim[i];
cout<<"masukan nilai :\t";cin>>nilai[i];
cout<<endl;
}
cout<<"=====================================================\n";
cout<<"NO\tNIM\t\t\tNILAI\t\tgrade\n";
cout<<"=====================================================\n";
      for(i=0;i<2;i++){
  cout<<no[i]<<i+1<<"\t";
      cout<<nim[i]<<"\t\t";
      cout<<nilai[i]<<"\t\t";
     
      if(nilai[i]>=80)
       cout<<"A"<<endl;
      else if (nilai[i]>=60 && nilai[i]<80 )
       cout<<"B"<<endl;
      else if (nilai[i]<=60 )
       cout<<"C"<<endl;
}  
}




0 komentar:

Posting Komentar