在C语言中将输入的数字翻译为汉语中的数字
#include <stdio.h>#include <string.h>
char map[] = { "零" , "一" , "二" , "三" , "四" , "五" , "六" , "七" , "八" ,"九","正" , "负"."点"};
char Search( char c ) //找到字母表示法所对应的数字
{int i;
for(i = 0 ; i <= 13 ; i++ )
{ if( strcmp( c, map[i] ) == 0 )
return map[i];
}
}
int main()
{ char s,c;
while( scanf( "%s" , s ) && strcmp( s , "+" ) != '\n')
{ c=search(s);
printf("%c",&c);
}
return 1;
}
在VC6.0中有错误 ers\dell\Desktop\.c(3) : error C2078: too many initializers
C:\Users\dell\Desktop\.c(3) : error C2018: unknown character '0xa3'
C:\Users\dell\Desktop\.c(3) : error C2018: unknown character '0xac'
C:\Users\dell\Desktop\.c(3) : error C2059: syntax error : 'string'
C:\Users\dell\Desktop\.c(8) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'char '
C:\Users\dell\Desktop\.c(8) : warning C4024: 'strcmp' : different types for formal and actual parameter 1
C:\Users\dell\Desktop\.c(8) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'char '
C:\Users\dell\Desktop\.c(8) : warning C4024: 'strcmp' : different types for formal and actual parameter 2
C:\Users\dell\Desktop\.c(14) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'char '
C:\Users\dell\Desktop\.c(14) : warning C4024: 'strcmp' : different types for formal and actual parameter 1
C:\Users\dell\Desktop\.c(15) : warning C4013: 'search' undefined; assuming extern returning int
执行 cl.exe 时出错.
求解释。。。