Question: This assignment will be in two parts, resulting in several source code files. Do part 1 first, and then do part 2 . Part 1
This assignment will be in two parts, resulting in several source code files. Do part first, and then do part
Part Building a calculator
The purpose of part is to build a "calculator" in C using functions. In particular, I want you to build a calculator with the following functions:
int getNumber This function gets a number from the user and returns it
int getOperator This function get an operator character from the user and returns it
int powerint x int y This function raises x to the power of y ie xy
int bottomint x int y This function returns the floor of the x floor y floor returns the nearest integer value which is less than or equal to the floating point number of x y
int roundedint x int y This returns the closes integer to x y either larger or smaller
Note: Your main should call getNumber twice to get the two numbers, then call getOperator run the value returned by getOperator through a switch statement, and then call the appropriate function. You should print out the equation and the result. This should be in a loop so that you can enter numbers and call functions until the user chooses to exit.
Part Build a module for your calculator.
Once you have completed Part modify your code so that:
all of the functions are now in a c file called
all of the function definitions are in a h file called
Keep the main program from Part but remove the functions.
Make sure your code runs when compiled with the appropriate h file.
Deliverables:
Put Part and Part in two different folders, both of which are in a folder that is appropriately named as per the assignment submission instructions. Each part should have its own Makefile that does the appropriate compilation. Note that for Part the o file for the file should be generated on the first compile, but shouldn't be regenerated with subsequent compiles unless needed.
Upload as a tgz file.
PLEASE NOTE: Several people have contacted me because their assignment uploads as tgz files were "empty". You should be checking your tgz files before you upload them to make sure that they worked.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
