title: While loop or function for input validation
body: <p>I was assigned to write a program in C++ to take user input, perform some calculation, then present the user with the information after calculations were performed. </p>
  
  <p>The specifics of the program are not needed, since my question is in reference to input validation specifically. What is considered to be better practice / more practical for validating multiple user inputs?</p>
  
  <ol>
  <li>Using a <code>while</code> loop in <code>int main()</code> to catch bad input after every <code>cin</code> statement</li>
  </ol>
  
  <p>OR</p>
  
  <ol start="2">
  <li>Passing input to a function with 1 <code>while</code> loop to validate the input, the return the input back.</li>
  </ol>
  
  <p>I am fairly new to programming in general, and have only been working in C++ for a few weeks, and my greenhorn instincts would tell me to create a few <code>while</code> loops in <code>int main()</code> and call it a day. Something tells me a function would be a better idea, because, you know, object orientation.</p>
  
  <p>Thanks in advance. - Wes</p>