TheBeast32 54 Posting Whiz in Training

This is a little long, but it works!

#include <string>
      #include <iostream>
      using namespace std;
      
      int main()
      {
      string word1, word2, word3;
      
      cout << "Enter word1: " <<endl;
      cin >>word1;
      cout <<"Enter word2: " <<endl;
      cin >>word2;
      cout << "Enter word3: " <<endl;
      cin >>word3;

      int Longest, Shortest;
      
      // Get the longest word 
      if (word1.length() > word2.length() && word1.length() > word3.length())
      {
      Longest = 1;
      cout << "\nLongest word: " << word1;
      }
      if (word2.length() > word1.length() && word2.length() > word3.length())
      {
      Longest = 2;
      cout << "\nLongest word: " << word2;
      }
      if (word3.length() > word1.length() && word3.length() > word2.length())
      {
      Longest = 3;
      cout << "\nLongest word: " << word3;
      }
      
      // Get the shortest word
      if (word1.length() < word2.length() && word1.length() < word3.length())
      {
      Shortest = 1;
      cout << "\nShortest word: " << word1;
      }
      if (word2.length() < word1.length() && word2.length() < word3.length())
      {
      Shortest = 2;
      cout << "\nShortest word: " << word2;
      }
      if (word3.length() < word1.length() && word3.length() < word2.length())
      {
      Shortest = 3;
      cout << "\nShortest word: " << word3;
      }
      
      // Get the word in the middle
      if (Shortest == 1 && Longest == 2)
      {
      cout << "\nOther word: " << word3;
      }
      if (Shortest == 2 && Longest == 1)
      {
      cout << "\nOther word: " << word3;
      }
      
      if (Shortest == 1 && Longest == 3)
      {
      cout << "\nOther word: " << word2;
      }
      if (Shortest == 3 && Longest == 1)
      {
      cout << "\nOther word: …
John A commented: Congratulations for doing someone else's homework. -3