帮我看看这个C语言程序哪里错了????为什么 我的不到想要的结果呢??

2025-06-21 22:21:56
推荐回答(5个)
回答1:

运行没错啊,你是用的什么编译器
Input the diameter of the table:在这个之后输入数字啊,然后回车

回答2:

我运行了没错啊
还有你这句话 到scanf前能翻译出后面就不显示了呢????
谁能看懂?

回答3:

有些IDE在程序结束之后会自动退回到程序编辑界面,你需要进入相应的界面才能够查看运行结果,比如TC里,你需要进入DOS界面看结果(我记得快捷键好像是ALT+F5)。

回答4:

在程序之后加句
getch() 记得好象是这个吧
反正就是等待接收一个字符输入
试试

回答5:

#include

int main(void)
{
float radius=0;
float diameter=6;
float circumference=0;
float area=0;
float pi=3.1415926;

printf("Input the diameter of the table: ");
scanf("%f",&diameter);

radius=diameter/2;
circumference=2*radius*pi;
area=pi*radius*radius;
printf("\nThe circumference is %.2f",circumference);
printf("\nThe area is %.2f\n",area);

getch();

return 0;
}

LZ在程序的最后加一个getch()试试。。