0
How is code for a program in turbo c++ different from other IDEs?
https://code.sololearn.com/cDQ5ZdU2IPS2/?ref=app I wrote this program to find out if the input is odd or even number. If I want to run this in turbo c++, how should I modify the code?
26 ответов
+ 3
Kruti
Tell your college to keep upadate self. There are other better IDEs available then why forcing to use turbo C.
+ 3
Kruti
Try with
#include<iostream.h>
#include<conio.h>
And remove using namespace std
Change return type int to void
Now run your code in Turbo C++
+ 3
Kruti
Both should work try once
+ 2
Simon Sauter yes I know turbo c++ is very old and it is discontinued. It's not that I want to use turbo c++. But my college has asked us to use turbo c++ only (there is nothing I can do).
+ 2
A͢J i wish they would listen. I can't do anything, and I need to use turbo c++ (atleast for college purpose). It's not that I want to use turbo c++ either. But can you help me with the question?
+ 1
Are you aware that turbo c++ has been discontinued since 2006? Why would you want to use such an ancient compiler?
+ 1
I assume we don't use using namespace std. Are there any more changes? Or will this code run in turbo c++?
+ 1
Unfortunately I can't help there at all. There used to be a guy here who knew his way around the differences between turbo c++ and modern c++, but he's gone now. I don't know if there's anyone here now who knows this kind of stuff.
+ 1
Simon Sauter oh alright, thanks!
+ 1
watch some youtube tutorials, the algorithm is actually pretty easy.
+ 1
A͢J what about clrsrc and getch?
+ 1
Arturop I watched a couple of YouTube videos, I'm still getting a little confused
+ 1
Kruti clrscr are also non standard function which is defined in conio header file which us used to clear screen getch too . Your college teacher will not see which ide you using try with vs code and install mingw compiler
+ 1
A͢J thanks!
+ 1
Given it's age, i think it won't understand namespaces, so you can remove using namespace std; (it's a different thing that you really shouldn't be using it anyhow). Similarly, i think the old compilers didn't take virtual headers (without the .h extension), so you should also fix the include.
That said, Turbo is horribly outdated. In the tech scale of things, it's ancient. If that isn't reason enough, it's also pre-standard C++, which means that a lot of what was even part of C++98 (forget the recent stuff like C++17) is unavailable to you. The "C++" of Turbo is technically "C with classes."
Now I'm not against sticking to something called "idiomatic C++" without reason (I think you can get pretty decent AND highly readable code if you mix C and C++ idiom), but that's no excuse to avoid modern features that are a real gem (e.g. most of the STL).
+ 1
Hiba al-Sayf alright, thanks a ton!
+ 1
Hiba al-Sayf I ran the program with void main clrsrc and getch. It worked!
I have not tried with int main and return
0
FF9900 thank you so much!
0
Try void main() instead of int main(). Earlier versions used a void declaration.
0
Kruti Not sure about clrsrc and getch but they look non-standard and implementation-specific, if not OS-specific (there's a lot of that in C++). Look for a website called the C++ Reference and look up equivalent functionality.