Monday, 27 March 2017

Tugas Struktur Data Bagian 2

Contoh Program Array 1 Dimensi

#include <iostream.h>
#include <conio.h>

void main()
{
clrscr(); //untuk menghapus tampilan layar
int nilai[5];

cout<<"Masukan nilai diaz"<<endl;
cout<<"======================="<<endl;
cout<<"Nilai Bahasa Indonesia : "; cin>>nilai[0];
cout<<"Nilai Bahasa Inggris : "; cin>>nilai[1];
cout<<"Nilai Matematika : "; cin>>nilai[2];
cout<<"Nilai Olah Raga : "; cin>>nilai[3];
cout<<"Nilai Memancing : "; cin>>nilai[4];
cout<<endl;

cout<<"Hasil Nilai"<<endl;
cout<<"1    2    3    4    5"<<endl<<endl;
cout<<nilai[0]<<"    ";
cout<<nilai[1]<<"    ";
cout<<nilai[2]<<"    ";
cout<<nilai[3]<<"    ";
cout<<nilai[4]<<"    "<<endl;
getch();
}

Contoh Tampilan Output


No comments:

Post a Comment