Hello, this code probabily donesn't work. But my aim is find a way to work with character that can be',' or ' ', or '|'.
s could be: 20 2 3 or 20,2,3 or 20character2cha racter3. The problem is also that it could be 20 2 3 or 20, 2, 3
If I pass at function myFunc() as character ' ' (blank character) compiler says me that I can't have two ' ' in the switch. How can I outperform this problem? thanks
s could be: 20 2 3 or 20,2,3 or 20character2cha racter3. The problem is also that it could be 20 2 3 or 20, 2, 3
If I pass at function myFunc() as character ' ' (blank character) compiler says me that I can't have two ' ' in the switch. How can I outperform this problem? thanks
Code:
void myFunc(char* character) {
int i=0;
while ( string s = readlineFromAFile()) {[INDENT]switch (s[i]) {
case character:
doSomething();
i++;
break;
case ' ':i++; break;
default: doOther(); break;
}[/INDENT]
}
}
Comment