鱼C论坛

 找回密码
 立即注册
查看: 2035|回复: 5

c语言

[复制链接]
发表于 2018-10-24 11:40:23 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#include <stdio.h>

int main()
{
        int x , y;
        scanf("%d", &x);
        if(x<1)
        {
                y = x;
        }
        else if((x==1 || x>1) && x<10 )
        {
                y = 2x-1;
        }
        if(x>=10)
        {
                y = 3x-11;
        }
        printf("Y is %d", y);
}


D:\c语言\编程文件\作业5\作业5.c(13) : error C2059: syntax error : 'bad suffix on number'
D:\c语言\编程文件\作业5\作业5.c(13) : error C2146: syntax error : missing ';' before identifier 'x'
D:\c语言\编程文件\作业5\作业5.c(13) : warning C4552: '-' : operator has no effect; expected operator with side-effect
D:\c语言\编程文件\作业5\作业5.c(17) : error C2059: syntax error : 'bad suffix on number'
D:\c语言\编程文件\作业5\作业5.c(17) : error C2146: syntax error : missing ';' before identifier 'x'
D:\c语言\编程文件\作业5\作业5.c(17) : warning C4552: '-' : operator has no effect; expected operator with side-effect
执行 cl.exe 时出错.

这个错误是什么意思啊,看了好久
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2018-10-24 11:51:11 | 显示全部楼层
#include <stdio.h>

int main()
{
        int x , y;
        scanf("%d", &x);
        if(x<1)
        {
                y = x;
        }
        else if((x==1 || x>1) && x<10 )
        {
                y = x-1; // 2x? 是2 * x 还是什么??
        }
        if(x>=10)
        {
                y = x-11;// 3x? 是3 * x 还是什么??
        }
        printf("Y is %d", y);
}
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 2 反对 0

使用道具 举报

发表于 2018-10-24 12:01:11 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-10-24 21:17:40 | 显示全部楼层

抱歉,我真的是傻了,这错误
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-10-24 21:18:20 | 显示全部楼层

谢谢谢谢,我真的是傻了,这错误都。。。。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-10-24 21:38:59 | 显示全部楼层
学c鱼 发表于 2018-10-24 21:18
谢谢谢谢,我真的是傻了,这错误都。。。。

请结贴
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-6 13:12

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表