Posts

Showing posts with the label calculator

C: Modify calculator to catch divide by zero error.

Image
Calculator now catches divide by zero error by testing to see if either user inputs are equal to 0, otherwise it executes the division. Repl: https://replit.com/@pereiradaniel/Calculator-Exponent-function-added Git repo: https://github.com/pereiradaniel/c_programs/blob/master/calc/calc4.c  

C: Calculator with exponent function.

Image
Added exponent function to calculator, with improved messages for user. Repl: https://replit.com/@pereiradaniel/Calculator-Exponent-function-added Git repo: https://github.com/pereiradaniel/c_programs/blob/master/calc/calc3.c  

C: Calculator with main loop repeat.

Image
Calculator program now loops until user quits. Repl: https://replit.com/@pereiradaniel/Calculator-Main-loop-added Git repo: https://github.com/pereiradaniel/c_programs/blob/master/calc/calc2.c  

C: Basic calculator program.

Image
Basic calculator program for possible future improvements. Repl: https://replit.com/@pereiradaniel/Calculator-program Git repo: https://github.com/pereiradaniel/c_programs/blob/master/calc/calc.c  

C: Modify a calculator program to loop until user quits.

Image
Modify the last example in the chapter that implemented a calculator so that the user is given the option to enter y or Y to carry out another calculation, and n or N to end the program. (Note: You’ll have to use a goto statement for this here, but you’ll learn a better way of doing this in the next chapter.) Git repo: https://github.com/pereiradaniel/beginning_c/blob/master/ch3/exercises/3_4/exercise3_4.c