1: // Filename: STUSHELL.CPP
2: // Purpose: Driver for testing the StudentType class
4: #include <iostream>
5: #include <iomanip>
6: #include "stutype.h"
7: #include "menu_h"
8: #include "twopause_h"
10: void DisplayIDInfo(int);
11: void DescribeProgram();
14: int main()
15: {
16: const int INDENT_LEVEL = 20;
17: DisplayIDInfo(INDENT_LEVEL/2);
18: Pause(INDENT_LEVEL);
20: Menu m("Main Menu");
21: m.AddOption("Quit");
22: m.AddOption("Get information");
23: m.AddOption("Establish some students and display their info ...");
25: int menuChoice;
26: do
27: {
28: m.Display();
29: menuChoice = m.Choice();
30: switch (menuChoice)
31: {
32: case 1:
33: cout << endl
34: << setw(INDENT_LEVEL) << ""
35: << "Program is now terminating. "
36: << endl;
37: break;
38: case 2:
39: DescribeProgram();
40: break;
41: case 3:
42: StudentType s;
43: cout << endl;
44: s.Write(20);
45: cout << endl;
46: break;
47: }
49: if (menuChoice != 1)
50: Pause(0);
52: } while (menuChoice != 1);
54: cout << endl;
56: return 0;
57: }
58:
59: void DisplayIDInfo(int indentLevel)
60: // Pre: indentLevel contains a nonnegative integer.
61: // Post: A blank line, and a line containing the programmer's name
62: // have been displayed.
63: {
64: cout << endl;
65: cout << setw(indentLevel) << ""
66: << "This sample program produced by Your_Name_Goes_Here.";
67: cout << endl;
68: }
71: void DescribeProgram()
72: // Pre: none
73: // Post: A program description has been displayed.
74: {
75: cout << endl;
76: cout << "This program is a driver for helping to "
77: << "illustrate the use of a class called " << endl
78: << "StudentType. " << endl;
79: cout << endl;
80: }