摘要: 问题来源 假设你有一个循环,把若干元素拼接到一个字符串里,每个元素之间用空格分隔: std::string result; for (auto x : elements) { result += x + " "; } 当循环结束时,result 的最后会多一个空格。 比如 elements = {" 阅读全文
posted @ 2025-09-01 21:48 Civilight~Eterna 阅读(15) 评论(0) 推荐(0)
摘要: 题目 解决 典型的字符串处理问题,关键在于非字母(空格)的处理和大小写字母的处理 头文件中有许多常用函数 代码 #include <string> #include<cctype> std::string alphabet_position(const std::string &text) { st 阅读全文
posted @ 2025-09-01 21:36 Civilight~Eterna 阅读(6) 评论(0) 推荐(0)