Purchase Solution

C Language: User defined functions

Not what you're looking for?

Ask Custom Question

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);

Purchase this Solution

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.

Solution Preview

Dear Student,
Please find the solution attached.
You can include the functions in ...

Solution provided by:
Education
  • BSc (Hons), University of Colombo - Sri Lanka
  • MEngSc, University of Melbourne
  • Certificate IV in Training & Assessment , Australian Business Council
Recent Feedback
  • "Thank you!"
  • "Thank you."
  • "Thanks a lot for you help and support"
  • "Sorry about the late payment but the assignment was sufficient and appreciated. Good work"
  • "Great description! Thank you for your quick response."
Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.