codechef help pls

Aman Goyal

Aman Goyal

@aman-goyal-gQNNWx Oct 21, 2024
hi everyone,i just compiled my first program live,universe,everything in codechef,got compilation error,though the code is working completely fine in my turbo cpp compiler
enterd the lang as c++(gcc-4 0 0-8)no idea what 4 0 0-8 is!
Q
Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are integers of one or two digits.
Example

Input:
1
2
88
42
99

Output:
1
2
88

code-
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int a;
while(1)
{

cin>>a;
if(a!=42)
{
cout<<a;
}
else
{
break;
}

}
}

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Aman Goyal

    Aman Goyal

    @aman-goyal-gQNNWx Jun 12, 2011

    codechef
    Compilation Error

    In file included from /usr/lib/gcc/i486-linux/4.0.1/../../../../include/c++/4.0.1/backward/iostream.h:31, from /sources/tested.cpp:1: /usr/lib/gcc/i486-linux/4.0.1/../../../../include/c++/4.0.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated. /sources/tested.cpp:2:18: error: conio.h: No such file or directory /sources/tested.cpp:20:2: warning: no newline at end of file /sources/tested.cpp:3: error: '::main' must return 'int' /sources/tested.cpp: In function 'int main()': /sources/tested.cpp:4: error: 'clrscr' was not declared in this scope
  • Manish Goyal

    Manish Goyal

    @manish-r2Hoep Jun 12, 2011

    Aman Goyal
    hi everyone,i just compiled my first program live,universe,everything in codechef,got compilation error,though the code is working completely fine in my turbo cpp compiler
    enterd the lang as c++(gcc-4 0 0-8)no idea what 4 0 0-8 is!
    Q
    Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are integers of one or two digits.
    Example

    Input:
    1
    2
    88
    42
    99

    Output:
    1
    2
    88

    code-
    #include<iostream.h>
    #include<conio.h>
    void main()
    {clrscr();
    int a;
    while(1)
    {

    cin>>a;
    if(a!=42)
    {
    cout<<a;
    }
    else
    {
    break;
    }

    }
    }
    Remove .h from #include <iostream.h>
    also remove #include<conio.h>

    because there is no conio.h file in gcc compiler ,also remove clrscr(); function
  • PraveenKumar Purushothaman

    PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Jun 28, 2011

    Conio cannot be included here. If you want, you can use getchar() for getch().