dev-c++编程下面一个程序无法运行 是什么原因?

/* rhodium.c
#include<stdio.h>
int main (void)
{
float weight;
float value;
printf("Are you worth your weight in rhodium?\n");
printf("let's check it out.\n");
printf("Please enter your weight in pounds:");
scanf("%f",&weight);
value =770*weight*14.5833;
printf("your weight in rhodium is worth $%.2f.\n".valuc);
printg("you are easily worth that! If rhodium prices drop,\n");
printf("eat more to maintain your value.\n";
return 0;
}
--------------------配置: mingw5 - LIB Release, 编译器类型: MinGW--------------------

检查文件依赖性...
正在编译 C:\Users\Wox\Documents\C-Free\Temp\未命名1.cpp...
[Error] C:\Users\Wox\Documents\C-Free\Temp\未命名1.cpp:1:1: unterminated comment
[Warning] C:\Users\Wox\Documents\C-Free\Temp\未命名1.cpp:16:7: warning: no newline at end of file

构建中止 未命名1: 1 个错误, 1 个警告

这代码好几处错误当然不能运行。
倒数第三个输出语句的 value 打成了 value。而且前面应该是逗号,不是句点。
倒数第二个printf打成了printg
最后一个printf结尾没有右括号)。追问

还是不行 啊

追答

//我反正是能运行的。

#include
int main (void)
{
float weight;
float value;
printf("Are you worth your weight in rhodium?\n");
printf("let's check it out.\n");
printf("Please enter your weight in pounds:");
scanf("%f",&weight);
value =770*weight*14.5833;
printf("your weight in rhodium is worth $%.2f.\n",value);
printf("you are easily worth that! If rhodium prices drop,\n");
printf("eat more to maintain your value.\n");
return 0;
}

追问

为什么编译了之后下面那几行无编译出来 是什么原因
value =770*weight*14.5833;
printf("your weight in rhodium is worth $%.2f.\n",value);
printf("you are easily worth that! If rhodium prices drop,\n");
printf("eat more to maintain your value.\n");

追答

没编译出来是什么意思?只要编译完成自然是全部编译了,除非设了条件编译。

难不成你是说为什么下面三行没有输出?因为上面scanf要求你输入数字啊,输入数字然后回车,后三行自然出来了。

追问

恩 下面那几行没有输出 请问在哪输入数字

追答

!难道你运行这程序的时候不是生成控制台窗口?这是个什么开发环境啊……前面几句是在哪里输出的?不就在那里输入么?

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答