ENHANCE:
#include <iostream>
using namespace std;
int main() {
int x = 0;
int y = 0;
int z = 0;
cout << "Type the numbers to get your answer\nDon't add a 0 before your number or else it'll detect no input or get your answer wrong\n";
cout << "Type your first number: \n";
cin >> x;
cout << "Type your second number: \n";
cin >> y;
cout << "Type your third number[0 if you don't need one]: \n";
cin >> z;
if (x == 0 && y == 0 && z == 0) {
cout << "No input detected\n"; //Checks for an input
} else if (((x == 0 && y == 0 && z != 0) ||
(x == 0 && y != 0 && z == 0) ||
(x != 0 && y == 0 && z == 0))) {
cout << "Please type in at least 2 numbers\n"; //Checks if there are 2 or more inputs
} else {
int answer = x + y + z; //change operation if you want. * for multiplying, / for dividing, - for subtracting.
cout << "\nYour answer is " << answer << "\n";}
int yes = 0;
cout << "Would you like to do another one?(1 or 0)\n";
cin >> yes;
if (yes == 1) {
while(yes == 1) {//This is the part that loops
cout << "Type your first number: \n";
cin >> x;
cout << "Type your second number: \n";
cin >> y;
cout << "Type your third number[0 if you don't need one]: \n";
cin >> z;
if (x == 0 && y == 0 && z == 0) {
cout << "No input detected\n"; //Checks for an input
} else if (((x == 0 && y == 0 && z != 0) ||
(x == 0 && y != 0 && z == 0) ||
(x != 0 && y == 0 && z == 0))) {
cout << "Please type in at least 2 numbers\n"; //Checks if there are 2 or more inputs
} else {
int answer = x + y + z; //change operation if you want. * for multiplying, / for dividing, - for subtracting.
cout << "\nYour answer is " << answer << "\n";}
cout << "Would you like to do another one?(1 or 0)\n";
cin >> yes;
if(yes == 0) {
cout << "Ok.";
}
}
} else {
cout << "Ok.";
}
}