Please help me construct this program

I'm writing a basic program to help me with DJing. I only took one class "Intro to Programming" about a year ago. What I have is numerous songs with different keys assigned to them.

For instance, a song called "Learn to Fly" is associated with the key of "D". A song called "Get Loose" is associated with the key of "G#". A song called "LRAD" is associated with the key of "F".

What I want is this: to be able to input EITHER key or song and then cout a list of all songs with that key or a similar key.

So, if I input the character "D" I want to display all songs in the key of D as well as harmonic keys such as G, A, and Bm. ALSO, if I input Learn to Fly, I want all songs in the key of D to appear as well as G, A, and Em.

As you can see from the code, I can search only by key. If I did it the long way, I could redo this for every song by name. But I'm hoping you guys you a faster way for me to search by song and have all the results displayed.

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
#include <iostream>
#include <string>

using namespace std;

int main()
{

	string input;
	string D;
	string Fm;
	cout << "Enter a key or song name: ";
	cin >> input;
	if (input == "D")
	{
		cout << "Songs harmonic to D, includes G, A, Bm: " << endl << endl <<
			"Learn to Fly, Inpetto (D) " << endl <<
			"Stranger, Chris Lake (D) " << endl <<
			"Boneless (A)" << endl;

			;
	}
	if (input == "Fm")
	{
		cout << "Songs harmonic to Fm, includes Bbm/A#m, Cm, Dm, Bb/A#: " << endl << endl <<
			"Five Hours (Fm)" << endl <<
			"Cannonball, Showtek (Fm)" << endl <<
			"Devil's Den (Fm)" << endl <<
			"Virus, Martin Garrix (Fm)" << endl <<
			"Get Loose (Fm)" << endl <<
			"Fight Club, Eric Mendoza  (Fm)" << endl <<
			"Go, Firebeatz (Fm)" << endl <<
			"We Make it Bounce (A#) " << endl <<
			"Saksata (Bbm)" << endl <<
			"FKN INSANE (Cm)" << endl <<
			"One, SHM (Dm)" << endl <<
			"Boy Oh Boy (Cm/110 BPM)" << endl <<
			"Drop It (C) " << endl;
		

	}



	system ("pause");
	return 0;
}

Last edited on
closed account (48T7M4Gy)
In the long run you should consider using arrays, vectors or the best for this job, maps. The tutorials here on this site give good intros and samples.

A simple addition to what you have so far will not be so simple and your time in fudging it would be better spent looking at using
containers
.

You could look at the idea of adding and deleting music too instead of hard coding the data.

PS if you are hellbent on continuing this way then maybe just reverse your data and cut/paste a repeat. It's worth doing just to see how cumbersome it is. Once that's in you search on the title and it will spit out the answer.

Last edited on
Topic archived. No new replies allowed.