Switch - ; cin >> feedGrade; switch...

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 &gt;&gt; feedGrade; switch (feedGrade) { case 'A' : cout &lt;&lt; &quot;30 cents per pound.\n&quot; ; break ; case 'B' : cout &lt;&lt; &quot;20 cents per pound.\n&quot; ; break ; case 'C' : cout &lt;&lt; &quot;15 cents per pound.\n&quot; ; break ; default : cout &lt;&lt; &quot;That is an invalid choice.\n&quot; ; } return 0; }...
View Full Document

Ask a homework question - tutors are online