各位大佬,请帮忙看一下,为什么输出总为0
#include <stdio.h>
int main()
{
int num,num0=0,num1=0,num2=0,num3=0,num4=0,num5=0;
char operation=0;
printf("Please think of a number less than 50 in your mind!\n");
printf("Then I will give you a set of cards, please note that if your numbers are in those cards\n");
printf("I will figure out the number a piece of cake after that\n");
printf("okay, let us try!\n");
printf("Enter 'q' to end input\n");
printf("You can input like that 0#卡片 or 2#卡片 :\n");
while(1)
{
scanf("%c",&operation);
if(operation == '0#卡片')
{
num0=1;
continue;
}
if(operation == '1#卡片')
{
num1=2;
}
if(operation == '2#卡片')
{
num2=4;
}
if(operation == '3#卡片')
{
num3=8;
}
if(operation == '4#卡片')
{
num4=16;
}
if(operation == '5#卡片')
{
num5=32;
}
if(operation == 'q')
{
num = num0+num1+num2+num3+num4+num5;
break;
}
}
printf("%d",num);
return 0;
}
这个输出为什么总是0啊?
int main()
{
int num,num0=0,num1=0,num2=0,num3=0,num4=0,num5=0;
char operation=0;
printf("Please think of a number less than 50 in your mind!\n");
printf("Then I will give you a set of cards, please note that if your numbers are in those cards\n");
printf("I will figure out the number a piece of cake after that\n");
printf("okay, let us try!\n");
printf("Enter 'q' to end input\n");
printf("You can input like that 0#卡片 or 2#卡片 :\n");
while(1)
{
scanf("%c",&operation);
if(operation == '0#卡片')
{
num0=1;
continue;
}
if(operation == '1#卡片')
{
num1=2;
}
if(operation == '2#卡片')
{
num2=4;
}
if(operation == '3#卡片')
{
num3=8;
}
if(operation == '4#卡片')
{
num4=16;
}
if(operation == '5#卡片')
{
num5=32;
}
if(operation == 'q')
{
num = num0+num1+num2+num3+num4+num5;
break;
}
}
printf("%d",num);
return 0;
}
这个输出为什么总是0啊?
...全文


