Basic Array Example Program




#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;

}

Posted in , . Bookmark the permalink. RSS feed for this post.

Leave a Reply

Pages

Search

Sandiah Notes Template Sandroid11.blogspot.com.