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?

17th Feb 2022, 3:26 AM
Kruti
Kruti - avatar
26 Respuestas
+ 3
Kruti Tell your college to keep upadate self. There are other better IDEs available then why forcing to use turbo C.
17th Feb 2022, 5:43 AM
A͢J
A͢J - avatar
+ 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++
17th Feb 2022, 8:13 AM
A͢J
A͢J - avatar
+ 3
Kruti Both should work try once
17th Feb 2022, 1:56 PM
A͢J
A͢J - avatar
+ 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).
17th Feb 2022, 4:04 AM
Kruti
Kruti - avatar
+ 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?
17th Feb 2022, 6:03 AM
Kruti
Kruti - avatar
+ 1
Are you aware that turbo c++ has been discontinued since 2006? Why would you want to use such an ancient compiler?
17th Feb 2022, 3:59 AM
Simon Sauter
Simon Sauter - avatar
+ 1
I assume we don't use using namespace std. Are there any more changes? Or will this code run in turbo c++?
17th Feb 2022, 4:06 AM
Kruti
Kruti - avatar
+ 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.
17th Feb 2022, 4:09 AM
Simon Sauter
Simon Sauter - avatar
+ 1
Simon Sauter oh alright, thanks!
17th Feb 2022, 4:50 AM
Kruti
Kruti - avatar
+ 1
watch some youtube tutorials, the algorithm is actually pretty easy.
17th Feb 2022, 8:00 AM
arturop200
arturop200 - avatar
+ 1
A͢J what about clrsrc and getch?
17th Feb 2022, 12:25 PM
Kruti
Kruti - avatar
+ 1
Arturop I watched a couple of YouTube videos, I'm still getting a little confused
17th Feb 2022, 12:26 PM
Kruti
Kruti - avatar
+ 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
17th Feb 2022, 6:28 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
A͢J thanks!
18th Feb 2022, 4:50 AM
Kruti
Kruti - avatar
+ 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).
18th Feb 2022, 9:38 PM
Hiba al-Sayf
Hiba al-Sayf - avatar
+ 1
Hiba al-Sayf alright, thanks a ton!
19th Feb 2022, 2:25 AM
Kruti
Kruti - avatar
+ 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
20th Feb 2022, 3:40 AM
Kruti
Kruti - avatar
0
FF9900 thank you so much!
18th Feb 2022, 4:49 AM
Kruti
Kruti - avatar
0
Try void main() instead of int main(). Earlier versions used a void declaration.
18th Feb 2022, 5:12 PM
Deepak Singh
Deepak Singh - avatar
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.
18th Feb 2022, 9:45 PM
Hiba al-Sayf
Hiba al-Sayf - avatar