#统计三段80个字符的短句数字,字母,字符的个数
#include
#include
using namespace std;
int main()
{
char wz[3][80];
int i,j,daxie=0,xiaoxie=0,shuzi=0,kongge=0,zifu=0,fuhao=0;
for (i=0;i
for (j=0;i
cin >> wz[i][j];
for (i=0;i
for (j=0;i
{
if ((strcmp(wz[i][j],'A')>=0) && (strcmp(wz[i][j],'Z')<=0)
daxie = 1+daxie;
if ((strcmp(wz[i][j],' ')=0)
kongge = 1+kongge;
if ((strcmp(wz[i][j],'a')>=0) && (strcmp(wz[i][j],'z')<=0)
xiaoxie = 1+xiaoxie;
if ((strcmp(wz[i][j],'1')>=0) && (strcmp(wz[i][j],'9')<=0)
shuzi = 1+shuzi;
else
fuhao = 1+fuhao;
}
cout<<"shuzi"<<shuzi<<endl<<"zifu"<<zifu;
cout<<"daxie"<<daxie<<endl<<"xiaoxie"<<xiaoxie;
cout<<"kongge"<<kongge;
return 0;
报错提示
Compiling...
统计字符.cpp
C:\Users\24636\Desktop\vc\统计字符.cpp(14) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Users\24636\Desktop\vc\统计字符.cpp(14) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Users\24636\Desktop\vc\统计字符.cpp(15) : error C2146: syntax error : missing ')' before identifier 'daxie'
C:\Users\24636\Desktop\vc\统计字符.cpp(16) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Users\24636\Desktop\vc\统计字符.cpp(17) : error C2146: syntax error : missing ')' before identifier 'kongge'
C:\Users\24636\Desktop\vc\统计字符.cpp(18) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Users\24636\Desktop\vc\统计字符.cpp(18) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Users\24636\Desktop\vc\统计字符.cpp(19) : error C2146: syntax error : missing ')' before identifier 'xiaoxie'
C:\Users\24636\Desktop\vc\统计字符.cpp(20) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Users\24636\Desktop\vc\统计字符.cpp(20) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Users\24636\Desktop\vc\统计字符.cpp(21) : error C2146: syntax error : missing ')' before identifier 'shuzi'
执行 cl.exe 时出错.
统计字符.obj - 1 error(s), 0 warning(s)