All pastes #32508 Raw Edit

cammand-case

public cpp v1 · immutable
#32508 ·published 2005-12-05 15:30 UTC
rendered paste body
#include <iostream>#include <string>int main(){std::string data = "Test daten"; //string data = inputunsigned int loc = data.find( " ", 0); //erstes leerzeichen findenstd::string command; //darin wird das komando gespeichert command = data.substr(0, loc); //komando kopierenstd::cout << command << "|" << std::endl;       //std::cout << loc << std::endl;                  // nicht nötige ausgaben (zum überprüfen)std::cout << "--------------------------\n";    //if ( command == "Test") std::cout << "Test wars\n";     //komando-caseelse if ( command == "command 2" ) std::cout << "command2 wars\n";else std::cout << " NIX wars\n";                // falls nichts passt}