How would these options in my C++ program be done via an array of structs?

#include <iostream>

using namespace std;

//include protype functions

int main()

{

char choice;

bool terminate = false;

while (!terminate)

{

cout << "WELCOME TO SO-AND-SO BANK!\n\n" << "Please enter an option, are you a:\n\n"

<< "A)Customer\n"

<< "B)Bank Employee\n"

<< "C)Bank Supervisor\n"

<< "D)Quit the application\n\n";

cin >> choice;

switch(choice)

{

case 'a':

case 'A':

cout << "Welcome to So-and-So Bank Customer Services!\n" << "Please enter an option:\n\n";

//Customer options

cout << "A)Functions: Balance Inquiry\n"

<< "B)Deposit Funds\n"

<< "C)Withdraw funds\n"

<< "D)Transfer Funds to another account (like from Checking to Savings or to Credit Card)\n"

<< "E)Anything else that you want to add\n"

<< "F)Quit the application\n\n";

cin >> choice;

switch(choice)

{

case 'a':

case 'A':

break;

case 'b':

case 'B':

break;

case 'c':

case 'C':

break;

case 'd':

case 'D':

break;

case 'e':

case 'E':

break;

case 'f':

case 'F':

cout << "You have chosen to quit, we appreciate your business.";

terminate = true;

break;

default:

cout << "You have entered an invalid option, please try again.\n\n";

break;

}

break;

case 'b':

case 'B':

cout << "Welcome to So-and-So Bank Employee Services!\n" << "Please enter an option:\n\n";

//Cascading customer data

//a.Everything in the Customer Interface, plus

cout << "A)Interface to ADD a new Customer to the Bank\n"

<< "B)Interface to DELETE a Customer from the Bank\n"

<< "C)Search for a Record based on a Name of a Customer (using simple Sequential Search)\n"

<< "D)Quit the application\n\n";

cin >> choice;

switch(choice)

{

case 'a':

case 'A':

break;

case 'b':

case 'B':

break;

case 'c':

case 'C':

break;

case 'd':

case 'D':

cout << "You have chosen to quit, we appreciate your business.";

terminate = true;

break;

default:

cout << "You have entered an invalid option, please try again.\n\n";

break;

}

break;

case 'c':

case 'C':

cout << "Welcome to So-and-So Bank Supervising Services!\n" << "Please enter an option:\n\n";

//Cascading banker and customer data

//a.Everything in Bank Teller Interface, plus

cout << "A)Ability to List Total Number of Customers in Bank\n"

<< "B)Ability to List Total Amount of Money in the Bank\n"

<< "C)Ability to List Total Deposits in a Day\n"

<< "D)Ability to List Total Withdrawals in a Day\n"

<< "E)Ability to see/query detailed LOG of all transactions\n"

<< "F)Quit the application\n\n";

cin >> choice;

switch(choice)

{

case 'a':

case 'A':

break;

case 'b':

case 'B':

break;

case 'c':

case 'C':

break;

case 'd':

case 'D':

break;

case 'e':

case 'E':

break;

case 'f':

case 'F':

cout << "You have chosen to quit, we appreciate your business.";

terminate = true;

break;

default:

cout << "You have entered an invalid option, please try again.\n\n";

break;

}

break;

case 'd':

case 'D':

cout << "You have chosen to quit, we appreciate your business.";

terminate = true;

break;

default:

cout << "You have entered an invalid option, please try again.\n\n";

break;

}

}

return 0;

}

Please edit your post and put the code inside code brackets, use the '#' button to the right. This will format the text, keeping tabs, and will colour it and so on. A lot easier to read.
Sorry.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include <iostream>

using namespace std;
//include protype functions

int main()
{
	char choice;
	bool terminate = false;

	while (!terminate)
	{
		cout << "WELCOME TO SO-AND-SO BANK!\n\n" << "Please enter an option, are you a:\n\n" 
		<< "A)Customer\n" 
		<< "B)Bank Employee\n" 
		<< "C)Bank Supervisor\n" 
		<< "D)Quit the application\n\n";
		cin >> choice;

		switch(choice)
		{
		case 'a':
		case 'A':
		cout << "Welcome to So-and-So Bank Customer Services!\n" << "Please enter an option:\n\n";
		//Customer options
		cout << "A)Functions: Balance Inquiry\n" 
		<< "B)Deposit Funds\n" 
		<< "C)Withdraw funds\n"
		<< "D)Transfer Funds to another account (like from Checking to Savings or to Credit Card)\n"
		<< "E)Anything else that you want to add\n" 
		<< "F)Quit the application\n\n";
		cin >> choice;

		switch(choice)
		{
		case 'a':
		case 'A':
			break;
		case 'b':
		case 'B':
			break;
		case 'c':
		case 'C':
			break;
		case 'd':
		case 'D':
			break;
		case 'e':
		case 'E':
			break;
		case 'f':
		case 'F':
		cout << "You have chosen to quit, we appreciate your business.";
		terminate = true;
			break;
		default:
		cout << "You have entered an invalid option, please try again.\n\n";
			break;
		}
		break;

		case 'b':
		case 'B':
		cout << "Welcome to So-and-So Bank Employee Services!\n" << "Please enter an option:\n\n";
		//Cascading customer data
		//a.Everything in the Customer Interface, plus
		cout << "A)Interface to ADD a new Customer to the Bank\n"
		<< "B)Interface to DELETE a  Customer from the Bank\n"
		<< "C)Search for a Record based on a “Name of a Customer” (using simple Sequential Search)\n"
		<< "D)Quit the application\n\n";
		cin >> choice;

		switch(choice)
		{
		case 'a':
		case 'A':
			break;
		case 'b':
		case 'B':
			break;
		case 'c':
		case 'C':
			break;
		case 'd':
		case 'D':
		cout << "You have chosen to quit, we appreciate your business.";
		terminate = true;
			break;
		default:
		cout << "You have entered an invalid option, please try again.\n\n";
			break;
		}
		break;

		case 'c':
		case 'C':
		cout << "Welcome to So-and-So Bank Supervising Services!\n" << "Please enter an option:\n\n";
		//Cascading banker and customer data
		//a.Everything in Bank Teller Interface, plus
		cout << "A)Ability to List Total Number of Customers in Bank\n"
		<< "B)Ability to List Total Amount of Money in the Bank\n"
		<< "C)Ability to List Total Deposits in a Day\n"
		<< "D)Ability to List Total Withdrawals in a Day\n"
		<< "E)Ability to see/query detailed LOG of all transactions\n"
		<< "F)Quit the application\n\n";
		cin >> choice;

		switch(choice)
		{
		case 'a':
		case 'A':
			break;
		case 'b':
		case 'B':
			break;
		case 'c':
		case 'C':
			break;
		case 'd':
		case 'D':
			break;
		case 'e':
		case 'E':
			break;
		case 'f':
		case 'F':
		cout << "You have chosen to quit, we appreciate your business.";
		terminate = true;
			break;
		default:
		cout << "You have entered an invalid option, please try again.\n\n";
			break;
		}
		break;

		case 'd':
		case 'D':
		cout << "You have chosen to quit, we appreciate your business.";
		terminate = true;
		break;

		default:
		cout << "You have entered an invalid option, please try again.\n\n";
		break;
		}

	}
return 0;
}
Topic archived. No new replies allowed.