Im trying to do something if command[j]==' however the below code doesnt work
if(''' == command[j])
Im trying to do something if command[j]==' however the below code doesnt work
if(''' == command[j])
AIM: MarderIII
lose the quotes:
That what u mean?Code:if (something == command[j]) { ... }
uh i dunno everything else ive been doing has been like this:
Code:if('z' == command[j]) { cout<<"26"; }
AIM: MarderIII
Without the spaces.Code:if (command[j] == ' \ '') // do something
What data types are you using char arrays or the string class?
You cannot test char arrays like this. You need a 2D char array and strcmp.Code:#include <iostream> #include <string> using namespace std; int main() { string s2[] = { "test", "testing", "tested" }; for(int i=0; i < 3; i++) if("test" == s2[i]) cout << "26" << endl; else cout << s2[i] << endl; return 0; }
I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P
This man is correct. Disregard everyone else's replies.Originally posted by slaveofthenet
Without the spaces.Code:if (command[j] == ' \ '') // do something