"UNDEFINED REFRENCE TO clrscr();" [duplicate]

Solution 1:

Your classmate is programming under DOS, obviously you don't ... conio.h comes with Turbo C and DOS ... So, remove the lines

#include<conio.h>

and

clrscr();

and

getch();

to make your program compile ...

... and do not use %.1f to print an int.

... and main() must return int

* and do not copy from your classmate ... he seems to be stuck in the stone age*

Solution 2:

From Wiki:

conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output.1 It is not part of the C standard library, ISO C nor is it defined by POSIX

Member functions

kbhit - Determines if a keyboard key was pressed.
getch - Reads a character directly from the console without buffer, and without echo.
getche - Reads a character directly from the console without buffer, but with echo.
ungetch - Puts the character c back into the keyboard buffers.
cgets - Reads a string directly from the console.
cscanf - Reads formatted values directly from the console.
putch - Writes a character directly to the console.
cputs - Writes a string directly to the console.
cprintf - Formats values and writes them directly to the console.
clrscr - Clears the screen.

Compilers provided later than 1989 have prepended an _ to the names, to comply with the requisites of the ANSI C Standard.

conio.h is not part of the C standard. It is a Borland extension, and works only with Borland compilers (and perhaps some other commercial compilers). Dev-C++ uses GCC, the GNU Compiler Collection, as it's compiler. GCC is originally a UNIX compiler, and aims for portability and standards-compliance.

You can use Borland functions this way in Dev C++: Include conio.h to your source, and add C:\Dev-C++\Lib\conio.o to "Linker Options" in Project Options (where C:\Dev-C++ is where you installed Dev-C++).