帮我看看着程序那里错了

来源:百度知道 编辑:UC知道 时间:2024/05/27 16:01:06
#include <stdio.h>

void main()
{
char pp;

printf("\n 请输入性别的第一个英文字母:");
scanf("%c",&pp);
switch(pp)
{
case 'm':
printf("\n 男的");
break;
case 'w':
printf("\n 女的");

}
}

你的代码在我这不但能比编译而且能执行,编译器没报任何错误,连个警告都没有。不过你的switch结构却少对输入错误的处理。比如用户误输了个‘n’呢。

char没处初始化