Help me to solve Turbo C++ problem

The only programming language I know is Turbo C++. I’m not much of an expert on Turbo C++ either. I’m currently studying in XII. I request someone to help me because Turbo C++ is not accepted on codechef.

1 Like

Start using GCC compiler… Avoid using Non-Standard Compiler like Turbo C++:slight_smile:

Turbo c++ is not a language. C++ is the language and turbo c++ is the compiler. Try a different compiler like dev-cpp as turbo c++ is extremely outdated. Neverthless, which ever compiler you use, use standard c/c++. Compilers add some of there own functions which will not be computed in any online platforms.

Just follow some simple tricks :

  1. Never use conio.h header as it is not part of the international standard.

  2. Don’t use getch() or clrscr() as they are in conio.h , also they are not required in online platforms. If you need getch(), use getchar() instead.

  3. Check out the FAQ for other queries.

2 Likes

Welcome to codechef, i’ll be your guide.

Step 1: Stop using turbo c++. Install devc++ or codeblocks(recommended).
ps: You’ll need turboc++ in your XII so keep using it but strictly for school.

Step 2: Look at the list of standard libraries on [http://www.cplusplus.com/reference/][1] . These are the ONLY and the ONLY header files you can use. So make sure the programs you’re writing don’t contain header files other than these.

Step 3: Solve the easiest problems first. Sort the easy problems by successful submissions and solve each problem one by one.

I’ll create a small tutorial for you right here.

#include<iostream>
using namespace std;
int main()
{
    cout<<"Hello world"<<endl;
    return 0;
}

Points to note:

  1. No .h after iostream. It’s not needed anymore in the new c++ version. You’re a big boy now, congratulations.

  2. using namespace std; You just have to use this. read more about namespaces at http://www.learncpp.com/cpp-tutorial/711-namespaces/ (On second thoughts, namespaces aren’t the thing beginners should worry about)

  3. Note that return value of main is “int”. In turbo c++, you could have void main, but in standard c++, you must return an int. and the standard return value is 0.

I should write a blog post about this but here are a few more things to note.

  1. Strings. Strings are already built in c++ so you dont have to use array of characters anymore. Simply do this:

string str; //declaration cin>>str; //for input. //(Don't use gets()!!!)(delimiting char is ' '(space)) cout<<str; //for output. //(Don't use puts()!!!) str="tacoder has the " + "best answer"; //for initialisation and concatenation and . (no need for using strcat) string str2 = "tacoder has the best answer"; if(str == str2) //for comparision. tacoder.karma++;

Happy coding.
[1]: http://www.cplusplus.com/reference/

5 Likes

Turbo C++ is not a well standard,hence you should start works on GCC Compiler.

Forgot to add: Don’t use conio.h, DOS.h. basically any header file that isn’t in the link i provided. And you’ll be good to go.

2 Likes

Hey Thanks alot once again. I don’t know what I would have done without you guys.

There’s an exam called ESYA by IIIT DELHI coming up and I have registered for the exam from School. Do you think I would be able to solve even one of those questions with the knowledge I have.I can have successfully made all the Turbo c++ programs of my academic year until now can solve even application level problems. But that is in Turbo C++. So do you think I have any chance at this exam? Please lend me your opinion.