p3.cpp:228: error: jump to case label
p3.cpp:218: error: crosses initialization of `std::string FindWord'
p3.cpp:229: error: jump to case label
p3.cpp:218: error: crosses initialization of `std::string FindWord'
p3.cpp:231: error: expected `;' before "Q"
p3.cpp:236: error: jump to case label
p3.cpp:218: error: crosses initialization of `std::string FindWord'
p3.cpp:228: warning: destructor needed for `FindWord'
p3.cpp:228: warning: where case label appears here
p3.cpp:228: warning: (enclose actions of previous case statements requiring destructors in their own scope.)
p3.cpp:229: warning: destructor needed for `FindWord'
p3.cpp:229: warning: where case label appears here
p3.cpp:236: warning: destructor needed for `FindWord'
p3.cpp:236: warning: where case label appears here
In C/C++, switch statements allows fall-through semantics with the case labels. You declared a FindWord variable when your switch statement encounters case 'F' or 'f'. To solve this, make FindWord in its own scope or declare it outside the switch statements.