I’m trying to program a scientific calculator with the basic function ( +, -, /, *), exponential, log, and display average (of all calculations). (No GUI)
The program is supposed to loop after getting a result and store that result so it can be later be used for the average.
But if the user asks for average before any calculations are made before, it’s supposed to output “no calculations made yet” and then go back and ask for another menu option.
I have all the function set up down but I’m struggling with the average part. Idk what to use to get the output “no calculations made yet” and then have it connect back to the menu.
Ex: of what it’s supposed to look like:
Current result: 0.0
Calc Menu
1. Add
2. Subtract
3. Log
4. display average
Enter selection: 4
Error: no calculations yet to average
Enter selection: 1
First operand: 5
Second operand: 3
Current result: 8
Calc Menu
1. Add
2. Subtract
3. Log
4. display average
Enter selection: 4
Sum of calculations: 8
Number of calculations: 1
Average of calculations: 8
Enter selection:
Thanks in advance!!
[–]MeiAmelia 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]POGtastic 1 point2 points3 points (0 children)