   need help with switch  and case
  Can I use switch and case with strings is that possible? 
  what language?    - Google - MSDN Library - GameDev.net Articles & Resources - Wikipedia The Free Encyclopedia -  ;  sorry I forgot to add thatI am using c++ with dev-cpp in windows xp pro ;  Not with C++, I don''t think.If I am right, it is probably because the switch-case doesn''t use the ''='' operator to test, but I am not sure I am right. ;  u can use  if(!strcmp(StringToCompare, "What You Want to Check The string For")) { do_something(); }//which means if StringToCompare = Whatever u check then do something  [edited by - DerAngeD on February 15, 2004 8:17:41 PM];  well i have some thing like this int menuinput(void){std::string pingv;std::string input2;std::cout << "C:\>" ;cin >> input2 ;//result = strncmp( string1, string2 , 10 );if( strnicmp( input2.c_str(), "fdisk", 10 ) == 0 )//if (  = strnicmp("")){FDISK();}if (input2 == "DEBUG"){debug();}if (input2 == "FORMAT"){  std::cout << "The type of file system is NTFS."<< std::endl << std::endl;FORMAT();} if (input2 == "HELP"){help();}if (input2 == "PING") {std::cin >> pingv;std::cout << "pinging " << pingv << std::endl;ping();}if (input2 == "ipconfig"){ipconfig();} if (input2 == "EXIT"){std::cout << "CLOSING SIMULATION" << std::endl;exit (1);}if (input2 == "TIME"){ttime();}if (input2 == "DATE"){ttime();}else{std::cout <<" NOT A VALID COMMAND:"<<std::endl;menuinput();} return 0;}I just dont like all the if statments. I was trying to find another way to do the above.   [edited by - kingpinzs on February 15, 2004 8:19:16 PM];  are u writong an os.I wrote an os once.It beat the shit outa DOS.    ;  I am going to try to make something like an os but really basic just to have something I can use while learning more of c++ and how it works and also to learn how to figre out more complicated programming problems before continung to make my game. ;  well no you cant use switch.youre stuck with if.you could go put it in a function. std::string command;void check(std::string command){if( strnicmp( command.c_str(), "fdisk", 10 ) == 0 ){FDISK();}else if( strnicmp( command.c_str(), "someothercmd", 10 ) == 0 {do_something_else();}else{std::cout << "You did not enter a valid command" << std::endl;}}int main(){gets(command.c_str());check(command);}[edited by - DerAngeD on February 15, 2004 8:32:18 PM];  You could map strings to functions/functors. 