Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The WhatsLeft Function We will be writing a simple program that figures out how many cherries are left. The program will ask the user how
The WhatsLeft Function We will be writing a simple program that figures out how many cherries are left. The program will ask the user how many cherries they bought and how many cherries they have eaten. Then the program will call a function that returns how many cherries are left and the program will display the result. This is a simple program and could all be done in main. However, we want to see how to organize a program using a function and a library so we will add the function declaration and the function implementation in the library as explained. In Questions 2-4, you will be writing the code that would go in the following files. library.cpp library.h main.cpp. For this question we will work in library.h. To Do: Write the function declaration for a function called WhatsLeft. This function takes two float parameters passed by value. amount of fruit purchased (in pounds) amount of fruit eaten (in pounds) The function returns one float. amount of fruit left (in pounds) This declaration would go in the file library.h. You can assume the following code is already in library.h. You will need to add the code listed above
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