what will the first printf output??? it seems sth irrelevant..
Code:void main( ) { int count = 1; while ( count <= 10 ) { printf("%d", count % 2 == 1 ? "****" : "++++++++" ); printf( “\r\n” ); ++count; } // end while } // end main
what will the first printf output??? it seems sth irrelevant..
Code:void main( ) { int count = 1; while ( count <= 10 ) { printf("%d", count % 2 == 1 ? "****" : "++++++++" ); printf( “\r\n” ); ++count; } // end while } // end main
Why don't you compile your program and find out?
Jim
Compile and run the program to find out.Originally Posted by hamidhqs
Also, #include <stdio.h> and change void main to int main.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I think you coded this in MS Word... .____.
Remove the smart quotes
excuse me, i just copied the code,though i used quotes but it output sth like:
135614000
134514001
...
i don't know what is it!!!! (from where it comes??)
tnx
Line 13 the printf() format specifier is incorrect, it should be "%s" not "%d".
Jim
Those are the addresses of the two string literals in the printf. Try changing %d to %s.
Also, get rid of the \r.
The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss
if it is odd, should it print the integer equal to four "*"?? i mean does it return integer equal to the "****" and how it will be sth such 1356140001??? it's too big!!!!!
[code]printf("%d",count%2==1 ? "****" : "++++++++" )[code]
tnx (0_0)