Explore BrainMass
Share

C Language: User defined functions

This content was STOLEN 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
double CalculateAreaCir(int radius);

© BrainMass Inc. brainmass.com October 25, 2018, 10:07 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.19
See Also This Related BrainMass Solution

Input and Output Processing in C Language

Can you please help me answer the following study question? Thanks.

How is the input and output processing structured in the C language? How can you display some combination of words and numbers on the computer's screen? How to get information from a keyboard to be used in your program? What are Output Format characters?

View Full Posting Details