I want to use switch-case in my program but the compiler generates an error. How can I use the The compiler gives me this error: My code is as follows : How do I use the switch statement with a Caststring ? You can not use the switch statement with
QString ?
The expression of the switch type 'QString' is invalid
boolStopWord (the word QString) {bool flag = false; Switch (word) {case "the": flag = true; break ; "On" case: flag = true; break ; Case "in": flag = true; break ; Case "your": flag = true; break ; Case "near": flag = true; break ; Case "all": flag = true; break ; Case "this": flag = true; break ; } Return flag; }
switch statement in C ++ language with integral or enum types. You can formally enter the square type of object in the
switch statement, but this means that the compiler will look for a user-defined conversion to convert it to an integral or enum type.
Comments
Post a Comment