what is the output of 'c++' code?????
void main()
{
int num=190*300/300;
cout<<"num:"<<num;
}
explain me !!!!!!what is the logic behind it????
😕😕😕
Member • Apr 2, 2009
Member • Apr 2, 2009
@Maro I guess he/she is trying to ask what is the logic behind the output?MaRoWhat is the logic behind what?
Member • Apr 3, 2009
Member • Apr 3, 2009
I compiled the above code for 32-bit machine and then executed the code and it gave me "190" as output which i feel is desired output.impecable_abhivoid main()
{
int num=190*300/300;
cout<<"num:"<<num;
}
explain me !!!!!!what is the logic behind it????
Member • Apr 3, 2009
Member • Apr 3, 2009
Member • Apr 3, 2009
I am using a 32-bit gcc compiler and running it on 32-bit RHEL5 machine. For using gcc on Windows download cygwin or djgpp2. For compiling code use gpp compiler.MaRoPlease give more info about your machine & compiler you using.
Actually i was replying to query from impecable_abhi but by the time i could have posted you had already replied to the mail😀kidakakaI ran this code on TurboC, the same compilers which our colleges used to have. It takes a pain to run it on Vista 😀, but it runs still the same. So, yes I am using a 16 bit compiler.
Member • Apr 5, 2009
Member • Apr 5, 2009
Member • Apr 6, 2009
I am using 32-bit gcc compiler with which i am not facing the issue.silverscorpionI use turbo C 16 bit compiler and I got -28 as the answer.
How will you get 190 as the answer? What is the compiler you are using??
Member • Apr 6, 2009
Member • Apr 8, 2009
thanx salini for understanding me well.....shalini_goel14@Maro I guess he/she is trying to ask what is the logic behind the output?
By the way -what will be the output? C++ users answer Please?
Member • Apr 14, 2009
Member • Apr 14, 2009
Member • Apr 14, 2009
The output does not comes as 190 when user compiles the code to generate executable for 16-bit machine. See below post for more details:slashfearHi abhi (Guess thats your name!!),
so the output of the code is: num: 190
Member • Apr 15, 2009
pradeep_agrawalThe output does not comes as 190 when user compiles the code to generate executable for 16-bit machine. See below post for more details:
#-Link-Snipped-#
-Pradeep
Member • Apr 15, 2009