+ 3

Output for code - turbo c++

I know turbo c++ is not taught here, but it is taught in my school. I came across this question : find the output and number of times the code runs: for(int I=0;i<30;i++) { if(i%5) cout<<++I<<endl; else if(i%3==2) cout<<i+5<<endl; else if(i%2==0) cout<<++i<<i++<<endl; else i+=5; }

17th Aug 2017, 2:49 PM
S V Shanmugha Balan
S V Shanmugha Balan - avatar
7 ответов
+ 11
@S V Shanmugha Balan I'm aware. It's regretful to know that some schools still worship TCC. This just shows that those in charge of your education either still live in the past and believe that the latest version of Android is Eclair, or has no idea at all what being a programmer is about. I'm just here to remind you that it is important to learn standard C++ (alongside Turbo C++, if inevitable). If the question you posted is an academic one, whoever created it should be prosecuted - There is never a standard answer to it, and never will you in any practical situation use such code in your projects.
17th Aug 2017, 4:05 PM
Hatsy Rei
Hatsy Rei - avatar
+ 9
It would be a great idea to stay updated. https://www.sololearn.com/Discuss/288609/?ref=app Also, the above code results in undefined behaviour. Refer: https://stackoverflow.com/questions/4176328/undefined-behavior-and-sequence-points
17th Aug 2017, 2:55 PM
Hatsy Rei
Hatsy Rei - avatar
+ 6
also you code will have errors look at the conditional statemenst in the c++ course copy the if else code by hand or typing. - you should find the mistake
17th Aug 2017, 4:42 PM
Manual
Manual - avatar
+ 3
yes I already sent a post abt tcc and SL playground and if I remember right u answered it but my school says "LEARN TCC OR ELSE...."
17th Aug 2017, 2:56 PM
S V Shanmugha Balan
S V Shanmugha Balan - avatar
+ 3
tq guys lol @Hatsy Rei
18th Aug 2017, 11:08 AM
S V Shanmugha Balan
S V Shanmugha Balan - avatar