Public feed
#893319
#include <iostream>
using namespace std;
int main ()
{
int t;
float n1, n2, r3, r, e;
Main:
cout << "The Grand Calculator \n \n";
cout << "Enter 1 for Multiplication \nEnter 2 for Addition\nEnter 3 for Division\nEnter 4 for Subtraction\nEnter: ";
cin >> t;
if (t == 1)
{
cout << "\nMultiplication Calculator\n \n";
cout << "Please enter a number: ";
cin >> n1;
cout << "Please enter a second number: ";
cin >> n2;
cout << "\n" << "The numbers that you entered were " << n1 << " and " << n2 << ".";
r = n1 * n2;
cout << "\n" << "The product is: " << r << ".\n \nType 1 to return to menu, 2 to exit.";
cin >> e;
if (e == 1)
{
cout << "\n\n";
goto Main;
}
else
{
return 0;
}
}
else if (t == 2)
{
cout << "\nAddition Calculator\n \n";
cout << "Please enter a number: ";
cin >> n1;
cout << "Please enter a second number: ";
cin >> n2;
cout << "\n" << "The numbers that you entered were " << n1 << " and " << n2 << ".";
r = n1 + n2;
cout << "\n" << "The sum is: " << r << ".\n \nType 1 to return to menu, 2 to exit.";
cin >> e;
if (e == 1)
{
cout << "\n\n";
goto Main;
}
else
{
return 0;
}
}
else if (t == 3)
{
cout << "\nDivision Calculator\n \n";
cout << "Please enter a number: ";
cin >> n1;
cout << "Please enter a second number: ";
cin >> n2;
cout << "\n" << "The numbers that you entered were " << n1 << " and " << n2 << ".";
r = n1 / n2;
cout << "\n" << "The quotient is: " << r << ".\n \nType 1 to return to menu, 2 to exit.";
cin >> e;
if (e == 1)
{
cout << "\n\n";
goto Main;
}
else
{
return 0;
}
}
else if (t == 4)
{
cout << "\nSubtraction Calculator\n \n";
cout << "Please enter a number: ";
cin >> n1;
cout << "Please enter a second number: ";
cin >> n2;
cout << "\n" << "The numbers that you entered were " << n1 << " and " << n2 << ".";
r = n1 - n2;
cout << "\n" << "The remainder is: " << r << ".\n \nType 1 to return to menu, 2 to exit.";
cin >> e;
if (e == 1)
{
cout << "\n\n";
goto Main;
}
else
{
return 0;
}
}
return 0;
}