Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1) Write a function float computeArea (int *v1, int *v2, int shape) that computes the area of four basic geometric entities. The geometric entity
1) Write a function float computeArea (int *v1, int *v2, int shape) that computes the area of four basic geometric entities. The geometric entity will be identified by the argument shape which is 1 for triangle, 2 for square/rectangle and 3 for circle. The arguments v1 and v2 are pointers to the two arguments defining the shape. For circle v1 is a pointer to the diameter of the circle, v2 is null, for rectangle/square, v1 and v2 are pointers to the height and width for triangle v1 is a pointer to the the base and v2 points to the height of the triangle. 2) Write a function that accepts a string and a character as input and returns the number of times the character given as the second argument appears in the string: int numTimesAppears (char *mystring, char ch) If mystring is ". " and ch 'o' are passed as arguments the function should return 2. A template c file that can be used to start the development of your functions is provided.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started