You are on page 1of 4

BAGUITAN, KRIZEA ABEGAIL LEAL

CPE 102A- EE21S1

 Using 1st and 2nd way of Function:

Menu System
1 – converting ft to inch (1st way)
2 – Area of a circle (2nd way)
3 – Exit
Do You Want to Try again? (y/n)

#include <iostream>

#include <string>

using namespace std;

float pie()

return(3.1416);

void convert()

float ft, in;

cin >> ft;

in = ft / 12;

cout << "The converted value is: " << in << " inches." << endl;

int main()
{

start:

int choice;

cout << "Select from the choices below." << endl;

cout << "1 - ft to inch\n2 - Area of circle\n3 - Exit" << endl;

cin >> choice;

switch (choice)

case 1:

cout << "Feet to inch" << endl;

convert();

break;

case 2:

double A, r;

cout << "Please enter the value of the radius of the circle:" << endl;

cin >> r;

A = (pie() * (r * r));

cout << "The area of the circle is: " << A << endl;

break;

case 3:

goto exit;

break;

default:

cout << "You didn't choose a valid option." << endl;

goto start;
break;

exit:

string decision;

cout << "Do you want to try again? Y/N" << endl;

cin >> decision;

if (true)

if (decision == "Y")

goto start;

else

system ("pause");

return EXIT_SUCCESS;

You might also like