why conio.h error during source code upload?

Hi, I am using Microsoft Visual C++ 2010 Express and have made the code for life,the universe and everything question.I have sucessfully compiled and ran the code in my computer(win 7 64 bit).
However when uploading the soln to problem as shown below:

using namespace std;
#include<iostream>
#include<conio.h>
int main(){
	int i = 0,arr[5];
	cin>>arr[i];
	while(arr[i]!=42){
		++i;
		cin>>arr[i];
	}
	for(int j = 0;j<=i-1;j++){
		cout<<arr[j]<<"\n";
	}
getch();
	return(0);
}

I am getting error that conio is not found and thus no definition for getch().Plz help asap.I am new here and stuck!

conio.h is not a standard library. It is present only on windows operating system, and not on linux.

Codechef uses SPOJ servers, which runs linux, hence the error.

Solution is simple, just remove conio.h and getch() from your code. See the sample solutions for various languages.

Also I advice you to never ever use “conio.h”, as it is non-standard and non-portable. And to ensure that your code runs on codechef, get Code::blocks IDE (comes with gcc, which is used on codechef) for windows.

1 Like

Hey There,conio.h is a C header file used in old MS-DOS compilers implemented by Borland, so its not a part of the C Standard Library.So it works fine as U are using Visual in Windows…
But your code is tested on Linux on gcc on CODECHEF.
So before submitting the code I advice u just remove conio.h and getch() from it…
Hope it Helped!
Happy Coding!!!

//