Question about cout.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dutrachr
    New Member
    • Mar 2008
    • 1

    Question about cout.

    Hi,

    I have a rather complex question regarding C++ and the use of cout. I am just curious if the command cout can do anything out of the ordinary to data.

    Say I want to print to the terminal the value of pc.

    Code:
    cout << "pc: " << pc << endl;
    In my progam, putting a cout statement into my code makes the program return the correct result, BUT returns the incorrect result without the cout statement.

    I tried many things and was able to narrow it down (with the help of my professor) that for some reason, the cout line made the difference.

    Any thoughts on the matter? I appreciate it.
  • mschenkelberg
    New Member
    • Jun 2007
    • 44

    #2
    Originally posted by dutrachr
    Hi,

    I have a rather complex question regarding C++ and the use of cout. I am just curious if the command cout can do anything out of the ordinary to data.

    Say I want to print to the terminal the value of pc.

    Code:
    cout << "pc: " << pc << endl;
    In my progam, putting a cout statement into my code makes the program return the correct result, BUT returns the incorrect result without the cout statement.

    I tried many things and was able to narrow it down (with the help of my professor) that for some reason, the cout line made the difference.

    Any thoughts on the matter? I appreciate it.
    Post the rest of your code?

    Comment

    • oler1s
      Recognized Expert Contributor
      • Aug 2007
      • 671

      #3
      Instead of dumping a vague attempt at a diagnosis, which tells us nothing, you should give us example snippets of code, with expected output and actual output. That is, facts and observations are more useful to us than speculation.

      Comment

      Working...