Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
7. Trace the following program. For this tracing assignment, the column headings are provided for you. As always, follow the tracing guidelines as specified in the Homework Assignment Guidelines document.

C++
#include <iostream>
using namespace std;
	
int main()
{
    int x, y;
    cout << x + y << endl;
    for (x=12, y=1; x>0; x/=2)
    {
        if (x   3)
            cout << x + y << endl;
        cin >> y;
    }
}

input x y output

5
6
7
8
Posted
Updated 7-Feb-13 15:23pm
v2
Comments
SoMad 7-Feb-13 21:25pm    
I formatted the code for you (something you can do yourself by selecting the text and marking it with the appropriate programming language selection). Take a look at your code again and see if you can spot the error(s).

Soren Madsen

1 solution

It's your homework. If I do it I get the credit and that means you get to work for me for the rest of your life for no money. So I'm going to leave it for you to do and if anyone else does it for you I'm going to report them.
I hope that's clear enough.
 
Share this answer
 
Comments
kanku2 7-Feb-13 22:48pm    
If you want me to pay, we can talk this over.
Argonia 8-Feb-13 8:48am    
looool

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900