Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //============================================================================
- // Name : BOATSBOATS.cpp
- // Author :
- // Version :
- // Copyright : Your copyright notice
- // Description : Hello World in C++, Ansi-style
- //============================================================================
- #include <iostream>
- #include <vector>
- #include <fstream>
- using namespace std;
- void clearcin(void) {
- cin.clear();
- cin.ignore(32768,'\n');
- }//clear cin
- struct Boat{
- int boatID;
- string manufacturer;
- string modelName;
- int yearBuilt;
- };//boat
- struct CBoat{
- int boatID;
- char manufacturer[30];
- string modelName[30];
- int yearBuilt;
- };//boat
- int inputInt(int MinValue, int MaxValue, string prompt){
- cout << prompt << endl;
- int num;
- while(true){
- cout << "Enter an Integer between " << MinValue << " and " << MaxValue << endl;
- cin >> num;
- clearcin();
- if(num < MinValue|| num > MaxValue){
- cout << "Please enter a value greater than " << MinValue << " and less than " << MaxValue << endl;
- continue;
- }//if
- else{
- return num;
- break;
- }//else
- }//while
- }//int
- int main() {
- Boat aBoat;
- vector <Boat> boats;
- int totalBoats = 0;
- totalBoats = inputInt(0, 100 ,"How many boats would you like to enter?" );
- for (int i = 0; i < totalBoats; i++){
- cout << "stuff" << endl;
- aBoat.boatID = inputInt(1, 100, "enter stuff");
- }
- cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement