“未完成对clrscr()的启示;”

#include #include void main() { int i=1,a,b,c,choice; do { printf("enter any two numbers\n"); scanf("%d%d",&a,&b); printf("pressing one add the two numbers\nenter one if you want to\n"); scanf("%d",&choice); switch(choice) { case 1: { c=a+b; printf("the sum of the entered numbers%.1f\n\n:",c); break; } default: printf("you have entered an invalid"); break; } clrscr(); } while(i==1); getch(); } 

我不知道因为我的同学正在使用turbo c而且没关系,对我来说我使用的是dev c ++,但看起来像clrscr(); 编译器帮助不知道。

你的同学在DOS下编程,很明显你没有… conio.h自带Turbo C和DOS ……所以,删除这些行

 #include 

 clrscr(); 

 getch(); 

让你的程序编译…

…并且不要使用%.1f来打印int。

…而main()必须返回int

*并且不要从同学那里复制……他似乎陷入了石器时代*

来自维基 :

conio.h是一个C头文件,主要由MS-DOS编译器使用,以提供控制台输入/输出。 1它不是C标准库的一部分,ISO C也不是由POSIX定义的

会员职能

 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. 

1989年以后提供的编译器在名称前加上_,以符合ANSI C标准的要求。

conio.h不是C标准的一部分。 它是Borland扩展,仅适用于Borland编译器(也许还有其他一些商业编译器)。 Dev-C ++使用GCC,即GNU Compiler Collection,作为它的编译器。 GCC最初是一个UNIX编译器,旨在实现可移植性和标准兼容性。

你可以在Dev C ++中使用Borland函数:在你的源代码中包含conio.h,并在项目选项中将C:\ Dev-C ++ \ Lib \ conio.o添加到“链接器选项”(其中C:\ Dev-C ++是你安装Dev-C ++的地方)。