C programming assignment
(Homework should be turned in on Canvas only, NOT via email unless you cannot access Canvas)
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 Professor Ken 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.
A main file is provided as an example for testing your functions.
The files are in the shared folder: .
What to submit:
1. Submit these functions in a single .c file named as your FirstLastNameRedID_Hw1.c (example:
FirstLastName888888888_Hw1.c).
Please submit the homework file in the above specified format as a .c file, AND
Also submit a pdf, word file, or other file format with all your code and a copy of the output as a screenshot.
Any non-C statements (example: problem statement or your name) in your “NameRedID_Hw1.c” file, should be commented using standard C comments.
Note: Any uncommented non-C statements result in compile errors.
You may only submit files of type .c , .txt, .doc, .docx, .pdf
ALSO include the main function and any other functions needed to test your program.
