我正在尝试编写一个使用conio.h头文件的g ++程序.我实际上要做的是调用gotoxy我在Borland编译器和Windows操作系统中使用的函数.
所以第一个问题是:gotoxyg ++中是否有函数或等价物?
第二:为什么我不能包括conio.h?我读了一些说我应该安装的东西libstdc++ package,我试过但似乎我已经拥有它(它伴随着gcc).
#include<stdio.h>
#include<conio.h>
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();
}
Run Code Online (Sandbox Code Playgroud)
我不知道是因为我的同学使用的是turbo c,对我来说很好,我使用的是dev c ++,但看起来像clrscr(); 请编译器帮助未知。