+ 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++

8th Dec 2017, 6:05 AM
Saurabh Tiwari
Saurabh Tiwari - avatar
6 ответов
+ 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
8th Dec 2017, 7:00 AM
DAB
DAB - avatar
+ 6
Can you post the code if possible? It will be easier for me then to try providing a solution.
8th Dec 2017, 8:00 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 5
@CIPHER It may vary, it depends on the college I guess
8th Dec 2017, 2:07 PM
DAB
DAB - avatar
+ 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
8th Dec 2017, 2:01 PM
Saurabh Tiwari
Saurabh Tiwari - avatar
+ 4
@dipta what???? we have to use turbo c++ in colleges too!!!!???
8th Dec 2017, 2:02 PM
Saurabh Tiwari
Saurabh Tiwari - avatar
+ 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.
8th Dec 2017, 4:05 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar