Program: Switch-Case decisions to count up different input values



Code below:

// Switch-Case Count Votes - Phil Gardner

#include <iostream>    // Program will be using keyboard and screen

using namespace std;    // Will be using standard identifiers cin, cout, endl

int main()
{
    int pizzaVotes = 0;
    int curryVotes = 0;
    int noodleVotes = 0;

    // Type in a letter for each vote and count total votes for each person
    char choice;
    do
    {
        cout << "Type in a choice: p c n ( or * to quit )" << endl;

        cin >> choice;

        switch ( choice )
        {
            case 'p': case 'P':    pizzaVotes++;    break;

            case 'c': case 'C':    curryVotes++;    break;

            case 'n': case 'N':    noodleVotes++;   break;

        }  // end of switch decision

    } while ( choice not_eq '*' );  // Typing * terminates the loop

    // Display the results after all choices have been typed in
    cout << endl << "RESULTS TIME..." << endl;

    cout << "Pizza... " << pizzaVotes << endl;

    cout << "Balti-Curry... " << curryVotes << endl;

    cout << "Thai-Noodles... " << noodleVotes << endl;

    return 0;
}