当前位置:网站首页>用函数统计最长单词的字母数量
用函数统计最长单词的字母数量
2022-08-09 22:18:00 【DHU杨骅麟(紫外线过敏)】
很简单的问题记录一下
经济学问题正在努力创作中 请耐心等待
#include<iostream>
using namespace std;
struct student
{
string letter;
int length=0;
};
int find_length(student arr[])
{
int max = 0;
for (int i = 0; i < 100; i++)
{
if (arr[i].length > max)
{
max = arr[i].length;
}
}
return max;
}
int main()
{
student arr[100];
cout << "接下来请输入你要输入的单词,用空格隔开,输入完毕先按回车然后按住ctrl+z再按回车" << endl;
for (int i = 0; i < 100; i++)
{
cin >> arr[i].letter;
arr[i].length = arr[i].letter.length();
}
int temp=find_length(arr);
cout << "输出最长单词的字母数:" << endl;
cout << temp << endl;
return 0;
}
边栏推荐
- Forbidden (CSRF token missing or incorrect.): /
- 全球不用交税的国家,为什么不交
- JS--hashchange事件--使用/教程
- setter与getter访问器属性——数据驱动显示
- Explore the TiDB Lightning source code to solve the found bugs
- 多线程是同时执行多个线程的吗
- 生成NC文件时,报错“未定义机床”
- Janus Official DEMO Introduction
- 联盟链技术应用的难点
- Gold Warehouse Database KingbaseGIS User Manual (6.2. Management Functions)
猜你喜欢
随机推荐
安踏携手华为运动健康共同验证冠军跑鞋 创新引领中国体育
上海一科技公司刷单被罚22万,揭露网络刷单灰色产业链
毕昇编译器优化:Lazy Code Motion
数字与中文大写数字互转(5千万亿亿亿亿以上的数字也支持转换)
34. Fabric2.2 证书目录里各文件作用
2022-08-09 mysql/stonedb-subquery performance improvement-introduction
【JZOF】82二叉树中和为某一值的路径(一)
杂谈——程序员的悲哀
Sun Zhengyi lost 150 billion: it was expensive at the beginning
正则表达式的实际使用
The 2022-8-9 sixth group of input and output streams
伦敦银行情中短线的支撑和阻力位
Qt message mechanism and events
String类常用方法
Interfering with BGP routing---community attributes
1018.值周
HUAWEI CLOUD escorts the whole process of "Wandering Ark" for the first time, creating a popular brand
Gartner's global integrated system market data tracking, hyperconverged market growth rate is the first
力扣:377. 组合总和 Ⅳ
k8s部署mysql









