本人新手,刚开始学编程,求大神帮忙看看这个程序编译没有错误,只是最后不输出结果
#include <iostream>using namespace std;
int main()
{
char str[100];
int i,a=0,b=0,c=0,d=0;
cout<<"input a string: ";
cin>>str;
while(str[i]!='\0');
{
if(str[i]==' ')
a++;
else if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z')
b++;
else if(str[i]>='0'&&str[i]<='9')
c++;
else
d++;
i++;
}
cout<<"the number of space is"<<a;
cout<<"the number of letter is"<<b;
cout<<"the number of figure is"<<c;
cout<<"the number of else character"<<d;
return 0;
}