Explore BrainMass
Share

# C Language: User defined functions

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

Using C visual express write a function that:

// gets an integer from the user and returns it
// make 3 calls to this function:
// 1.. To get the radius of the circle from the user and return it to main
// 2.. To get the length of the rectangle from the user and return it to main
// 3.. To get the width of the rectangle from the user and return it to main
(Hint: you can prompt from the main function BEFORE you call your function. You do NOT need to prompt from inside this function)
int GetInt(void);

// takes one arguments, the length of the square returns the area
int CalculateAreaRec(int length, int width);

// takes one argument, the radius of the circle and returns the area

https://brainmass.com/computer-science/c/c-language-user-defined-functions-599165

#### Solution Preview

Dear Student,
You can include the functions in ...

#### Solution Summary

The solution illustrates three user defined functions.

First getting an integer, three examples are used,
// 1.. To get the radius of the circle from the user and return it to main
// 2.. To get the length of the rectangle from the user and return it to main
// 3.. To get the width of the rectangle from the user and return it to main

Then two complicated functions to calculate the area of a square and to calculate the area of a circle are provided.

\$2.19