/*----------------------------------------------------------------------*/
/*                             GetNum.cpp                               */
/*   Here is an example of input looping until a floating point number  */
/* has been correctly entered.                                          */
/* Authored By : H.P.Kasmaei                                            */
/* Last Update : february 27, 2009                                      */
/* http://www.hpkclasses.ir/                                            */
/*----------------------------------------------------------------------*/

#include "stdafx.h" // Microsoft only
#include <iostream>


int main()
{
   float floatnum;
   cout << "Enter a floating point number:" <<endl;

   while(!(cin >> floatnum)) {
      cin.clear() ;
      cin.ignore(256,'\n') ;
      cout << "Bad Input - Try again" << endl;
      }

   cout << "You entered " << floatnum << endl;

   return 0;
}

