2024-8-28作业C++/QT

代码:

#include <iostream>

#include <cstring>

#include <array>

#include <iomanip>

using namespace std;

int main()

{

//array<char,128> a;

//array<char,128>::iterator iter;

string str;

getline(cin,str);

int cl=0,ll=0,figure=0,blank=0,other=0;//依次是大写、小写字母、数字个数、空格个数

cout << "请输入字符串!" << endl;

/*for(iter = a.begin(); iter != a.end(); iter++)

{

cin >> *iter;

}*/

//int num=str.size();

for(int i=0;i<(int)str.size();i++)

{

if(stri >= 65 && stri <= 90)

{

cl++;

}

else if(stri>=97 && stri<=122)

{

ll++;

}

else if(stri>=48 && stri<=57)

{

figure++;

}

else if(stri==32)

{

blank++;

}

else

{

other++;

}

}

cout << "cl=" << cl <<endl;

cout << "ll=" << ll <<endl;

cout << "figure=" << figure <<endl;

cout << "blank=" << blank <<endl;

cout << "other=" << other <<endl;

return 0;

}

相关推荐
BUG研究员_12 小时前
Runnable与LCEL
开发语言·人工智能·python
果果燕14 小时前
实习笔记(一):NFS、Samba、VNC、Git、CMake、systemd、内核、交叉编译
linux·arm开发·c++·笔记·git
牛艺翔14 小时前
C++基础
开发语言·c++
键盘会跳舞14 小时前
C++ :容器适配器stack源码级拆解
开发语言·c++··stack·先进后出
美味蛋炒饭.14 小时前
Git 版本控制(下)
开发语言·git·学习·总结·后端开发
我星期八休息15 小时前
网络编程—网络层
开发语言·前端·网络·人工智能·智能路由器
不负岁月无痕15 小时前
简单理解操作系统结构
java·linux·c语言·开发语言·c++·面试
余额瞒着我当琳15 小时前
C++模板初阶与STL初探
android·java·c++
SomeB1oody15 小时前
【RustyML入门】2.9. MeanShift
开发语言·后端·机器学习·rust·教程
萧瑟其中~15 小时前
多线程锁详解:互斥锁·自旋锁·读写锁(CAS + futex 原理)
开发语言·c++