Same function runs every time

Every time I run this program, the function Amaj() runs, no matter what I enter. I can't figure out what I've done wrong here, though I'm sure it's something simple. lol

Also, when the program returns to begin:, it doesn't even give me the chance to enter x or y. Here's what I've got so far:
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
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
//The notes array is used in the functions to list the notes in each scale.
	string notes[12] = {"G#/Ab", "A", "A#/Bb", "B", "C", "C#/Db", "D", "D#/Eb", "E", "F", "F#/Gb", "G"};
	
	void Amaj()
	{
		cout << "A MAJOR\n";
		cout << "  I: " << notes[1] << "\n";
		cout << " II: " << notes[3] << "\n";
		cout << "III: " << notes[5] << "\n";
		cout << " IV: " << notes[6] << "\n";
		cout << "  V: " << notes[8] << "\n";
		cout << " VI: " << notes[10] << "\n";
		cout << "VII: " << notes[0] << "\n";
	}

	void Bmaj()
	{
		cout << "B MAJOR\n";
		cout << "  I: " << notes[3] << "\n";
		cout << " II: " << notes[5] << "\n";
		cout << "III: " << notes[7] << "\n";
		cout << " IV: " << notes[8] << "\n";
		cout << "  V: " << notes[10] << "\n";
		cout << " VI: " << notes[0] << "\n";
		cout << "VII: " << notes[2] << "\n";
	}

	void Cmaj()
	{
		cout << "C MAJOR\n";
		cout << "  I: " << notes[4] << "\n";
		cout << " II: " << notes[6] << "\n";
		cout << "III: " << notes[8] << "\n";
		cout << " IV: " << notes[9] << "\n";
		cout << "  V: " << notes[11] << "\n";
		cout << " VI: " << notes[1] << "\n";
		cout << "VII: " << notes[3] << "\n";
	}

	void Dmaj()
	{
		cout << "D MAJOR\n";
		cout << "  I: " << notes[6] << "\n";
		cout << " II: " << notes[8] << "\n";
		cout << "III: " << notes[10] << "\n";
		cout << " IV: " << notes[11] << "\n";
		cout << "  V: " << notes[1] << "\n";
		cout << " VI: " << notes[3] << "\n";
		cout << "VII: " << notes[5] << "\n";
	}

	void Emaj()
	{
		cout << "E MAJOR\n";
		cout << "  I: " << notes[8] << "\n";
		cout << " II: " << notes[10] << "\n";
		cout << "III: " << notes[0] << "\n";
		cout << " IV: " << notes[1] << "\n";
		cout << "  V: " << notes[3] << "\n";
		cout << " VI: " << notes[5] << "\n";
		cout << "VII: " << notes[7] << "\n";
	}

	void Fmaj()
	{
		cout << "F MAJOR\n";
		cout << "  I: " << notes[9] << "\n";
		cout << " II: " << notes[11] << "\n";
		cout << "III: " << notes[1] << "\n";
		cout << " IV: " << notes[2] << "\n";
		cout << "  V: " << notes[4] << "\n";
		cout << " VI: " << notes[6] << "\n";
		cout << "VII: " << notes[8] << "\n";
	}

	void Gmaj()
	{
		cout << "G MAJOR\n";
		cout << "  I: " << notes[11] << "\n";
		cout << " II: " << notes[1] << "\n";
		cout << "III: " << notes[3] << "\n";
		cout << " IV: " << notes[4] << "\n";
		cout << "  V: " << notes[6] << "\n";
		cout << " VI: " << notes[8] << "\n";
		cout << "VII: " << notes[10] << "\n";
	}
int main(int argc, char *argv[])
{
	string x;//x is used to determine which scale to show.
	string y;//y is used to determine the key the scale shown is in.
	int i;

begin://If the user decides not to quit, the program returns here.
	cout << "Which Scale would you like? ";
	getline(cin, x);
	if (x=="major" || "Major" || "maj" || "MAJ" || "Maj")
	{
		cout << "Which Key would you like? ";
		getline(cin, y);
		if (y=="A" || "a" )
		{
			Amaj();
		}
		else if (y=="B" || "b")
		{
			Bmaj();
		}
		else if (y=="C" || "c")
		{
			Cmaj();
		}
		else if (y=="D" || "d")
		{
			Dmaj();
		}
		else if (y=="E" || "e")
		{
			Emaj();
		}
		else if (y=="F" || "f")
		{
			Fmaj();
		}
		else if (y=="G" || "g")
		{
			Gmaj();
		}
		else 
		{
			cout << "Invalid Selection\n";
		}
	}
	else 
	{
		cout << "Invalid Selection\n";
	}
	cout << "Exit?\n";
	cout << "1) Yes\n";
	cout << "2) No\n";
	cin >> i;
	switch (i)
	{
	case 1:
		goto end;
		break;
	case 2:
		goto begin;
		break;
	default:
		cout << "Invalid selection\n";
		break;
	}
end:
	return 0;
}


Thanks in advance for any and all help everybody.
This does not do what you think it does:

 
if (x=="major" || "Major" || "maj" || "MAJ" || "Maj")


You need

 
if( x == "major" || x == "Major" ) // etc 


(you have this type of error in many places)
And use fflush(stdin)...
1
2
3
4
5
6
...
begin://If the user decides not to quit, the program returns here.
       fflush(stdin);
	cout << "Which Scale would you like? ";
	getline(cin, x);
...
Ah, ok, thanks. I'll try these. Ok, that worked. Thanks ya'll.
Last edited on
Topic archived. No new replies allowed.