| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 439 人关注过本帖
标题:求大家帮忙找找错
取消只看楼主 加入收藏
li362490567
Rank: 1
等 级:新手上路
帖 子:89
专家分:8
注 册:2015-7-9
结帖率:0
收藏
 问题点数:0 回复次数:4 
求大家帮忙找找错
#include<stdio.h>
#define COST1 1.25f
#define COST2 0.65f
#define COST3 0.89f
#define LIMIT 100.0f
#define DISCOUNT 0.05f
#define TRASPT1 3.50f
#define TRASPT2 10.00f
#define TRASPT3 8.0f
#define TRASPT4 0.1f
#define LIMIT1 5.0f
#define LIMIT2 20.0f
int main(void)
{
begaining: float a, b, c;
    float d, e, f; float g, h;
    a = 0; b = 0; c = 0;
    int i;
    char ch;

    //输入
    one:while ((ch = getchar()) != 'q')
    {
        switch (ch)
        {
        case'a':
            scanf_s("%f", &a);
            break;
        case'b':
            scanf_s("%f", &b);
            break;
        case'c':
            scanf_s("%f", &c);
            break;
        default:
            printf("Please input a b c to input or q to quit\n");
            goto one;
            break;

        }
    }
        if (ch == 'q')            
            return 0;
        if ((a == 0 )&(b == 0) &( c == 0))
            return 0;

    //计算
    d = a + b + c;
    if (d <= LIMIT1)
        g = TRASPT1;
    else if (d <= LIMIT2)
        g = TRASPT2;
    else
        g = TRASPT3 + (d-20)*TRASPT4;
    e = a*COST1 + b*COST2 + c*COST3;
    if (e >= LIMIT)
        h = e*(1 - DISCOUNT) + c;
    else
        h = e + c;
    f = DISCOUNT*100;
    //输出


    printf("You ordered %.2f a %.2f b and %.2f\n ", a, b, c);
    printf("Your order sumed is %.2f\n", d);
    if (a != 0)
        printf("A is %.2f dollar/pound ",COST1);
    if (b != 0)
        printf("B is %.2f dollar/pound ", COST2);
    if (c != 0)
        printf("C is %.2f dollar/pound ", COST3);
    printf("The sum is %f\n", e);
    if (e >= LIMIT)
        printf("The discount is %.2f%%\n", f);
    printf("The transportation is %.2f\n", g);
    printf("The final cost is %.2f\n", h);
    printf("Do your want to order more? 1 is yes 0 is no \n");
    scanf_s("%d", &i);
    start:switch (i)
    {
    case 1:
        goto begaining;
        break;
    case 0:
        break;
    default:
        printf("Please input 1 or 0,others are errors");
        goto start;
    }
    return 0;
}

错误提示:缺少“;”(在“类型”的前面)  我怎么找也没找到哪缺';',到底哪错了?
搜索更多相关主题的帖子: include 
2015-08-04 16:01
li362490567
Rank: 1
等 级:新手上路
帖 子:89
专家分:8
注 册:2015-7-9
收藏
得分:0 
我编译器用的VS 2013
2015-08-04 16:13
li362490567
Rank: 1
等 级:新手上路
帖 子:89
专家分:8
注 册:2015-7-9
收藏
得分:0 
回复 4楼 wp231957
..什么情况,你能帮我找找原因么?我看了好几遍,也没找到。谢谢了
2015-08-04 16:21
li362490567
Rank: 1
等 级:新手上路
帖 子:89
专家分:8
注 册:2015-7-9
收藏
得分:0 
1>------ 已启动生成:  项目: ConsoleApplication1, 配置: Debug Win32 ------
1>  first.c
1>d:\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\first.c(15): error C2143: 语法错误 : 缺少“;”(在“类型”的前面)
========== 生成:  成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
2015-08-04 16:29
li362490567
Rank: 1
等 级:新手上路
帖 子:89
专家分:8
注 册:2015-7-9
收藏
得分:0 
回复 6楼 wp231957
1>------ 已启动生成:  项目: ConsoleApplication1, 配置: Debug Win32 ------
1>  first.c
1>d:\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\first.c(15): error C2143: 语法错误 : 缺少“;”(在“类型”的前面)
========== 生成:  成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
2015-08-04 16:29
快速回复:求大家帮忙找找错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.050626 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved