You are not logged in. Please login at www.codechef.com to post your questions!

×

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.

asked 25 Jul '14, 18:02

arun_as's gravatar image

1★arun_as
7413618
accept rate: 10%

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

(28 Jul '14, 12:37) prem210★

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/ . 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.

link

answered 28 Jul '14, 13:09

tacoder's gravatar image

3★tacoder
5174615
accept rate: 18%

2

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.

(28 Jul '14, 13:10) tacoder3★

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.

link

answered 25 Jul '14, 19:57

dragonemperor's gravatar image

3★dragonemperor
89321134
accept rate: 10%

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.

(29 Jul '14, 11:56) arun_as1★

Start using GCC compiler... Avoid using Non-Standard Compiler like Turbo C++.. :)

link

answered 25 Jul '14, 19:46

nadimayaz's gravatar image

3★nadimayaz
119249
accept rate: 5%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,901

question asked: 25 Jul '14, 18:02

question was seen: 7,189 times

last updated: 29 Jul '14, 11:56