Explore BrainMass

C Language: User defined functions

Not what you're looking for? Search our solutions OR ask your own Custom question.

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

Â© BrainMass Inc. brainmass.com December 16, 2022, 11:08 am ad1c9bdddf
https://brainmass.com/computer-science/c/c-language-user-defined-functions-599165

Solution Preview

Dear Student,
Please find the solution attached.
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.49