- Joined
- Jan 29, 2010
Hello,
I've just started to develop a game and first off i needed to make something to read the inputs and separate the Strings into 3 Different parts, Each
I've currently got the code I've been working on for a while, but I've hit a problem, Can one you your skilled eyes see it? I'm only new at this and I've probably taken the longest path possible.
I've just started to develop a game and first off i needed to make something to read the inputs and separate the Strings into 3 Different parts, Each
I've currently got the code I've been working on for a while, but I've hit a problem, Can one you your skilled eyes see it? I'm only new at this and I've probably taken the longest path possible.
Code:
int main ()
{
// initilize Strings
string C1;
string C2;
string C3;
std::string Input;
string Excract;
int StringLength;
// Get input
getline(cin, Input, '\n');
StringLength = Input.length();
// Dessembel
string Data[2][20];
int Current(0);
int CurrentC(0);
for(Current; Current <= StringLength;Current++){
Data[0][Current] = Input.substr(Current, Current);
std::string ifstat = Input.substr(Current,Current);
if(ifstat == " "){
Data[CurrentC][Current] = "";
CurrentC++;
}
Current++;
};
// Assembel
int X(0);
int Y(0);
for(X; X <= 2; X++){
for(Y; Y <= 20; Y++){
int CurLetter(0);
string k;
k = Data[X][Y];
Excract.insert(CurLetter, k);
CurLetter++;
}
if(X = 0){C1 = Excract;};
if(X = 1){C2 = Excract;};
if(X = 2){C3 = Excract;};
Excract = "";
}
// Check
int t(0);
cout << "\n" << "Comment 1: "<< C1 << "\n";
cout << "Comment 2: "<< C2 << "\n";
cout << "Comment 3: "<< C3 << "\n";
cout << "Input: " << Input << "\n";
cout << Excract << "\n";
cout << "Array Check";
for(int g(0); g <= 20; g++){
for(int h(0); h <= 2; h++){
cout << Data[g][h] << "\t";
}
cout << "\n";
}
cin >> t;
}
/*
Check string chariters 1 by one Pulling them out in order till it hits a Space,
once at a space Go to Next Command control and Continue without spaces.
String length
Use Extract going up by one number Each time 1,2 2,3 4,5 till it hits the string.length and stopping
if Excratction Hit's a space, Skip and Move Valuble.
String unbacked into a array then reassebled.
*/