rw_calcmain.cpp
//Programmer: Eric Barnes
//Date: 3/19/2014
//Class: CS 53
//Filename: rw_calcmain.cpp
//Description: Main driver for ralph's calculations. True love not guranteed
#include "rw_calc.h"
int main()
{
int x_choice;
int menu_choice;
int root_choice;
int pow_choice;
bool chose_x = false;
greet();
do
{
menu_choice = menu();
switch (menu_choice)
{
case 1:
x_choice = get_posnum("x choice");
chose_x = true;
break;
case 2:
if(chose_x)
{
cout << "The factorial of " << x_choice << " is " << fact(x_choice)
<< endl << endl;
}
else
demand_x();
break;
case 3:
if(chose_x)
{
root_choice = get_posnum("root choice");
cout << "The " << root_choice <<"th root of" << x_choice <<" is "
<< nth_root(x_choice, root_choice) << endl << endl;
}
else
demand_x();
break;
case 4:
if(chose_x)
{
pow_choice = get_posnum("power choice");
cout << x_choice << " to the power of " << pow_choice <<" is "
<< pow(x_choice, pow_choice) << endl << endl;
}
else
demand_x();
break;
case 5:
if(chose_x)
{
cout <<"Exp("<<x_choice<<") is " << exponential(x_choice)
<< endl << endl;
}
else
demand_x();
break;
case 6:
if(chose_x)
{
cout <<"Sinh("<<x_choice<<") is " << sinh(x_choice) << endl <<endl;
}
else
demand_x();
break;
case 7:
goodbye();
break;
default:
cout << "Please make a selection from the MENU, Ralph";
}
}while(menu_choice != 7);
return 0;
}