Thread: C++ help
View Single Post
Old 09-30-2012, 03:19 PM   PM User | #2
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,042
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
Well you have the same code duplicated several times in your function, this is bad. You can re-structure the code so that isn't the case and it will also reduce the complexity of the code. That might make it easier to debug not to mention the amount of code will go down significantly.

I would structure it like this:
  1. Get user input and set destination variables based on input
  2. Based on destination determine initial costs
  3. Calculate if any discounts apply
  4. Apply discounts
  5. Display results

You should apply the 6 day discount and then you would apply the early reservation discount.
__________________
OracleGuy
oracleguy is offline   Reply With Quote