輸入一個string(sum=a+10;), 輸出一個vector
sum
=
a
+
10
;
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
using namespace std;
// Accepts a stream and returns a vector of tokens with any remaining preprocessing directives stripped out
// Input: a stream
// Output: a vector of tokens
vector<string> tokenizeCodeStrip(istream& code) {
// Fill in implementation -- this is a start for the implementation from May 26 Tutorial.
vector<string> result;
string line;
getline (code, line);
unsigned long long index2 = 0;
while(true) { // need to terminate the loop -- consider whether an index is string::npos
auto index1 = line.find_first_not_of(" ", index2);
index2 = line.find_first_of(" ", index1);
auto subs = line.substr(index1, index2 - index1);
result.push_back(subs);
}
return result;
}
中間應該怎么填寫
uj5u.com熱心網友回復:
“suma10”"=+;"
另外回圈條件本身是錯誤的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/77394.html
標籤:基礎類
上一篇:有沒有大神能夠幫幫我這個小新手
下一篇:求助關于MFC的相關問題
