6.3w+
社区成员
#include <iostream>
#include <string>
using namespace std;
int main ()
{
//char a[100];
string a;
int i=0;
int C=0,c=0,n=0,o=0;
bool condition = true;
/*while(condition)
{
if((a[i]=getchar())=='\n') //只能读入字符...
{
condition = false;
}
i++;
}*/
getline(cin,a);
for(int j=0;a[j] !='\0';j++) //j->a[j]这里要判断的是字符串中的a[i]是否'\0'
{
if(a[j] <=90 && a[j]>=65)
{
C++;
}
else if(a[j] <=122 && a[j]>=97)
{
c++;
}
else if(a[j] <=57 && a[j]>=48)
{
n++;
}
else
o++;
}
cout <<"there are " <<C <<" Capitals" <<endl;
cout <<"there are " <<c <<" small letters" <<endl;
cout <<"there are " <<n <<" numbers" <<endl;
cout <<"there are " <<o <<" others" <<endl;
return 0;
}
#include <iostream>
using namespace std;
int main ()
{
char a[100];
int i=0;
int C=0,c=0,n=0,o=0;
bool condition = true;
while(condition)
{
if((a[i]=getchar())=='\n') //这里有问题
{
condition = false;
}
i++;
}
for(int j=0;a[j]!='\n';j++) //条件
{
if(a[j] <=90 && a[j]>=65)
{
C++;
}
else if(a[j] <=122 && a[j]>=97)
{
c++;
}
else if(a[j] <=57 && a[j]>=48)
{
n++;
}
else
o++;
}
cout <<"there are " <<C <<" Capitals" <<endl;
cout <<"there are " <<c <<" small letters" <<endl;
cout <<"there are " <<n <<" numbers" <<endl;
cout <<"there are " <<o <<" others" <<endl;
return 0;
}
#include <iostream>
using namespace std;
int main ()
{
char a[100];
int i=0;
int C=0,c=0,n=0,o=0;
bool condition = true;
while(condition)
{
if((a[i]=getchar())=='\n') //这里有问题
{
condition = false;
}
i++;
}
for(int j=0;a[j]!='\n';j++) //条件
{
if(a[j] <=90 && a[j]>=65)
{
C++;
}
else if(a[j] <=122 && a[j]>=97)
{
c++;
}
else if(a[j] <=57 && a[j]>=48)
{
n++;
}
else
o++;
}
cout <<"there are " <<C <<" Capitals" <<endl;
cout <<"there are " <<c <<" small letters" <<endl;
cout <<"there are " <<n <<" numbers" <<endl;
cout <<"there are " <<o <<" others" <<endl;
return 0;
}
#include <iostream>
using namespace std;
int main ()
{
char a[100];
int i=0;
int C=0,c=0,n=0,o=0;
bool condition = true;
while(condition)
{
if((a[i]=getchar())=='\n') //这里有问题
{
condition = false;
}
i++;
}
for(int j=0;a[j]!='\n';j++) //条件
{
if(a[j] <=90 && a[j]>=65)
{
C++;
}
else if(a[j] <=122 && a[j]>=97)
{
c++;
}
else if(a[j] <=57 && a[j]>=48)
{
n++;
}
else
o++;
}
cout <<"there are " <<C <<" Capitals" <<endl;
cout <<"there are " <<c <<" small letters" <<endl;
cout <<"there are " <<n <<" numbers" <<endl;
cout <<"there are " <<o <<" others" <<endl;
return 0;
}