Click here to Skip to main content
15,911,317 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Full Screen Pin
loyal ginger21-Oct-09 8:38
loyal ginger21-Oct-09 8:38 
AnswerRe: Full Screen Pin
MrMcIntyre22-Oct-09 5:53
MrMcIntyre22-Oct-09 5:53 
AnswerRe: Full Screen Pin
David Crow22-Oct-09 5:59
David Crow22-Oct-09 5:59 
GeneralRe: Full Screen Pin
MrMcIntyre22-Oct-09 6:04
MrMcIntyre22-Oct-09 6:04 
AnswerRe: Full Screen Pin
Iain Clarke, Warrior Programmer21-Oct-09 8:53
Iain Clarke, Warrior Programmer21-Oct-09 8:53 
GeneralRe: Full Screen Pin
MrMcIntyre24-Oct-09 3:14
MrMcIntyre24-Oct-09 3:14 
GeneralRe: Full Screen Pin
Iain Clarke, Warrior Programmer24-Oct-09 4:22
Iain Clarke, Warrior Programmer24-Oct-09 4:22 
QuestionThe output seem confusing please clear my doubt Pin
venkatasu21-Oct-09 4:20
venkatasu21-Oct-09 4:20 
I am new to this forum,

Please refer to the c++ program and the output below. I understand the program but I have a small doubt regarding the output of the program. pls help.

# include <iostream.h>
# include <conio.h>
void main ( )
{
int x[5] = {1,2,3,4,5}, y [5] = {5,4,3,2,1},
result [5] = { 0,0,0,0,0 };
int i= 0,j=0;
clrscr();
while (i++ < 5)
{
cout<<i<<"\n";
result [i] = x [i] + y [i];
}
cout <<"\n The contents of the array are: \n";
do
{
cout << "\t" << x [j];
cout<< "\t" << y [j];
cout<<"\t"<< result [j]<<"\n";
j++;
} while (j<5);
getch ( );
}

While executing the output of the program is:-

1 -1 0
2 4 -2
3 3 0
4 2 2
5 1 4

How i get the output as 1 -1 0 in the first row especially I presume the output should be 1 5 0 in the first row. Please help.

thanks
AnswerRe: The output seem confusing please clear my doubt Pin
Chuck O'Toole21-Oct-09 4:25
Chuck O'Toole21-Oct-09 4:25 
GeneralRe: The output seem confusing please clear my doubt Pin
venkatasu21-Oct-09 4:59
venkatasu21-Oct-09 4:59 
GeneralRe: The output seem confusing please clear my doubt Pin
Chuck O'Toole21-Oct-09 5:01
Chuck O'Toole21-Oct-09 5:01 
GeneralRe: The output seem confusing please clear my doubt Pin
venkatasu21-Oct-09 5:06
venkatasu21-Oct-09 5:06 
GeneralRe: The output seem confusing please clear my doubt Pin
Chuck O'Toole21-Oct-09 5:07
Chuck O'Toole21-Oct-09 5:07 
GeneralRe: The output seem confusing please clear my doubt Pin
venkatasu21-Oct-09 5:13
venkatasu21-Oct-09 5:13 
QuestionRe: The output seem confusing please clear my doubt Pin
David Crow21-Oct-09 5:16
David Crow21-Oct-09 5:16 
AnswerRe: The output seem confusing please clear my doubt Pin
venkatasu21-Oct-09 5:42
venkatasu21-Oct-09 5:42 
GeneralRe: The output seem confusing please clear my doubt Pin
David Crow21-Oct-09 5:47
David Crow21-Oct-09 5:47 
GeneralRe: The output seem confusing please clear my doubt Pin
Chuck O'Toole21-Oct-09 5:20
Chuck O'Toole21-Oct-09 5:20 
GeneralRe: The output seem confusing please clear my doubt Pin
venkatasu21-Oct-09 5:44
venkatasu21-Oct-09 5:44 
GeneralRe: The output seem confusing please clear my doubt Pin
David Crow21-Oct-09 5:49
David Crow21-Oct-09 5:49 
AnswerRe: The output seem confusing please clear my doubt Pin
David Crow21-Oct-09 4:33
David Crow21-Oct-09 4:33 
GeneralRe: The output seem confusing please clear my doubt Pin
venkatasu21-Oct-09 4:57
venkatasu21-Oct-09 4:57 
AnswerRe: The output seem confusing please clear my doubt Pin
David Crow21-Oct-09 5:00
David Crow21-Oct-09 5:00 
GeneralRe: The output seem confusing please clear my doubt Pin
venkatasu21-Oct-09 5:03
venkatasu21-Oct-09 5:03 
GeneralRe: The output seem confusing please clear my doubt Pin
David Crow21-Oct-09 5:08
David Crow21-Oct-09 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.