S
Siddhu
Hai, i am student & i have struck up with the following program's
output. Kindly help me to reason out why the output goes as which is
given below.
THE PROGRAM goes as;
#include<iostream.h>
#include<conio.h>
void main()
{ int i=0,x[5]={1,2,3,4,5},y[5]={5,4,3,2,1},r[5]={0,0,0,0,0};
while(i++<5)
r=x-y;
clrscr();
cout<<"\nThe contents of the array are:\n";
i=0;
do
{ cout<<'\t'<<x<<'\t'<<y<<'\t'<<r<<'\n';
i++;
}while(i<5);
getch();
}
OUTPUT of the ABOVE PROGRAM goes as:
The contents of the array are:
1 -1 0
2 4 -2
3 3 0
4 2 2
5 1 4
I need to know how the output for the very first line goes as 1
-1 0
though the program shows that there has been no change carried out for
the array data y[0]
I need aa helping hand from anyone who could explain how it turns up.
Please reply to me & my email ID goes as (e-mail address removed)
Fast reply would help me a lot.Bye.
output. Kindly help me to reason out why the output goes as which is
given below.
THE PROGRAM goes as;
#include<iostream.h>
#include<conio.h>
void main()
{ int i=0,x[5]={1,2,3,4,5},y[5]={5,4,3,2,1},r[5]={0,0,0,0,0};
while(i++<5)
r=x-y;
clrscr();
cout<<"\nThe contents of the array are:\n";
i=0;
do
{ cout<<'\t'<<x<<'\t'<<y<<'\t'<<r<<'\n';
i++;
}while(i<5);
getch();
}
OUTPUT of the ABOVE PROGRAM goes as:
The contents of the array are:
1 -1 0
2 4 -2
3 3 0
4 2 2
5 1 4
I need to know how the output for the very first line goes as 1
-1 0
though the program shows that there has been no change carried out for
the array data y[0]
I need aa helping hand from anyone who could explain how it turns up.
Please reply to me & my email ID goes as (e-mail address removed)
Fast reply would help me a lot.Bye.