Computing coursework project

Hi guys, basically for my computing coursework I am creating an application in C++ that displays guitar chords (as arrays). I cannot get my code to work and I think it is because each of my procedures, which are the levels of difficulty of each chord selected by the user, do not give a return value. I'm unsure of what to make it return, all I want to do is display the array the user selects. Here is a snippet of my code; the declarations, main and first procedure (easy). Can anybody suggest what I need to return?
Thankyou

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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
 
#include <iostream>
#include <math.h>
#include <Windows.h>
using namespace std;

int difficulty;
int chord_type;
int chord_letter;
char chord[5][7];

int easy(char chord[5][7]);
int medium(char chord[5][7]); 
int hard(char chord[5][7]);
int main()
{
	cout << "Please choose a difficulty:" << endl << "1:Easy" << endl << "2:Medium" << endl << "3:Hard" << endl;
	cin >> difficulty;

	if (difficulty == 1)
	{
		easy(chord);	
	}
	if (difficulty == 2) 
	{
		medium(chord);
	}
				
	if (difficulty == 3)
	{
		hard(chord);
	}

Sleep(400000);
}

int easy()
{
	cout << "Please input Chord Type:" << endl << "Major:1" << endl << "Minor:2" << endl;
	cin >> chord_type;
	if (chord_type == 1)
	{
			cout << "Please enter the number of the chord letter you wish to select" << endl;
			cout << "A:1" << endl << "C:2" << endl << "D:3" << endl << "E:4" << endl << "G:5" << endl << "F:6" << endl;
			cin >> chord_letter;
			if (chord_letter == 1)
			{
				char A_Major_Open[5][7] = {		
					{' ', 'E', 'A', 'D', 'G', 'B', 'e' },
					{'0', 'X', '0', ' ', ' ', ' ', '0' },
					{'1', ' ', ' ', ' ', ' ', ' ', ' ' },
					{'2', ' ', ' ', '1', '2', '3', ' ' },
					{'3', ' ', ' ', ' ', ' ', ' ', ' ' } };		

					for (int string_letter = 0; string_letter < 5; ++string_letter)
					{

						for (int note = 0; note < 7; ++note)
						{
							cout << A_Major_Open[string_letter][note] << " ";
						}
						cout << endl;
					}
				
			}
			else
			{
				if (chord_letter == 2)
				{
					char C_Major_Open[5][7] = {
					{' ', 'E', 'A', 'D', 'G', 'B', 'e'},
					{'0', 'X', ' ', ' ', '0', ' ', '0' },
					{'1', ' ', ' ', ' ', ' ', '1', ' '},
					{'2', ' ', ' ', '2', ' ', ' ', ' ' },
					{'3', ' ', '3', ' ', ' ', ' ', ' ' } };			
					
					for (int string_letter = 0; string_letter < 5; ++string_letter)
					{
						for (int note = 0; note < 7; ++note)
						{
							cout << C_Major_Open[string_letter][note] << " ";
						}
						cout << endl;
					}
				}
				else
				{
					if (chord_letter == 3)
					{
						char D_Major_Open[5][7] = { 
							{' ', 'E', 'A', 'D', 'G', 'B', 'e' },
							{'0', 'X', 'X', '0', ' ', ' ', ' ' },
							{'1', ' ', ' ', ' ', ' ', ' ', ' ' },
							{'2', ' ', ' ', ' ', '1', ' ', '2' },
							{'3', ' ', ' ', ' ', ' ', '3', ' ' } };			

							for (int string_letter = 0; string_letter < 5; ++string_letter)
							{
								for (int note = 0; note < 7; ++note)
								{
									cout << D_Major_Open[string_letter][note] << " ";
								}
								cout << endl;
							}
					}
					else
					{
						if (chord_letter == 4)
						{
							char E_Major_Open[5][7] = { 
								{' ', 'E', 'A', 'D', 'G', 'B', 'e' },
								{'0', '0', ' ', ' ', ' ', '0', '0' },
								{'1', ' ', ' ', ' ', '1', ' ', ' ' },
								{'2', ' ', '2', '3', ' ', ' ', ' ' },
								{'3', ' ', ' ', ' ', ' ', ' ', ' ' } };		
								
								for (int string_letter = 0; string_letter < 5; ++string_letter)
								{
									for (int note = 0; note < 7; ++note)
									{
										cout << E_Major_Open[string_letter][note] << " ";
									}
									cout << endl;
								}
						}
						else
						{
							if (chord_letter == 5)
							{
								char G_Major_Open[5][7] = { 
									{' ', 'E', 'A', 'D', 'G', 'B', 'e' },
									{'0', ' ', ' ', '0', '0', '0', ' ' },
									{'1', ' ', ' ', ' ', ' ', ' ', ' ' },
									{'2', ' ', '1', ' ', ' ', ' ', ' ' },
									{'3', '2', ' ', ' ', ' ', ' ', '3' } };	
	
									for (int string_letter = 0; string_letter < 5; ++string_letter)
									{

										for (int note = 0; note < 7; ++note)

										{
											cout << G_Major_Open[string_letter][note] << " ";

										}
										cout << endl;
									}
							}
							else
							{
								if (chord_letter == 6)
								{
									char F_Major_Open[5][7] = {
										{' ', 'E', 'A', 'D', 'G', 'B', 'e' },
										{'0', 'X', 'X', ' ', ' ', ' ', ' ' },
										{'1', ' ', ' ', ' ', ' ', '1', '1' },
										{'2', ' ', ' ', ' ', '2', ' ', ' ' },
										{'3', ' ', ' ', '3', ' ', ' ', ' ' } };	

										for (int string_letter = 0; string_letter < 5; ++string_letter)
									{

										for (int note = 0; note < 7; ++note)

										{
											cout << F_Major_Open[string_letter][note] << " ";

										}
										cout << endl;
									}

								}
								else
								{
								cout << "Invalid number" << endl;
								}
							}
						}
					}
				}
			}
	}
	else 
	{
		if (chord_type == 2)
		{
			cout << "Please pick a chord letter" << endl << "A:1" << endl << "D:2" << endl << "E:3" << endl;
			cin >> chord_letter;
			if (chord_letter == 1)
			{ 
				char A_Minor_Open[5][7] = {
					{' ', 'E', 'A', 'D', 'G', 'B', 'e' },
					{'0', 'X', '0', ' ', ' ', ' ', '0' },
					{'1', ' ', ' ', ' ', ' ', '1', ' ' },
					{'2', ' ', ' ', '2', '3', ' ', ' ' },
					{'3', ' ', ' ', ' ', ' ', ' ', ' ' } };
					for (int string_letter = 0; string_letter < 5; ++string_letter)
					{
						for (int note = 0; note < 7; ++note)
						{
							cout << A_Minor_Open[string_letter][note] << " ";
						}
						cout << endl;
					}
			}
			else
			{
				if (chord_letter = 2)
				{
					char D_Minor_Open[5][7] = {
						{' ', 'E', 'A', 'D', 'G', 'B', 'e' },
						{'0', 'X', 'X', '0', ' ', ' ', ' ' },
						{'1', ' ', ' ', ' ', ' ', ' ', '1' },
						{'2', ' ', ' ', ' ', '2', ' ', ' ' },
						{'3', ' ', ' ', ' ', ' ', '3', ' ' } };
						for (int string_letter = 0; string_letter < 5; ++string_letter)
						{
							for (int note = 0; note < 7; ++ note)
							{
								cout << D_Minor_Open[string_letter][note] << " ";
							}
							cout << endl;
						} 
				}
				else 
				{
					if (chord_letter == 3)
					{
						char E_Minor_Open[5][7] = {
							{' ', 'E', 'A', 'D', 'G', 'B', 'e' },
							{'0', '0', ' ', ' ', ' ', ' ', ' ' },
							{'1', ' ', ' ', ' ', '1', ' ', ' ' },
							{'2', ' ', '2', '3', ' ', ' ', ' ' },
							{'30', ' ', ' ', ' ', ' ', ' ', ' ' } };
							for (int string_letter = 0; string_letter < 5; ++string_letter)
							{
								for (int note = 0; note < 7; ++ note)
								{
									cout << E_Minor_Open[string_letter][note] << " ";
								}
								cout << endl;
							}
					}
					else
					{
						cout << "Invalid number" << endl;
					}
				}
			}
		}
		else
		{
			cout << "Invalid number" << endl;
		}
	}
}
Last edited on
Topic archived. No new replies allowed.