Text: Intro to Programming in C Program 4 (Smaller Program)
Assignment Purpose: To compile, build, and execute an interactive program using functions from stdio.h (printf and scanf), simple math in C, conditions, a simple while loop, and programmer-defined functions.
#define _CRT_SECURE_NO_WARNINGS // for Visual Studio compiler
#include <stdio.h> // for printf and scanf
#include <ctype.h> // for tolower or toupper
Instructions:
For this assignment, you will begin to implement a menu-driven program that simulates an online coffee shop. Program 4 is the start of the larger Program 5.
The program will welcome the user with a friendly message. The user will be presented with a list of options. The user will select from the options below:
- 'S' to view the snacks and beverages available for purchase
- 'O' to order coffee or a snack
- 'B' to view your account balance
- 'A' to add money to your account
- 'Q' to quit
The user may continue to select the options until entering 'Q' to quit. You may use the tolower or toupper function from ctype.h. For this assignment, you will only implement the menu and display a message for each option. The full implementation of the options will be done in Program 5.
Use the following programmer-defined functions. DO NOT modify the functions:
- void Greeting(); // welcome the user to the coffee shop
- char OptionList(); // display the program options and get the user's selection
- void ProcessOption(char choice); // input: the user's choice (S, O, B, A, Q) // print a message based on the choice
- void DisplayMenu(); // display beverage/food options and prices