My C++ Project

My C++ Project - student project

#include <IOstream>

using namespace std;

main()
{
double var1, var2;

cout << "Enter first number: ";
cin >> var1;

cout << "Enter second number: ";
cin >> var2;

cout << "What would you like to do with these two numbers?: " << endl;
cout << "+ - Add " << endl;
cout << "- - Subtract: " << endl;
cout << "/ - Divide: " << endl;
cout << "* - Multiply: " << endl;

char op;

cin >> op;

cout << var1 << ' ' << op << ' ' << var2 << " = ";

switch(op)
{
case '+':
cout << var1 + var2;
break;

case '-':
cout << var1 - var2;
break;

case '/':
if(var1 > 0)
{
cout << var1 / var2;
} else
{
cout << "Error: invalid input";
}
break;

case '*':
cout << var1 * var2;
break;

default:
cout << "This is not a valid input";

}


}

My C++ Project - image 1 - student project