Data Mahasiswa
1.
Menampilkan data mahasiswa dengan C++ :
#include <iostream>
#include <cstdlib>
#include <string>
/* 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) {
string nama[30];
int nilai[5],nilai1
[5];
for (int
i=0;i<4;i++){
cout<<"masukkan nama
:";
cin>>nama[i];
cout<<"masukkan nilai Tugas
:";
cin>>nilai[i];
cout<<"masukkan nilai UAS
:";
cin>>nilai1[i];
}
cout<<"--------------------------------------------------------------------------------------------------------------\n";
cout<<"\t NAMA\t|\tNilai Tugas\t|\tNilai UAS\t|\n";
cout<<"--------------------------------------------------------------------------------------------------------------\n";
for (int
ii=0;ii<4;ii++){
cout<<"|\t"<<nama
[ii]<<"\t|\t"<<nilai
[ii]<<"\t\t|\t"<<nilai1 [ii]
<<"\t\t|\n";}
cout<<"--------------------------------------------------------------------------------------------------------------\n";
return
0;
}
Hasil compilenya :
0 komentar:
Posting Komentar