热门

最新

红包

立Flag

投票

同城

我的

发布
y632481222
送涂图
3 年前
truey632481222

stringstream和getline配合使用\nstd::vector\u003Cstd::string> stringSplit(const std::string& str, char delim) {\n std::stringstream ss(str);\n std::string item;\n std::vector\u003Cstd::string> elems;\n while (std::getline(ss, item, delim)) {\n if (!item.empty()) {\n elems.push_back(item);\n }\n }\n return elems;\n}

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
#region for 循环; //实例8 使用for循环挑战数学家高斯; int iSum = 0; // 记录每次累加后的结果 ; 水桶变量; for (int iNum = 1; iNum <=100; iNum=iNum+1) { iSum += iNum;//把每次的iNum的值累加到上次累加的结果中 } System.Console.WriteLine("1到100的累加结果是:" +iSum);//输出结果 System.Console.ReadLine(); #endregion
立即登录