### Help with Calculator

I'm trying to create a claculator that asks: For each computation, before getting the numbers, ask the user if they want to perform:
• integer arithmetic (whole numbers input and whole number results); or
• floating point arithmetic (input numbers may contain a decimal, and output must contain a decimal).

CALCULATOR PRACTICE PROGRAM
Hello, and welcome to the Calculator Practice Program.
This program allows you to practice your math skills.
Choose what you want to practice in the menu shown below.
-----------------------------------------------
-----------------------------------------------
b. Subtraction (X-Y)
c. Multiplication (X*Y)
d. Division (X/Y)
e. Powers & Roots
q. Quit the program
-----------------------------------------------
Enter your choice [ a - e, q ]:
-----------------------------------------------

Hello, and welcome to the Powers & Roots Menu.
This menu allows you to take powers and roots of a number.
---------------------------------------------------
---------------------------------------------------
a. Square a number (Xˆ2)
b. Cube a number (Xˆ3)
c. Raise to any power (XˆY)
d. Square root a number (Xˆ1/2)
e. Cube root a number (Xˆ1/3)
f. Take any root (Xˆ1/Y)
q. Quit the program
---------------------------------------------------
Enter your choice [ a - f, m, q ]:
---------------------------------------------------

This is what i have so far ;
#include <cstdlib>
#include <iostream>

using namespace std;

{
int choice;

cout << " \n Hello, and welcome to the Calculator Practice Program.
This program allows you to practice your math skills.
Choose what you want to practice in the menu shown below.\n\n"

<< " (b) Subtraction\n"
<< " (c) Division\n"
<< " (d) Mulpilication\n"
<< " (e) Powers & Roots\n"
<< " (q) Exit\n\n"
<< " Enter Your Choice[a-e,q ]: ";
cin >> choice;
return choice;
}

int main(int argc, char *argv[])
{
float total, num1, num2;

system("CLS");

{
cout << " Thank you for using the Calculator\n\n ";
cin.get();

}
else
{
{
case a:
int values;
cout << " How many numbers would you like to enter? : ";
cin >> values;
float numbers[values];

for(int counter=0; counter<values; counter++)
{
cout << counter+1 << ") Enter number: ";
cin >> numbers[counter];
}
for(int counter=0; counter<values; counter++)
total+=numbers[counter];
cout << "\n The Answer is : " << total << "\n\n ";
system("PAUSE");
break;
case b: // Subtraction Completed
cout << " Enter first number: ";
cin >> num1;
cout << " Enter second number: ";
cin >> num2;
total=(num1-num2);
cout << "\n The Answer is : " << total << "\n\n ";
break;
case c: // Divison Completed
cout << " Enter first number: ";
cin >> num1;
cout << " Enter second number: ";
cin >> num2;
total=(num1/num2);
cout << "\n The Answer is : " << total << "\n\n ";
break;
case d: // Multiplication
cout << " Enter first number: ";
cin >> num1;
cout << " Enter second number: ";
cin >> num2;
total=(num1*num2);
cout << "\n The Answer is : " << total << "\n\n ";

}
system("PAUSE");
return EXIT_SUCCESS;
}

/*case 4: // Multiplication
for(int counter=1; counter<values; counter++)
total=(numbers[0]*numbers[counter]);
cout << "\n The Answer is : " << total << "\n\n "; */

system("PAUSE");
return EXIT_SUCCESS;
}
Topic archived. No new replies allowed.