VB icon

Riotblade's Simple Calculator

Email
Submitted on: 1/5/2015 7:16:00 AM
By: Kevin Huang (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: C++ (general)
Views: 554
 
     Just a little calculator, might be helpful in the function department.
 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
//INCLUDE files for :Riotblade's Simple Calculator
//**************************************
<iostream>
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Riotblade's Simple Calculator
// Description:Just a little calculator, might be helpful in the function department.
// By: Kevin Huang (from psc cd)
//
// Assumes:Contains some area formulas just for helping you out.
//**************************************

#include <iostream>
#include <stdlib.h>
using namespace std;
int main(int argc, char *argv[])
{
 int choices;
 long int a,b,c;
 std::cout << "Hi, welcome to Riotblade's calculator.\n";
 std::cout << "Select what you want to do.\n";
 std::cout << "(1)\tAdd\n";
 std::cout << "(2)\tSubtract\n";
 std::cout << "(3)\tDivide\n";
 std::cout << "(4)\tMultiply\n";
 std::cout << "(5)\tFormulas\n";
 std::cout << "(6)\tQuit\n";
 std::cin >> choices;
 switch (choices)
 {
 case 1:
std::cout << "Enter two numbers.\n";
 std::cin >> a;
 std::cin >> b; 
 c=(a+b);
 std::cout << "Your answer is " << c << ".\n";
 break;
 case 2:
 std::cout << "Enter two numbers.\n";
 std::cin >> a;
 std::cin >> b;
 c=(a-b);
 std::cout << "Your answer is " << c << ".\n";
 break;
 case 3:
 std::std::cout << "Enter two numbers.\n";
 std::cin >> a;
 std::cin >> b;
 c=(a/b);
 std::cout << "Your answer is " << c << ".\n";
 break;
 case 4:
 std::cout << "Enter two numbers.\n";
 std::cin >> a;
 std::cin >> b;
 c=(a*b);
 std::cout << "Your answer is " << c << ".\n";
 break;
 case 5:
 std::cout << "Area Formulas\n";
 std::cout << "Square: a*a\n";
 std::cout << "Rectangle: a*b\n";
 std::cout << "Parallelogram: base*height\n";
 std::cout << "Trapezoid: Height/2(b1+b2)\n";
 std::cout << "Circle: Pi*Radius squared\n";
 std::cout << "Ellipse: pi*r1*r2\n";
 std::cout << "Triagle: 1/2*b*h\n";
 std::cout << "Equillateral Triangle: Squareroot of 3/4 * (a squared)\n";
 break;
 case 6:
 abort();
 break;
 
 } 
 system("PAUSE");
 return 0;
}


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.