title: C++ text file based database read
body: <p>I need simple program in C++ that will open text file and going line by line find second argument by knowing first in list.</p>
  
  <p>Content of text file:</p>
  
  <pre><code>1, red
  2, blue
  3, green
  4, orange
  </code></pre>
  
  <p>So I need a program that will go line by line and each line turn into array ( of two elements ) and then compare first element with user interactively inserted number.</p>
  
  <p>So if user insert 2, it goes line by line, comparing first element of array-ed line and if it matches, it prints second element in array ( blue ), and if user type 3, it prints green...</p>
  
  <p>I have always working in PHP, and it's much easier than this, so I am stuck a little bit with this now... :/</p>