【发布时间】:2016-10-01 19:36:13
【问题描述】:
尝试将字符串中的一些逗号分隔值相加。我觉得我需要删除逗号。这是字符串流的情况吗?
string str = "4, 3, 2"
//Get individual numbers
//Add them together
//output the sum. Prints 9
【问题讨论】:
-
你是对的。一种解决方案是 std::istringstream 与 std::getline
-
欢迎来到 Stack Overflow。你试过什么?
标签: c++ csv stringstream atoi