![]() |
|
#1
|
|||
|
|||
Program output in wrong orderWhen i use a combination of cout and printf statements, the program does not seem to read them from top to bottom as it moves down the program. It seems to see and evaluate the printf's first. Anyone know why this happens? The output i get when i run the following code is:
Line2 Line4 Line1 Line3 I thought i should be getting : Line1 Line2 Line3 Line4 CPP / C++ / C Code:
|
|
#3
|
|||
|
|||
|
Thanks! Putting in the line of code suggested on that page solved the problem. I'm only using the cout to help me make sure the program is working properly so i shouldn't need it in the end.
Thanks Again! |
|
#4
|
||||
|
||||
|
Quote:
You'd be better off changing the cout to printf()/puts() even in the beginning. No sense hitting your head against the wall because your debugging is throwing off your code/data. Stick with one or the other but never mix two differen output styles in a program. As you've seen, headache-city! __________________
Cow: You're a lawyer too? Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase! |
Recent GIDBlog
First week of IA training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [TUTORIAL] Calling an external program in C (Linux) | dsmith | C Programming Language | 4 | 22-Apr-2005 13:30 |
| What's wrong with my program? | agentxx04 | C Programming Language | 2 | 23-Nov-2004 20:48 |
| Something's wrong w/my program. | agentxx04 | C Programming Language | 1 | 07-Nov-2004 10:03 |
| Re: Pausing a Program | WaltP | C Programming Language | 3 | 28-Jul-2004 01:08 |
| using vector or array | oshiotse | CPP / C++ Forum | 4 | 16-Apr-2004 10:59 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The