Click here to Skip to main content
12,350,653 members (24,831 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++
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.

#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 7-Feb-13 15:01pm
kanku2253
Edited 7-Feb-13 15:23pm
SoMad157.8K
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100