# Thread: Help ASAP With Multiple Functions with Input/Output Parameters

1. ## Help ASAP With Multiple Functions with Input/Output Parameters

Ok so i got this code working but then i realized that my teacher is a lame and wont accept it bc its dooesnt use Multiple Functions with Input/Output Parameters and i have no idea how to do that :/ i wondering if you could give me a example or idk :/

heres the problem question Write a menu program that will print various formulas and do calculations. For each menu choice, display the formula and prompt for the necessary values. Then calculate and print the area and the perimeter.

Your program must have 5 functions as follow:
1) int getMenuChoice( ); // display the menu, get and return the choice.
2) void Circle( double *radius, double *area, double *perimeter ); // display the formulas, get the radius, calculate the area and the perimeter, function should return the values through the output perimeters.
3) void displayCircle( double radius, double area, double perimeter ); // display the all the values in a tabular format.
4) void Rectangle( double *length, double *width, double *area, double *perimeter ); // display the formulas, get the length and the width, calculate the area and the perimeter, function should return the values through the output perimeters.
5) void displayRectangle( double length, double width, double area, double perimeter ); // display the all the values in a tabular format.

Code:
```#include <stdio.h>

void Circle( double *radius, double *area, double *perimeter );
void displayCircle( double radius, double area, double perimeter );
void Rectangle( double *length, double *width, double *area, double *perimeter );
void displayRectangle( double length, double width, double area, double perimeter */

int main(void)
{
char choice;

do
{
printf("\n\'A\'Circle\n\'B\'Rectangle\n\'C\'Quit :");
fflush(stdin);
scanf("%c", &choice);

switch(choice)
{
case 'A':
case 'a':
/*void Circle( double *radius, double *area, double *perimeter ); */
{
printf("----------Proccessing Circle-----------\n\n");
printf("Perimeter of Circle = 2 * 3.14 * Radius\n\n");

/*void displayCircle( double radius, double area, double perimeter );*/

printf("----------------Results----------------\n\n");
printf("\nPerimeter of circle is %.1f", 2 * 3.14 * radius);
printf("\n\n------------------------------------------");
break;
}

case 'B':
case 'b':

/*void Rectangle( double *length, double *width, double *area, double *perimeter ); */

{
printf("----------Proccessing Rectangle-----------\n\n");
printf("Area of Rectangle = Length * Width\n");
printf("Perimeter of Rectangle = 2*Length + 2*Width \n\n");
float length, width;
printf("Enter the Length :");
scanf("%f", &length);
printf("Enter Width :");
scanf("%f", &width);

/*void displayRectangle( double length, double width, double area, double perimeter */

printf("----------------Results----------------\n\n");
printf("\nWidth is %.1f",width);
printf("\nLength is %.1f",length);
printf("\nArea of rectangle is %.1f", length * width);
printf("\nPerimeter of rectangle is %.1f", 2 * (length + width));
printf("\n\n------------------------------------------");
break;
}

default :
printf("\nInvalid choice");
}
}while(choice != 'c' && choice != 'C');

return 0;
}```

2. You have all of the function prototypes. Start by writing functions that match those. Then pass them what they need. Try that, and post your attempt.

Quzah.

3. can u give like a example because i have no idea what you mean by that bc i was sick and missed that lesson unfortunately :/

4. An example of what?
Code:
```/*void DisplayMenu (void) ;
void Circle( double *radius, double *area, double *perimeter );
void displayCircle( double radius, double area, double perimeter );
void Rectangle( double *length, double *width, double *area, double *perimeter );
void displayRectangle( double length, double width, double area, double perimeter */```
Make all of those functions. Like so:
Code:
```void myfunction( void )
{
printf( "this function, named myfunction, returns void, takes no arguments\n" );
}```
Quzah.

5. kk thanks ill give it a try

6. Originally Posted by 123456tacos
can u give like a example because i have no idea what you mean by that bc i was sick and missed that lesson unfortunately :/
Y'know what... they have this totally amazing thing, been around for quite a while too... It's called a TextBook... They're litterally filled with information about various topics and most of it is highly informative... Heck, I bet you could even learn to programm in C from one of those!

Missing a lesson is not an excuse.

7. Originally Posted by quzah
An example of what?
Code:
```/*void DisplayMenu (void) ;
void Circle( double *radius, double *area, double *perimeter );
void displayCircle( double radius, double area, double perimeter );
void Rectangle( double *length, double *width, double *area, double *perimeter );
void displayRectangle( double length, double width, double area, double perimeter */```
Make all of those functions. Like so:
Code:
```void myfunction( void )
{
printf( "this function, named myfunction, returns void, takes no arguments\n" );
}```
Quzah.
anyways thanks for the help i figured it out