So I am trying to write a program where you sell tickets. For every 10 tickets you sell the price decreases 50 cents. Right now I have a good start but my loop is not working out correctly.
Line 16 is the issue. When it hits line 16, it enters a loop that decreases the price as long as it's greater then 1, so it just goes straight down to 1.
#include <cstdlib>
#include <iostream>
usingnamespace std;
int main(int argc, char *argv[])
{
int count, minPass, passengers;
float tickPrice, tickStart;
cout << " Enter minimum number of passengers ";
cin >> minPass;
cout << " Enter number of passengers ";
cin >> passengers;
cout << " Enter the starting ticket price ";
cin >> tickStart;
cout << "# Passengers Ticket Price Proft";
for(count = minPass, tickPrice = tickStart ; count <= passengers; count += 10, tickPrice -= 0.5)
cout << "\n" << count <<"\t\t\t"<<"$"<< tickPrice << "\t\t" <<"$"<< count * tickPrice - 2500;
system("PAUSE");
return EXIT_SUCCESS;
}
Looks like it is working pretty well so far, what do you guys think? There is still a couple more elements I need to add so there is a good chance I will be back for more help. Thanks again
Edit: So I am already having a hard time. I need to output the highest profit and the ticket price that generates that profit. But I cant seem to figure out how to output a specific value from the loop. Any help is greatly appreciated.
I think my last post was unclear. I can figure out by looking at the output what the highest profit is but I can figure out how to display that particular output. I have searched around but cant seem to find any info that will help me.