i tried submitting a code for a program which is running perfectly fine on turbo c++ but doesent seems to work here
this is the code
#include<iostream.h>
#include<conio.h>
void main()
{
int n;
for( ; ; )
{
cin>>n;
if(n==42)
break;
cout<<n;
}
getch();
}
pls suugest a solution
2 Likes
use iostream instead of iostream.h and include using namespace std; as the compiler may not be able to compile the old version and also remove conio.h and hence the getch().
@mongasarthak , the above mentioned would definitely help you , but to avoid such header files related queries you can compile your code on online compliers , for example if you submit this code on ideone clearly it gives an error ,and thus you would know from it , that this header file which you added wouldn’t work on code chef too , so you can thus modify your code accordingly .
These error’s are very common initially so don’t worry much about it .
All the Best and happy coding .
2 Likes
I too faced the same problem initially .