/*Write a program to represent Liner Array in C++*/
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
cout<<"Liner Array in C++\n";
int a[5];
int i;
cout<<"Enter the Numbers : ";
for(i=0;i<5;i++)
{
cin>>a[i];
}
cout<<"After Inputting Array: ";
for(i=0;i<5;i++)
{
cout<<"\na="<<a[i];
}
getch();
}
Output:
/*Write a program to represent Two Dimensional Array in C++*/
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
cout<<"\tTwo Dimensional Array in C++\n";
int a[2][2];
int r,c;
cout<<"\n\tEnter the Rows and Columns :\t\n ";
for(r=0;r<2;r++)
{
for(c=0;c<2;c++)
{
cin>>a[r][c];
}
}
cout<<"\t After Inputting Array: \n";
for(r=0;r<2;r++)
{
for(c=0;c<2;c++)
{
cout<<"\t a="<<a[r][c];
}
cout<<"\n";
}
getch();
}