error C2059: syntax error : 'switch'

来源:百度知道 编辑:UC知道 时间:2024/05/15 18:07:55
#include "stdio.h"
switch (c=getchar())
{
case'+': printf("plus\t");break;
case'-' printf("minus\t";break;
}
不知道哪里错了
什么哇这个是switch啊

1. 没有main函数, c也没有定义
2. case'-'后面要有冒号的

应该是有个空格才对。空格冒号一个都不能少。
case空格'+':....

我想楼主应该简写了把?呵呵。

一楼得分