help i am a beginner and i need help with my final program.
i beleive i have everything set but i am not sure how to write the function.
i want the function to add up all of the rides and give a grand total but i can not get it to add all the hides.
]//christine gershen
//taxi cab ride
// Midterm
#include <iostream> // required to perform C++ stream I/O
#include <string> //requied to perform string varibles
#include <iomanip> //requied to perform parameterized stream manipulators
using namespace std; // for accessing C++ Standard Library members
double calculate ( double change);
double total; //storge the total rides
int main() //requied for every program;should return integer result code
{
int length; //storge the length of the ride
double first; // storges total for only on ride
char response='y'; //storge for response of another ride
while (response!='n' && response!='N')
{
cout<<"Please enter the length of the trip:";
cin>>length;
if (length<0)
{
cout<<"Please enter a length greater than -1:"<<endl<<endl;
}
else
if (first = length * 1.85 + 2.50)
{
cout<< "$" << first << fixed << setprecision(2)<<endl<<endl;
}
cout<<"would you like to take another trip (y = yes, n = no)?";
cin>>response;// output response
cout<<endl;//add space to make easier to read
} //end while
calculate(length);
if (response='n')
{
cout<< "Total: $" << total << fixed << setprecision(2)<<endl<<endl;
}
return 0; // indicate that program ended successfully
} // end function main
double calculate ( double change)
{
return change * 1.85 + 2.50;
change=+total;
}