C语言:输入一组数,统计其中奇数和偶数的个数,知道遇到回车为止.怎样写啊,1楼的不行,2楼的有4个错误:--------------------Configuration:6(3) - Win32 Debug--------------------Compiling...6(3).cC:\Documents and Setti

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/14 00:36:53
C语言:输入一组数,统计其中奇数和偶数的个数,知道遇到回车为止.怎样写啊,1楼的不行,2楼的有4个错误:--------------------Configuration:6(3) - Win32 Debug--------------------Compiling...6(3).cC:\Documents and Setti
xUmoP+-Z 2`s^3~KS \[_wn ܋32u_6_m' Q"J99siG3N}9tNWLQٵikcЮ:{dQ)5y2uDoFs-6VSsd#yUz[g֫c2AVċYr0;Y[ Qj߄(eiXE*p$ nX6;&A)<ϻ2!J74%4Up &¿!S !<S=) Nu502L钵onX/2HE&шh<¦0FAn1t8QrŒv`Eq@b*)Y*@*͈P&S+|():y 0:0*dG%@FY?;oi; ǟÂ[i*9OH+\1-j5kz٤TH`:|F5w\J.-i܊Keil'DI%om$&rrHЮۻ 9;e|+GXIeU6AZFw_CxF%)@I=p6C|Z]= uڞZJpduVI9"Or2:uqoc#H7w][w/E Kfjg$EL@%k<~D)SccZFg s{ S޳1.]$C3J&Y[#o[uWga݀c"ᾠ'ķZͬ2&)ku㿳E {A0fn'KAS:bPZA6[U{ߴ?ƈ]ÿ--`dd<[Mb

C语言:输入一组数,统计其中奇数和偶数的个数,知道遇到回车为止.怎样写啊,1楼的不行,2楼的有4个错误:--------------------Configuration:6(3) - Win32 Debug--------------------Compiling...6(3).cC:\Documents and Setti
C语言:输入一组数,统计其中奇数和偶数的个数,知道遇到回车为止.怎样写啊,
1楼的不行,2楼的有4个错误:--------------------Configuration:6(3) - Win32 Debug--------------------
Compiling...
6(3).c
C:\Documents and Settings\Administrator\桌面\6(3).c(353) :error C2143:syntax error :missing ';' before 'type'
C:\Documents and Settings\Administrator\桌面\6(3).c(354) :error C2065:'i' :undeclared identifier
C:\Documents and Settings\Administrator\桌面\6(3).c(358) :error C2065:'a' :undeclared identifier
C:\Documents and Settings\Administrator\桌面\6(3).c(362) :error C2065:'b' :undeclared identifier
Error executing cl.exe.
6(3).obj - 4 error(s),0 warning(s)

C语言:输入一组数,统计其中奇数和偶数的个数,知道遇到回车为止.怎样写啊,1楼的不行,2楼的有4个错误:--------------------Configuration:6(3) - Win32 Debug--------------------Compiling...6(3).cC:\Documents and Setti
/***以下我觉得自己算写得比较好的了.你可以输入任意多个字符,而且有非数字字符等各种错误输入也不会影响统计.希望对你有所帮助.**/
/***
** 输入一组数,统计奇数和偶数的个数.
**/
#include
int main(void){
char ch;
int num;
int even_num = 0;//纪录偶数个数
int old_num = 0;//奇数个数.
int other = 0;//其它字符个数
printf("请输入一组数字(回车则表示结束!):\n\t");
do{
do{
ch = getchar();
}while(ch==' ');
if(ch=='\n')break;
else if(ch>='0'&&ch0){
printf("\t同时以上输入了:%2d个非数字字符\n",other);
}
return 0;
}///main:
/***以下为输入输出结果示列:
请输入一组数字(回车则表示结束!):
1 2 3 # 4 5 6
以上输入的数中,奇数有:3 个,偶数有:3 个
同时以上输入了:1个非数字字符
----------------------------------------
请输入一组数字(回车则表示结束!):
1 2 3 4 5 6 7 8
以上输入的数中,奇数有:4 个,偶数有:4 个
**/