Home > Back-end >  C, the string with the vector transformation
C, the string with the vector transformation

Time:09-25

Enter a string (sum=a + 10) To output a vector
The sum
=
A
+
10
;

#include
#include
#include
#include

using namespace std;

//Accepts a stream and returns a vector of tokens with any remaining preprocessing directives stripped out
//Input: a stream
//the Output: a vector of tokens
Vector TokenizeCodeStrip (istream& Code) {
//the Fill in implementation - this is a start for the implementation the from May 26 Tutorial.
Vector result;
The string line;
Getline (code, line);
Unsigned long long index2=0;
While (true) {//need to terminate the loop - consider been an index is a string: : npos
Auto index1=line. Find_first_not_of (" ", index2);
Index2=line. Find_first_of (" ", index1);
Auto subs=line. Substr (index1 index2 - index1);
Result. The push_back (subs);
}
return result;
}
How should fill out
middle

CodePudding user response:

"Suma10
""=+;"
Additional loop condition itself is wrong,