the program i have is running it has the calculations right. but im trying to get the program to display all the numbers of cars entered, total for all cars and average of all cars at the same time when user wants to end program. what do i write?
code:
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main ()
{
double hOurs = 0;
double chrGe = 0;
int userChoice;
cout << "Please enter number of hours parked: ";
cin >> hOurs;
You'll need something like a while loop to wrap around nearly all the code you have. The while loop could get an answer from the user 'Y' or 'N' to 'do they want to continue?', or ' is this the last car?'. And as all that happens you need to create variables to accumulate the individual inputs so you can calculate the number of cars, totals and averages etc.