I need help with my homework. I'm not sure what I'm doing wrong. Here is what the homework prompt is: Write a complete C++ program that allows the user to input and sort two values of a selected data type in ascending order. More in detail:

  • Prompt the user to select a data type by entering one of the following strings: "char", "int", or "double". If a different string is entered the program should display the message "Invalid Option" and use the exit function to terminate with exit code 0.

  • Once a valid data type is selected, prompt the user to input two values of that type.

  • Pass the user's input values as arguments, in the same order they were entered by the user, to an overloaded function named order. The order function should use reference parameters to receive the arguments. If the first argument is greater than the second, the function should swap the two values.

  • Print the input values to the screen in ascending order, separated by a space.

Your program should have the following overloaded versions of the order function:

  • A version that accepts two char arguments

  • A version that accepts two int arguments

  • A version that accepts two double arguments

As previously mentioned, the order function's parameters should be reference variables. The function should return nothing.

<Sample Run (User input in bold)>

Select a data type among char, int, and double: int

Enter the first value: -3

Enter the second value: -6

-6 -3

<End Sample Run>

Hint: To swap the values, use a temporary variable inside the order function to hold the value of one variable while assigning the other. This prevents losing the value during the swap process.

Here is my code so far:

#include <iostream>
#include <string>
using namespace std;
int main ()
 {
     string dataType;
     int firstValue, secondValue, displayValues, order;

    // data type
    do
    {
        cout << "Select a data type among char, int, and double: \n";
         cin >> dataType;

         if (dataType != "int" || dataType != "char" || dataType != "double");
             cout << "Invalid Option\n";
            break;
    //first value
     cout << "Enter the first value: ";
     cin >> firstValue;

    //second value
     cout << "Enter the second value: ";
     cin >> secondValue;
    
    } while (displayValues);
   cout << displayValues << endl;
    
return 0;
}