Sabtu, 14 Desember 2013

Array 1 Dimensi

#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

int main(int argc, char *argv[])
{
    string nama[30];
    int nilai[5];
    int nilai2[5];
    for(int i=0;i<3;i++){
    cout<<"masukkan nama        : ";
    cin>>nama[i];
    cout<<"masukkan nilai Tugas : ";
    cin>>nilai[i];
    cout<<"masukkan UAS         : ";
    cin>>nilai2[i];
}
    cout<<" ---------------------------------------------------------------\n";
    cout<<"|\tNAMA\t|\tnilai tugas\t|\tnilai UAS\t|\n ";
    cout<<"---------------------------------------------------------------\n";
    for(int ii=0;ii<3;ii++)
   {
    cout<<"|\t"<<nama[ii]<<"\t|\t"<<nilai[ii]<<"\t\t|\t"<<nilai[ii]<<"\t\t|\n ";}
    cout<<"---------------------------------------------------------------\n";
    system("PAUSE");
    return EXIT_SUCCESS;
}






Tidak ada komentar:

Posting Komentar