[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  Programming
. -> [Folder]  General
. . -> [Subject]  Please help C++

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Please help C++

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by SteelDog37   (4 posts)  [Biography] bio
Date Thu 03 Nov 2011 01:00 AM (UTC)  quote  ]
Message
This is what I have so far....

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
{char discount;
int age;
double price;
cout << "How old are you? ";
cin >> age;
if(age > 17)
price = 8;
else
price = 6;
cout << "Do you have a discount coupon(y/n)?\n";

}

I can not figure out why this will not compile and run? Need some help? My question to the problem is below..

Design a program that ask a user for their age and whether or not they have a discount coupon. If they are over the age of 17 then the ticket price is $8.00. If they are not over 17 then the ticket price is $6.00. If they input y for coupon then the ticket price discount is 25%.
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Reply #1 on Thu 03 Nov 2011 01:28 AM (UTC)  quote  ]
Message
SteelDog37 said:
I can not figure out why this will not compile and run? Need some help? My question to the problem is below..

1. Paste any errors you have. If you don't paste the errors, we don't know where to look.

2. There's a { before char discount that shouldn't be there.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by SteelDog37   (4 posts)  [Biography] bio
Date Reply #2 on Thu 03 Nov 2011 01:57 AM (UTC)  quote  ]
Message
Thanks Twisol sorry for not posting or pasting the error.
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Reply #3 on Thu 03 Nov 2011 01:58 AM (UTC)  quote  ]
Message
No problem.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


745 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]