assignment22 - sprinkles = choice; if( sprinkles ==...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/*Write a program that asks the user to order an ice cream treat. The user selects the type of ice cream, the type of sauce, and wehter or not to add sprinkles.*/ #include <iostream> #include <string> # using namespace std; u int main() { string softserve, topping, sprinkles; string choice; while( sprinkles == "") { if( softserve == "" ) cout << "Do you want chocolate, vanilla or twist?" << endl; if( topping == "") cout << "Hot fudge, chocolate or strawberry sauce?" << endl; if( sprinkles == "") cout << "Do you want sprinkles (yes/no)?" << endl; getline(cin, choice); if( choice == "yes" || choice =="no" )
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: sprinkles = choice; if( sprinkles == "" && topping == "" && softserve !="") if( choice == "hot fudge" || choice =="chocolate" || choice == "strawberry" ) topping = choice; if( sprinkles == "" && topping == "" && softserve =="") if( choice == "chocolate" || choice =="vanilla" || choice == "twist" ) softserve = choice; } if (sprinkles == "yes") cout << "You ordered " << softserve << " ice cream with " << topping << " sauce and sprinkles." << endl; else cout << "You ordered " << softserve << " ice cream with " << topping << " sauce without sprinkles." << endl; }...
View Full Document

This note was uploaded on 01/11/2010 for the course CMPSC 101 taught by Professor Drobish,renee during the Summer '07 term at Pennsylvania State University, University Park.

Ask a homework question - tutors are online