View Single Post
Join Date: Jul 2005
Posts: 164
Reputation: Stoned_coder is an unknown quantity at this point 
Solved Threads: 5
Stoned_coder Stoned_coder is offline Offline
Junior Poster

Re: airplane seating prices

 
0
  #5
Jul 26th, 2005
something like....
  1. #include <iostream>
  2. #include <limits>
  3. using namespace std;
  4.  
  5. int GetInput(string s)
  6. {
  7. cout<<s;
  8. int input;
  9. while (!(cin>>input))
  10. {
  11. cerr<<endl<<"error! re-enter"<<endl;
  12. cin.clear();
  13. cin.ignore(numeric_limits<streamsize>::max(),'\n');
  14. }
  15. return input;
  16. }
  17.  
  18. int main()
  19. {
  20. int windowseatprice = GetInput(string("How much for a window seat"));
  21. return 0;
  22. }
Reply With Quote