+ 5
Return, exit and turbo c++
during my CS practicals in my school, 2 programs were given to me. I made one of them. but in the second one I tried to make use of of return function but as we know most of our school uses turbo C++. so when it encountered return function it went back to the coding section again but I wanted it stop there. then I tried it with exit function but still was unsuccessful. whereas in SL's Compiler it works well I have tried it on 3 or 4 different compilers where it worked well what's the problem with turboc++
6 Answers
+ 6
Turbo C++ is too old. It was last updated before my birth!
It is unfortunate that we too have to use it in our college ICT projects.
https://www.sololearn.com/Discuss/288609/?ref=app
+ 6
Can you post the code if possible?
It will be easier for me then to try providing a solution.
+ 5
@CIPHER It may vary, it depends on the college I guess
+ 4
@kinshuk don't ask me for the code
it was very easy
trust me
u will laugh if I'll tell u
edit: done
https://code.sololearn.com/cLQHgLTj8915/?ref=app
+ 4
@dipta what????
we have to use turbo c++ in colleges too!!!!???
+ 3
@CIPHER
I may have a theory for the problem.
All compilers other than Turbo C++ don't mind if the main function was supposed to return int but you skipped the return 0 option.
But, Turbo C++, requires you to return an int if your main is supposed to return an int. So when your program exits the else block for a prime number, it cannot find any return 0, and thus fails.
Thats my assumption. Ill have to check at my school someday to verify things though, as I don't have Turbo in my Laptop.