024
12.01.2005, 22:07 Uhr
CaesarCortezz
minderer Student
|
so hab ich das ja... es funzt aber net. ich poste mal den quelltext...
C++: |
#include <iostream> #include <string> #include <vector> #include <iterator> using namespace std;
vector<string> seperate_words(string sep_string, char sep) { vector<string> rv; size_t a,b; for(a=b=0;string::npos!=(b=sep_string.find(' ',b));a=++b) rv.push_back(sep_string.substr(a,b-a)); if(a-b) rv.push_back(sep_string.substr(a,sep_string.size())); return rv; }
int interpret() { string temp; vector<string> v; cout << ">"; getline(cin, temp); cout << temp << endl; v=seperate_words(temp,' '); string com = v[0]; string param; for(int i=1;i<v.size();++i) { param=param+v[i]+" "; } cout << endl; cout << com << "\t" << param << endl; return 0; } main() { interpret(); return 0; }
|
-- Thus spake the master programmer:
``When the program is being tested, it is too late to make design changes.'' |