So I'm EXTREMELY new to C++, and have just started learning it about 2 days ago.
I'm trying to make a very basic calculator, and this is what I've got.
Any help for this?
I'm trying to make a very basic calculator, and this is what I've got.
Code
#include <iostream>
using namespace std;
int main()
{
int firstnumber;
int secondnumber;
string check;
string operation;
cout << "Enter your first number: \n";
cin >> firstnumber;
cout << "Enter your second number: \n";
cin >> secondnumber;
cout << "NOTE: Your numbers will not show decimals, because they will be rounded. \n";
cout << "Enter your operation. Enter +,-,*, or /. \n";
cin >> operation;
if(operation == "+"){
cout << firstnumber << " added with " << secondnumber << " is equal to " << (firstnumber + secondnumber) << ". \n";
}
else if(operation == "-"){
cout << secondnumber << " subtracted from " << firstnumber << " is equal to " << (firstnumber - secondnumber) << ". \n";
}
else if(operation == "*"){
cout << firstnumber << " multiplied with " << secondnumber << " is equal to " << (firstnumber * secondnumber) << ". \n";
}
else if(operation == "/"){
cout << firstnumber << " divided by " << secondnumber << " is equal to " << (firstnumber / secondnumber) << ". \n";
}
else if(operation != "+" or "-" or "*" or "/"){
cout << "You have entered an unrecognized operation. \n";
};
cout << "Would you like to complete another calculation? [yes or no.] \n";
cin >> check;
if(check == "yes"){
cout << "You picked yes. \n";
[b]RESTART PROGRAM[/b]
}
else if(check == "no"){
cout << "You picked no. \n";
[b]CLOSE PROGRAM[/b]
}
else if (check != "yes" or "no"){
cout << "You have entered something unrecognized. \n";
}
}Any help for this?


