鱼C论坛

 找回密码
 立即注册
查看: 2566|回复: 8

大家请看看哪里错了

[复制链接]
发表于 2012-2-28 12:38:16 | 显示全部楼层 |阅读模式

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

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

x
#include <stdio.h>
int main()
{
        void action1(int,int),action2(int,int);
        char ch;
        int a=15,b=23;
        ch=getchar();
        switch(ch)
        {
        case 'a':
        case 'A':action1(a,b);break;
        case 'b':
        case 'B':action2(a,b);break;
         .
         .
         .
        default:putchar('\a');
        }


}
void action1(int x,int y)
{
        printf("x+y=%d\n",x+y);

}
void action2(int x,int y)
{
        printf("x*y=%d\n",x*y);
}
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-2-28 12:58:45 | 显示全部楼层
你主要是想干嘛?
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-2-28 13:20:06 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-2-28 13:34:51 | 显示全部楼层
窘宸 发表于 2012-2-28 13:20
运行不了,显示有个错误,不知错在哪,能帮我下吗?

#include "stdafx.h"
#include <stdio.h>


int main()
{
        void action1(int,int),action2(int,int);
        char ch;
        int a=15,b=23;
        ch=getchar();
        switch(ch)
        {
        case 'a':
                {

                }
        case 'A':
                {
                        action1(a,b);
                        break;
                }
        case 'b':
                {

                }
        case 'B':
                {
                        action2(a,b);
                        break;
                }
        default:putchar('\a');
        }
        ch++;
}
void action1(int x,int y)
{
        printf("x+y=%d\n",x+y);

}
void action2(int x,int y)
{
        printf("x*y=%d\n",x*y);
}
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-2-28 13:35:23 | 显示全部楼层
狂插猛送 发表于 2012-2-28 13:34
#include "stdafx.h"
#include

看我这个

小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-2-28 14:34:47 | 显示全部楼层
#include <stdio.h>
int main()
{
        void action1(int,int),action2(int,int);
        char ch;
        int a=15,b=23;
        ch=getchar();
        switch(ch)
        {
        case 'a':
        case 'A':action1(a,b);break;
        case 'b':
        case 'B':action2(a,b);break;
         .
         .去掉着3个点就可以运行了
         .
        default:putchar('\a');
        }


}
void action1(int x,int y)
{
        printf("x+y=%d\n",x+y);

}
void action2(int x,int y)
{
        printf("x*y=%d\n",x*y);
}
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-2-28 21:10:02 | 显示全部楼层
748527736 发表于 2012-2-28 14:34
#include
int main()
{

去掉那三个点就行了,没错
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-3-6 21:24:01 | 显示全部楼层
的确,加的省略号不知是想干什么的,也不注释掉
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-3-6 21:25:07 | 显示全部楼层
另外,break最好加上,要不成死程序了,不退出
小甲鱼最新课程 -> https://ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-11-11 17:40

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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