Tuesday, July 14, 2009

How do you run this simple C code?

Determine the order of execution of operations in the code below. Determine the sequence actively.





{ int A=9,B=3,C=1;


Printf(“%d %d %d %d”, A++,--B,C++,A*B*C);


}





Nothing I put in front of it or after it will make it run. I don't care about the answer, my professor keeps saying to run to verify what it says. I don't know what he wants! ahh!

How do you run this simple C code?
#include %26lt;stdio.h%26gt;


#include %26lt;conio.h%26gt;





main ()


{


int a=9, b=3 , c=1;


printf ("%d %d %d %d",A++,--B,C++,A*B*C);





getch()











OUTPUT WILL BE


10 2 2 27





}
Reply:Define int A


Assign 9 to A


Define int B


Assign 3 to B


Define int C


Assign 1 to C





Subtract 1 from B


Print A


Print B


Print C


Calculate A*B*C


Print result of calculate


Add 1 to A


Add 1 to C
Reply:Did you compile it? You need to compile it in order to run it. Try getting the free Borland compiler. I would recommend this guide on how to compile it. http://computerprogramming.suite101.com/...





If it compiles unsuccessfully, the compiler will point out errors and then you should fix those and it should compile right.


-If it compiles properly, run it by using a command prompt window by going to the directory with cd c:\...


then run Filename.exe or it you wont see the result.

potential breakup song

No comments:

Post a Comment