Array

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

int main()
{
int data[3];
int a[4];
int b[5]={9,8,7,6,5};

cout<<”Inputan langsung”<<endl;
data[0]=2;
data[1]=4;
data[2]=5;
cout<<data[0]<<endl;
cout<<data[1]<<endl;
cout<<data[2]<<endl;

cout<<”\n\input keyboard”<<endl;
cin>>a[0];
cin>>a[1];
cin>>a[2];
cin>>a[3];
cout<<”Data a[0]:”<<a[0]<<endl;
cout<<”Data a[1]:”<<a[1]<<endl;
cout<<”Data a[2]:”<<a[2]<<endl;
cout<<”Data a[3]:”<<a[3]<<endl;

cout<<”\n\Inputan langsung INT”<<endl;
cout<<”Data b[0]:”<<b[0]<<endl;
cout<<”Data b[1]:”<<b[1]<<endl;
cout<<”Data b[2]:”<<b[2]<<endl;
cout<<”Data b[3]:”<<b[3]<<endl;
cout<<”Data b[4]:”<<b[4]<<endl;

getch();
return 0;

}

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s