title: Use input string as variable name
body: <p>If the input is for example "banana", I want to print the kcal of banana. I tried something like this (and failed):</p>
  
  <pre><code>string input;
  cin &gt;&gt; input;
  cout &lt;&lt; input.Kcal &lt;&lt; endl;
  </code></pre>
  
  <p>I know that I can do it with if-statements like:</p>
  
  <pre><code>string input;
  cin &gt;&gt; input;
  
  if(input == "banana")
  {
      cout &lt;&lt; banana.Kcal &lt;&lt; endl;
  }
  </code></pre>
  
  <p>But there I must write very much code when I have more then 1000 foods...</p>
  
  <p>There is my declaration and definition of my banana object. Every object has kcal.</p>
  
  <pre><code>food banana;
  banana.Kcal = 89;
  </code></pre>
  
  <p>My class, the Food.h code:</p>
  
  <pre><code>#pragma once
  
  class CFood
  {
  public:
      CFood();
      ~CFood();
      float Kcal;
  }
  </code></pre>
  
  <p>The food.cpp code:</p>
  
  <pre><code>CFood::CFood()
  {
      Kcal = 0;
  }
  CFood::~CFood()
  {
  }
  </code></pre>