扫码关注官方订阅号
c/c++ 创建元素个数为500的字符串数组 读了500个长度不超过40的字符串,再输出,大家都是怎么写的?(我知道这个问题很low)
闭关修行中......
#include <string> #include <iostream> using namespace std; int main() { string xs[500]; for (auto& x : xs) { cin >> x; if (x.size() > 40) /*do something to crash*/; } for (const auto& x : xs) { cout << x << endl; } }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
闭关修行中......