menu driven app

closed account (GvMfLyTq)
can someone help me to find my error in my menu driven app??

#include <iostream>
#include<iomanip>
#include<cmath>


using namespace std;

//Function prototypes
//using Value-returning functions
void DisplayMenu();
void GetChoice(char&choice);
void getRadious();
double CalcArea(int radious, double pi);
double CalcCircumference(int radious, double pi);
int CalcDiameter(int radious);
void DisplayTable();

int main()
{
//Local variables
int radious;
double pi = 3.14159;
char choice;


do
{
//Function call
DisplayMenu();
GetChoice(choice);

{
switch (choice)
{

case 1:
cout << "The radious is: " << getRadious() << endl;
break;

case 2:
cout << "The Area is: " << CalcArea(radious, pi) << endl;
break;

case 3:
cout << "The Circumference is: " << CalcCircumference(radious, pi) << endl;
break;
case 4:
cout << "The Diameter is: " << CalcDiameter(radious) << endl;
break;
case 5:
DisplayTable();
break;

case 6: cout << "\nGood bye!" << endl << endl;
break;

}

system("pause");
//Clear the screen
system("cls");
}

} while (choice != 4);

return 0;
}

void DisplayMenu()
{
//Display the options of the program and ask the user to choose 1 of the 6 options
cout << " CIRCLE APPLICATION " << endl;
cout << "---------------------------------" << endl;
cout << " 1) Get radious " << endl;
cout << " 2) Calculate Area " << endl;
cout << " 3) Calculate circumference " << endl;
cout << " 4) Calculate diameter " << endl;
cout << " 5) Display Table " << endl;
cout << " 6) Exit " << endl;
cout << "---------------------------------" << endl;

}

void GetChoice(char&choice)
{
//Ask the user to enter a option (1-6)
cout << "Enter a choice[1-6]: ";
//input the option
cin >> choice;

while (choice < 1 || choice>6)
{
cout << "Please re-enter a choice [1-6]: ";
cin >> choice;
}

}

void getRadious()
{
int radious;
//Ask the user to enter the radious of the circle
cout << "Enter the radious of the circle: ";
//Input the radious
cin >> radious;

}

//Calculate the area square using the width and length entered by the user
double CalcArea(int radious, double pi = 3.14159)
{
return (pow(radious, 2)*pi);
}

//Calculate the perimeter of the square using the width and length entered by the user
double CalcCircumference(int radious, double pi=3.14159)
{
return (2*radious*pi);
}


int CalcDiameter(int radious)
{
return (2 * radious);
}

void DisplayTable()
{


{

cout << "\n CIRCLE APPLICATION \n" << "\n"
<< " ******************************\n"
<< " Radious Circumference\n"
<< " ******************************\n";


for (double radious = 0; radious <= 10.0; radious++)
{
cout << " " << setw(2) << radious << fixed << setprecision(1);
cout << " " << setw(2) << CalcCircumference << fixed << setprecision(2) << endl;
}

//End of the table
cout << " ******************************\n" << endl << endl;
}

}




What error? Why aren't you giving us all the information that would help us to help you?
Topic archived. No new replies allowed.