How to ask the user to input two numbers, and after that show these options:
sum, average, maximum, minimum, exit.
Then due to the user choice, the program shows the answer, and this process continues until the user input number 5.
My code does not work properly. Here is the code:
#include <stdio.h>
#include <iostream>
using namespace std;
int main() {
int x, y, choice;
char sum, average, max, min;
cout << "Enter two numbers: " << endl;
cin >> x >> y;
cout << "Choose one of these options: \n";
cout << " sum - average - max - min - exit " << endl;
choice == sum || average || max || min;
cin >> choice;
sum == x + y;
max == x > y || y > x;
if (choice == sum) {
cout << "The sum is: " << x + y << endl;
}
if (choice == average) {
cout << "The average is: " << x / y << endl;
}
if (choice == max&& x > y) {
cout << "The maximum is: " << x << endl;
} else
cout << " The maximum is: " << y << endl;
if (choice == min&& x < y) {
cout << "The minimun is: " << x << endl;
} else
cout << " The minimun is: " << y << endl;
while (true) {
string choice;
cin >> choice;
if (choice == "5") {
break;
}
}
return 0;
}