1. #include <iostream>
  2. #include <string>
  3.  
  4. // Allows user to choose how many words to enter (up to 100) User enters words, program displays words.
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.  
  11. int x = 0;
  12. cout << "Enter number of words you would like to enter(Max is 100): ";
  13. cin >> x; // User amount variable
  14. cout << endl;
  15.  
  16. const int AMOUNT = 100; // const array max
  17. string word[AMOUNT];
  18. string input;
  19. for (int i = 0;i < x; i++) // user controlled for-loop
  20. {
  21. cout << "Enter a word: ";
  22. cin >> input; // user input for words
  23. word[i] = input; // populate array
  24. }
  25.  
  26. cout << "\nThe words you entered are:" << endl << endl; // iterates through array and prints items
  27. int n= 0; // variable for line number
  28. for (int i = 0; i < x; i++)
  29. {
  30. cout << n <<". " << word[i] << endl;
  31. n++;
  32. }
  33. cout << endl << endl;
  34.  
  35. return 0;
  36. }
  37.