/********************************************************
* *
* Program: "Colin Calculator" *
* *
* Author: "Colin Hill" *
* *
* Description: "My first program. I made it to learn *
* about variables and basic math with C++." *
* *
* Made with: "Dev-C++ 4.9.2.0" *
* *
* Date: "05/27/02" *
* *
********************************************************/
#include
int main()
{
int whatToDo;
int nt; // variable for when I don't want the program to exit
cout << "****************************\n";
cout << "******Colin Calculator******\n";
cout << "****************************\n\n\n";
cout << "What do you want to do?\n\n";
cout << "1.\tAdd 2 numbers.\n";
cout << "2.\tMultiply 2 numbers.\n";
cout << "3.\tDivide 2 numbers.\n";
cout << "4.\tFind the force of an object.\n";
cout << "5.\tExit.\n";
cin >> whatToDo;
if (whatToDo == 5)
{
// exit program
}
if (whatToDo == 1)
{
int long addOne;
int long addTwo;
int long added;
cout << "Enter the first number to be added: ";
cin >> addOne;
cout << "Enter the second number to be added: ";
cin >> addTwo;
added = addOne + addTwo;
cout << "The sum of " << addOne << " and " << addTwo << " is " << added;
cin >> nt;
}
if (whatToDo == 2)
{
int long multOne;
int long multTwo;
int long multed;
cout << "Enter the first number to be multiplied: ";
cin >> multOne;
cout << "Enter the second number to be multiplied: ";
cin >> multTwo;
multed = multOne * multTwo;
cout << "The factor of " << multOne << " and " << multTwo << " is " << multed;
cin >> nt;
}
if (whatToDo == 3)
{
int long divOne;
int long divTwo;
int long dived;
cout << "Enter the first number to be divided: ";
cin >> divOne;
cout << "Enter the second number to be divided: ";
cin >> divTwo;
dived = divOne / divTwo;
cout << "The quotient of " << divOne << " and " << divTwo << " is " << dived;
cin >> nt;
}
if (whatToDo == 4)
{
// Sir Isaac Newton's formula
float forceOne;
float forceTwo;
float forced;
cout << "Enter the mass of the object in Kg: ";
cin >> forceOne;
cout << "Enter the acceleration of the object in meters per second squared: ";
cin >> forceTwo;
forced = forceOne * forceTwo;
cout << "The force of an object with the mass of " << forceOne << "Kg and the acceleration of " << forceTwo << " is " << forced << " Newtons";
cin >> nt;
}
return 0;
}