Bytelandian gold coins using c++

Hi, I recently solved the Bytelandian gold coins problem.
It’s running successfully on my laptop in Turbo C++. but whenever I submit it, it shows compilation error and says “conio: No such file or directory”.
I am checking C++11 as the language while submitting my code. So, is there any problem with the language selection? What should I do?

conio.h is not a part of C standard library. That is the reason you are getting compilation error. Don’t use it.

2 Likes

Brother, the original conio.h was implemented by Borland, so its neither a part of the C/C++ Standard Library nor is defined by POSIX.

I had answered a similar question:-

http://discuss.codechef.com/questions/53520/why-does-a-compilation-error-occur-at-conioh-header-file

If you need to treat the terminal as something other than a set of character streams, your best bet is probably to look for a library which hides the details of the underlying terminal, screen or console from you. If you’re on a UNIX system, look at the curses or ncurses library; I don’t know of any suggestions for other OS.

5 Likes

First thing you need to know is that conio.h header file is there in TurboC++ but not in g++ which is gcc based.

U can remove this header and functions related to it like: getch();

Then you need to inclue this line: using namespace std; This is to use the standard functions in headers like iostream.

Write iostream instead of iostream, include "stdio.h and then no compilation error will be there unless you have made some syntax error.

1 Like

Good, thanks :slight_smile: