Advertisement
Guest User

Untitled

a guest
May 5th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. //============================================================================
  2. // Name : BOATSBOATS.cpp
  3. // Author :
  4. // Version :
  5. // Copyright : Your copyright notice
  6. // Description : Hello World in C++, Ansi-style
  7. //============================================================================
  8.  
  9. #include <iostream>
  10. #include <vector>
  11. #include <fstream>
  12. using namespace std;
  13.  
  14. void clearcin(void) {
  15. cin.clear();
  16. cin.ignore(32768,'\n');
  17. }//clear cin
  18.  
  19. struct Boat{
  20. int boatID;
  21. string manufacturer;
  22. string modelName;
  23. int yearBuilt;
  24. };//boat
  25.  
  26. struct CBoat{
  27. int boatID;
  28. char manufacturer[30];
  29. string modelName[30];
  30. int yearBuilt;
  31. };//boat
  32.  
  33.  
  34. int inputInt(int MinValue, int MaxValue, string prompt){
  35. cout << prompt << endl;
  36. int num;
  37. while(true){
  38. cout << "Enter an Integer between " << MinValue << " and " << MaxValue << endl;
  39. cin >> num;
  40. clearcin();
  41. if(num < MinValue|| num > MaxValue){
  42. cout << "Please enter a value greater than " << MinValue << " and less than " << MaxValue << endl;
  43. continue;
  44. }//if
  45. else{
  46. return num;
  47. break;
  48. }//else
  49. }//while
  50. }//int
  51.  
  52. int main() {
  53.  
  54. Boat aBoat;
  55.  
  56. vector <Boat> boats;
  57. int totalBoats = 0;
  58. totalBoats = inputInt(0, 100 ,"How many boats would you like to enter?" );
  59. for (int i = 0; i < totalBoats; i++){
  60. cout << "stuff" << endl;
  61. aBoat.boatID = inputInt(1, 100, "enter stuff");
  62. }
  63.  
  64.  
  65. cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
  66. return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement