Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(int argc, const char * argv[])
- {
- cout.setf(ios::fixed);
- cout.setf(ios::showpoint);
- cout.precision(2);
- char userinput;
- cout << "A packet of candie costs $1.50. You have inserted $0.00. Please insert coins:";
- cin >> userinput;
- if (userinput = 'n')
- {
- userinput = 0.05;
- }
- else if (userinput = 'd')
- {
- userinput = 0.10;
- }
- else if (userinput = 'q')
- {
- userinput = 0.25;
- }
- else if (userinput = 'D')
- {
- userinput = 1.00;
- }
- else
- {
- cout << "'" << userinput << "' is not a valid coin.";
- }
- cout << userinput;
- /*int i;
- for (i = 0; i <= userinput; i++)
- {
- cout << "A packet of candie costs $1.50. You have inserted $" << userinput << ".";
- cout << "Please insert coins: ";
- cin >> userinput;
- userinput = userinput + userinput;
- }*/
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement