Switch - cin>> feedGrade switch(feedGrade case'A...

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

View Full Document Right Arrow Icon
// The switch statement in this program uses the "fall through" feature // to catch both uppercase and lowercase letters entered by the user. #include <iostream> using namespace std; int main() { char feedGrade; cout << "Our dog food is available in three grades:\n" ; cout << "A, B, and C. Which do you want pricing for? "
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; cin >> feedGrade; switch (feedGrade) { case 'A' : cout << "30 cents per pound.\n" ; break ; case 'B' : cout << "20 cents per pound.\n" ; break ; case 'C' : cout << "15 cents per pound.\n" ; break ; default : cout << "That is an invalid choice.\n" ; } return 0; }...
View Full Document

This note was uploaded on 04/18/2008 for the course CS 201 taught by Professor Conway during the Fall '07 term at Bowling Green.

Ask a homework question - tutors are online