急急急,本人是刚学C 语言的菜鸟,照书抄一个最简单的程序也错,我想信懂的人都会,请指点,不胜感激?

\u6211\u662f\u4e00\u4e2a\u5bf9\u7535\u8111\u4e00\u7a8d\u4e0d\u901a\u7684\u4eba,\u4ec0\u4e48\u7a0b\u5e8f\u4e86,\u8bed\u8a00\u4e86\u90fd\u4e0d\u61c2,\u4f46\u6211\u60f3\u5b66\u4e60\u7535\u8111\u544a\u8bc9\u6211\u6211\u8be5\u600e\u4e48\u5b66?\u770b\u4ec0\u4e48\u4e66?

\u4f60\u60f3\u5b66\u4e60\u7535\u8111\uff1f\u592a\u5389\u5bb3\u4e86\uff0c\u7535\u8111\u6240\u6709\u90fd\u7ed9\u4f60\u5b66\u4e86\uff01
\u7535\u8111\u6709\u786c\u4ef6\uff0c\u8f6f\u4ef6
\u786c\u4ef6\u53c8\u6709\u7f51\u7edc\uff0c\u4e3b\u673a\uff0c\u670d\u52a1\u5668\u2026\u2026
\u8f6f\u4ef6\u6709\u64cd\u4f5c\u7cfb\u7edf\uff0c\u7f16\u7a0b\uff0c\u67d0\u4e2a\u8f6f\u4ef6\u7684\u4f7f\u7528\uff08\u56fe\u5f62\u8f6f\u4ef6\uff0c\u7ba1\u7406\u8f6f\u4ef6\u2026\u2026\uff09

\u4e00\u822c\u8bf4\u60f3\u5b66\u7535\u8111\uff0c\u65e0\u975e\u5c31\u662f\u60f3\u5b66\u5b66\u6253\u5b57\uff0c\u719f\u6089\u4e00\u4e0boffice\u7684\u529e\u516c\u8f6f\u4ef6\uff0c\u4f60\u53ef\u4ee5\u4e70\u4e00\u672c\u76f8\u5173\u4e66\u7c4d\uff0c\u5982\u679c\u4f60\u60f3\u66f4\u8fdb\u4e00\u6b65\uff0c\u5728\u5b66\u597doffice\u548c\u6253\u5b57\u7684\u57fa\u7840\u4e0a\uff0c\u53bb\u5b66\u57fa\u7840\u786c\u4ef6\uff0c\u4e5f\u5c31\u662f\u7535\u8111\u914d\u7f6e\uff0c\u521d\u7ea7\u7f51\u7edc\u642d\u5efa\u3002\u8fd8\u60f3\u664b\u7ea7\uff1f\u5b66\u4e60c\u8bed\u8a00\u7f16\u7a0b\u300bc\uff0b\uff0b\u300bvb\uff0c\u8fd8\u8981\u6765\uff1f\u5b66\u4e60\u5927\u578b\u7f51\u7edc\u642d\u5efa\uff0c\u5404\u7c7b\u7f51\u7edc\u642d\u5efa\u548c\u64cd\u4f5c\u7cfb\u7edf\uff08\u4e0d\u662f\u8981\u4f60\u5b66\u4e60window xp\u600e\u4e48\u7528\u8fd9\u4e48\u7b80\u5355\uff0c\u662f\u8981\u4f60\u77e5\u9053\u64cd\u4f5c\u7cfb\u7edf\u7684\u6784\u9020\uff0c\u7ec4\u6210\uff0c\u5de5\u4f5c\u539f\u7406\u2026\u2026\uff09
\u6700\u540e\uff0c\u76d6\u8328\u90fd\u6c57\u4e86\uff0c\u5168\u4e16\u754c\u7684it\u5927\u4f01\u4e1a\u90fd\u60f3\u9ad8\u85aa\u8058\u8bf7\u4f60\u3002

\u6211\u81ea\u5b66\u5165\u95e8\u662f\u770b\u7684\u662f\u8c2d\u6d69\u5f3a\u7684\u300ajava\u8bed\u8a00\u7a0b\u5e8f\u8bbe\u8ba1\u300b\uff0c\u611f\u89c9\u4e66\u4e0d\u539a\uff0c\u4f46\u5165\u95e8\u4e0d\u9519\u3002

改动后运行结果如下:0 -17
10 -12
20 6
改动如下:(后附说明)
#include <stdio.h>
void main()
{
int fahr;
int celsius;

fahr=0;
celsius=5*(fahr-32)/9;
printf("%d\t%d\n",fahr,celsius);
fahr=10;
celsius=5*(fahr-32)/9;
printf("%d\t%d\n",fahr,celsius);
fahr=20;
celsius=5*(fahr-32)/9;
printf("%d\t%d\n",fahr,celsius);
}
1,在main()前最好加上void, 不加void的可以在tc2环境下运行,但tc3不一定能运行;
2,第二个printf括号中的%d\t前应加上”号,与后面的”配对:
3,第三个printf括号中的celsirs应改为前面定义了的celsirus.
出现这些错误主要是粗心,而学习程序设计需要的就是细心,否则一个小错误会让你辛苦几天;不过运行后应该会显示错误原因及错误所在行,在这之后还不能找出错来,那确实说明你是抄书的,但并没弄清程序运行过程. 再接再厉,程序设计虽是基础课,但还是要爱上她呀,因为她很管用的啊,譬如说我现在就靠她来挣点悬赏分啊,呵呵!

#include <stdio.h>
int main()
{
int fahr;
int celsius;

fahr=0;
celsius=5*(fahr-32)/9;
printf("%d\t%d\n",fahr,celsius);
fahr=10;
celsius=5*(fahr-32)/9;
printf("%d\t%d\n",fahr,celsius);
fahr=20;
celsius=5*(fahr-32)/9;
printf("%d\t%d\n",fahr,celsius);
}

扩展阅读:扫一扫题目出答案 ... 学人精是什么心理 ... c++和python先学哪个 ... c语言必背100代码 ... c语言培训班大概多少钱 ... 零基础自学c语言难吗 ... 零基础学c语言电子版 ... c语言入门自学网站 ... c语言新手入门代码 ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网