CCCPaste

Simple Calculator

#include<iostream>
using namespace std;

int main()
{
int choice;
float fnum,snum;
cout << "==== SIMPLE CALCULATOR ====" << endl;

cout << "\nEnter First Number: ";
cin >> fnum;
cout << "Enter Second Number: ";
cin >> snum;
cout << "\n\nWhat operation would like to use?" << endl;
cout << "\nMenu:" << endl;
cout << "\t1. Addition" << endl;
cout << "\t2. Subtraction" << endl;
cout << "\t3. Multiplication" << endl;
cout << "\t4. Division" << endl;
cout << "Choose(1-4): ";
cin >> choice;

cout << "\n" << endl;
if(choice == 1){
cout << "The Addition of " << fnum <<" and "<< snum << " is : ";
cout << fnum + snum << endl;
}
else if (choice == 2){
cout << "The Subtraction of " << fnum <<" and "<< snum << " is : ";
cout << fnum - snum << endl;
}
else if (choice == 3){
cout << "The Multiplication of " << fnum <<" and "<< snum << " is : ";
cout << fnum * snum << endl;
}
else if (choice == 4){
if (fnum == 0 or snum == 0){
cout << "Can't divide to \"0\"." << endl;
}
else {
cout << "The Division of " << fnum <<" and "<< snum << " is : ";
cout << fnum / snum << endl;
}
}
else{
cout << "Wrong choice... Please try again." << endl;
}
cout << "\n\n=== Credits to: Regidor, Shokri Iam ===" << endl;
return 0;
}