work 1/24

#include 
#include 
#include 
#include 
using namespace std;

int main()
{
//  string num1;
//  getline(cin,num1);

  array num;
  array::iterator iter;
//  strcpy(num,num1.c_str());
  for(iter=num.begin();iter!=num.end();iter++)
  {
      cin >> *iter;
      //getline()
  }

  int biglitter=0,samlllitter=0,nums=0,speaces=0,others=0;
  for(iter=num.begin();iter='A' && *iter<='Z')
      {
        biglitter++;
      }
      else if(*iter>='a' && *iter<='z'){
         samlllitter++;
      }
      else if (*iter>'0' && *iter<'9') {
          nums++;
      }
      else if (*iter==' ') {
          speaces++;
      }
      else{
          others++;
      }
  }
  cout << "大写个数" << biglitter << endl;
  cout << "小写个数" << samlllitter << endl;
  cout << "数字个数" << nums << endl;
  cout << "空格个数" << speaces << endl;
  cout << "其他个数" << others << endl;
    return 0;
}

work 1/24_第1张图片

你可能感兴趣的:(c++,算法,开发语言)