Assignment Solution:
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
int main()
{
clrscr();
int IndexA[10] = {0,0,0,0,0,0,0,0,0,0};
int IndexB[10] = {0,0,0,0,0,0,0,0,0,0};
cout<<"You Are Requested To Enter Values in Arrays "<<endl;
cout<<"you should enter values between 1 & 20 "<<endl;
cout<<"Enter Value In First Array"<<endl;
for(int x=0 ; x<10 ; x++)
{
cout<<"Enter Value at - "<<x+1<<" - location - ";
cin>>IndexA[x];
if(IndexA[x] < 0 )
{
cout<<"please eneter the value between 1 & 20";
cin>>IndexA[x];
}
else if(IndexA[x] >20)
{
cout<<"please eneter the value between 1 & 20";
cin>>IndexA[x];
}
}
clrscr();
cout<<"enter Value In Second Array"<<endl;
for(x=0 ; x<10 ; x++)
{
cout<<"Enter Value at - "<<x<<" - location - ";
cin>>IndexB[x];
if(IndexB[x] < 0 )
{
cout<<"please eneter the value between 1 & 20";
cin>>IndexB[x];
}
else if(IndexB[x] >20)
{
cout<<"please eneter the value between 1 & 20";
cin>>IndexB[x];
}
}
clrscr();
cout<<"You have enter these values in Array"<<endl;
for(x =0 ; x<10 ; x++)
{
cout<<"Ist Array at - "<<x+1<<" - " <<IndexA[x]<<"| 2nd Array - " <<IndexB[x]<<endl;
}
//int IndexC[10] = {0,0,0,0,0,0,0,0,0,0};
for(x =0 ; x <10 ;x++)
{
if(IndexA[x] == IndexB[x])
{
cout<<"Values Are Same At Index - "<<x+1<<"Where Value Is = "<<IndexA[x]<<endl;
}
}
return 0;
}
No comments:
Post a Comment
Please Comment About my Work