CONTOH PROGRAM MENGHITUNG TOTAL JUMLAH MAHASSISWA DENGAN ARRAY C++

#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int i,total,jml_mhs[7]{40,40,30,32,34,43,34};
int nim[7]={1500018162,1500018161,1500018160,1500018164,1500018165,1500018167,1500018169};
string nama[7]={"a","b","c","d","e","f","g"};
total=0;
cout<<"No"<<"\t Nilai \t"<<"\t nim \t"<<"\t nama "<<endl;
for(i=0;i<7;i++){
cout<<i+1<<"\t"<<jml_mhs[i]<<"\t\t"<<nim[i]<<"\t\t"<<nama[i]<<endl;
total+=jml_mhs[i];
}
cout<<"----------------------------------------"<<endl;
cout<<"Jumlah Total Mahasiswa = "<<total;
return 0;
}

selamat mencoba :)

Comments