title: switch case, user input, determine what character it is
body: <p>I have a bunch of if statements. But I want to have that bunch of if statements in a switch. I try it like this:</p>
  
  <pre><code>// project_stringManipulation.cpp : Defines the entry point for the console application.
  //
  
  #include "stdafx.h"
  #include &lt;iomanip&gt;
  #include &lt;iostream&gt;
  #include &lt;cctype&gt;
  
  using namespace std;
  
  int main()
  {
  
      char input;
      cin &gt;&gt; input;
  
      switch (input)
      {
      case isalpha(input) :       
          cout &lt;&lt; "That's an alphabetic character.\n";
      default:
          break;
      }
  
  
      cout &lt;&lt; "Enter any character: ";
      cin.get(input);
      cout &lt;&lt; "The character you entered is: " &lt;&lt; input &lt;&lt; endl;
      cin.get();
      if (isalpha(input))
          cout &lt;&lt; "That's an alphabetic character.\n";
      cin.get();
      if (isdigit(input))
          cout &lt;&lt; "That's a numeric digit.\n";
      cin.get();
      if (islower(input))
          cout &lt;&lt; "The letter you entered is lowercase.\n";
      cin.get();
      if (isupper(input))
          cout &lt;&lt; "The letter you entered is uppercase.\n";
      cin.get();
      if (isspace(input))
          cout &lt;&lt; "That's a whitespace character.\n";
  
      cin.get();
  
      return 0;
  }
  </code></pre>
  
  <p>But then I will get on this line:</p>
  
  <pre><code>case isalpha(input) :
  </code></pre>
  
  <p>The following error:</p>
  
  <pre><code>Severity    Code    Description Project File    Line    Suppression State
  Error (active)      expression must have a constant value   project_stringManipulation  d:\Mijn Documents\VisualStudio2015\C++_Programs\Program_Nice\project_stringManipulation\project_stringManipulation.cpp  19  
  </code></pre>
  
  <p>How to do it on the correct way?</p>
  
  <p>Thank you</p>