title: Evaluate a string with a switch in C++
body: <p>I want to evaluate a string with a switch but when I read the string entered by the user throws me the following error.</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
      int main() {
          string a;
          cin&gt;&gt;a;
          switch (string(a)) {
          case "Option 1":
              cout&lt;&lt;"It pressed number 1"&lt;&lt;endl;
              break;
          case "Option 2":
              cout&lt;&lt;"It pressed number 2"&lt;&lt;endl;
              break;
          case "Option 3":
              cout&lt;&lt;"It pressed number 3"&lt;&lt;endl;
              break;
          default:
              cout&lt;&lt;"She put no choice"&lt;&lt;endl;
              break;
          }
          return 0;
      }
  </code></pre>
  
  <blockquote>
    <p>error: invalid cast from type 'std::string {aka std::basic_string}' to type 'int</p>
  </blockquote>