字符串

来源:互联网 发布:新店淘宝客推广 编辑:程序博客网 时间:2024/06/03 18:23
#include <iostream>#include <cstdio>using namespace std;int main(){   char str[50];   int i=0,n=0,m=0;   cout<<"输入字符串:";   gets(str);   while (str[i]!='\0')   {       if (str[i]>'A'&&str[i]<'Z')        n++;       else if(str[i]>'a'&&str[i]<'z')       m++;       i++;   }   cout<<"其中大写字母出现的次数为"<<n<<endl;   cout<<"其中小写字母出现的次数为"<<m<<endl;   return 0;}

0 0