开发者社区> 问答> 正文

一段简单的代码编译出错?报错

在codepad中学习c语言,新手

#include <stdio.h>
/*摄氏温度与华氏温度的转换程序*/
main()
{
    int celsius, fahr;
    int lower, upper, step;


    lower = 0;/*温度表的下限*/
    upper = 30;/*温度表的上限*/
    step = 1;/*步长*/


    celsius = lower;
    while(celsius <= upper)
    {
        fahr = celsius*9 / 5 + 32;
        printf("%d\t%d\n", celsius, fahr);
        celsius = celsius + step;
    }
}

报错了,

Line 1: error: stray '\357' in program 

Line 1: error: stray '\274' in program

Line 1: error: stray '\203' in program 

Line 1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token

展开
收起
爱吃鱼的程序员 2020-06-22 17:08:53 361 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
    #include<stdio.h>/*摄氏温度与华氏温度的转换程序*/main(){intcelsius,fahr;intlower,upper,step;lower=0;/*温度表的下限*/upper=30;/*温度表的上限*/step=1;/*步长*/celsius=lower;while(celsius<=upper){fahr=celsius*9/5+32;printf("%d\t%d\n",celsius,fahr);celsius=celsius+step;}}

    #include<stdio.h>

    估计是#号的问题,在英文输入法下输入#号。

    确实如此,看来还得认真啊!
    2020-06-22 17:09:08
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
《0代码搭应用》 立即下载
不止代码 立即下载
低代码开发师(初级)实战教程 立即下载