Tuesday, February 23, 2016

Listing Variabel Larik C++

VARIABEL LARIK 

#include <iostream.h>
#include <conio.h>
int x, A[5];
char Nama[25][5];
void isi();
void ctk();

void main(){
     isi();
     ctk();
}
void isi(){
     x=0;
     while (x<5) {
       x++;
       cout<<" Data ke : "<<x<< endl;
       cout<<" Nama : "; cin>>Nama[x];
       cout<<" Nilai: "; cin>>A[x];
     }
}
void ctk(){
     x=0;
     cout<<"No.  Nama  Nilai " <<endl;
     while (x<5) {
       x++;
       cout<<x<<"  "<<Nama[x]<<"  "<<A[x]<<endl;
     }
     getch();
}
 

No comments:

Post a Comment