Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <vector>
- using namespace std;
- class Ship
- {
- private:
- string words;
- int nrOfWords;
- public:
- Ship()
- { nrOfWords = 0; }
- void addWord(string aWord);
- int getNrOfWords() {return nrOfWords;}
- string getWords() {return words;}
- };
- int main()
- {
- vector<string> Words;
- string Word;
- string ord;
- {
- cout << "First cargo: ";
- getline(cin, Word);
- string in(Word);
- Words.push_back(in);
- system("cls");
- cout << "The cargo is:\n";
- for (int count = 0; count < Words.size(); count++)
- {
- cout << Words[count] << endl;
- }
- system("pause");
- system("cls");
- bool done = false;
- while(!done)
- {
- cout <<"Repeat the cargo: " << endl;
- for (int count = 0; count < Words.size(); count++)
- getline (cin, ord);
- string temp(ord);
- if(temp.compare(Word) == 0)
- {
- cout<<"Next word in shipload: ";
- getline(cin, Word);
- string in(Word);
- Words.push_back(in);
- system("pause");
- system("cls");
- cout << "The cargo is:\n";
- for (int count = 0; count < Words.size(); count++)
- {
- cout << Words[count] << endl;
- }
- system("pause");
- system("cls");
- }
- else
- {
- cout<<"Sorry! You did not manage to repeat all the words this time.";
- done = true;
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment