hi! I try to grade in the following as the characters to examine a srings. So the program is to put every one at the store in a vector e occurs, then one every e E insert before .. Code: #include <iostream.h> #include <string.h> #include <vector.h> int main() { string test="dies ist der Test string"; int counter=0; //zähler der wegen der string vergrösserung gebraucht wird vector<int> V; for(int i=0;i<=test.length();i++) { if(test[i]=="e") { V.push_back(i); } } for(int j=0;j<=V.size();j++) { test.insert(V[j+counter],"E"); counter+=1; } cout << test; return 0; } but I get the run is always a serious error of .. because a white area violates why or how else I can do that?
try it this way: Code: for (int j = 0; j <= V.size () j + +) ( test.insert (V [j] + counter, "E") counter + = 1; )
would need to go there! I am an idiot! this is also evident !!!!! thank you! I'll have a test tomorrow ..
First of all, it should in clean C + + look like this Code: #include <iostream> #include <string> #include <vector> using namespace std;
:-( it's not imernoch! still the same errors. "Project Project1.exe raised exceptin class _STL:: out_of_range with message 'Exception Object Address: 0xCB32C6." HEELP!
hmm think about it you go one for (int j = 0; j <V.size();j++) statt for(int j=0;j<=V.size();j++) and to examine if (test == 'e') not to "e"