the problem is, every compiler i have used (g++, gcc, MS visual) gives me an error like this : "error: switch quantity not an integer"Code:switch(operation) { case 'R': if(!strcmp(opcode, "add")) { machineLine[7] = '0'; machineLine[8] = '0'; machineLine[9] = '0'; } /*next 3 switch statements set bits associated with register values*/ switch(arg0) { case '0': machineLine[10] = '0'; machineLine[11] = '0'; machineLine[12] = '0'; break; case '1': machineLine[10] = '0'; machineLine[11] = '0'; machineLine[12] = '1'; break; case '2': machineLine[10] = '0'; machineLine[11] = '1'; machineLine[12] = '0'; break; case '3': machineLine[10] = '0'; machineLine[11] = '1'; machineLine[12] = '1'; break; } break; }
I need to reading in a string on the nested switch statement, but the compilers arent letting me put anything except an integer in there?? why is this??
note: variable "operation" is a char
arg0 is a string;
machineLine is an array
the switch(arg0) is giving the error. does anyone have any code examples using a nested switch? it definitly should not be restricting any parameter of a nested switch to only integers.