为什么“输入操作员:”这个概念出现了两次?

时间:2018-02-06 04:13:31

标签: c

    int main() {
        // insert code here...
        char ch; //the operator
        int c, t, h ; //the weight of the three items
        int flag = 1; //note for iteration ending


        while (flag == 1) { 
            printf("input operator:");
            ch = getchar();
            switch (ch) {
                case 'a':
                    printf("input the weight of chaoxianji:");
                    scanf("%d", &c);
                    break;
                case 'b':
                    printf("input the weight of tiancai:");
                    scanf("%d", &t);
                    break;
                case 'c':
                    printf("input the weight of huluobo:");
                    scanf("%d", &h);
                    break;
                case 'q':
                    flag = 0; // get out of cycle 
                    break;
                }
            }
        return 0;

}

但输出块是: The notion appears twice 我想知道为什么注释“输入操作符出现两次。 'break'应该把程序带到printf语句,不应该吗?

0 个答案:

没有答案