Help with Music arrangement database (iTunes-like)
Nov 4, 2011 at 11:58pm UTC
I'm supposed to "construct an iTunes-like database to hold at least 10 song/artist/album records."
This is what I have 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
#include <iostream>
#include <string>
using namespace std;
int printMenu( );
void printDatabase( );
void changeSong( );
void changeArtist( );
void changeAlbum( );
int operation;
//database
string Song[10];
string Artist[10];
string Album[10];
int main()
{ //start main****
{
Song[1] = "Combination" ;
Artist[1] = "Aerosmith" ;
Album[2] = "Rocks" ;
}
{
Song[2] = "Lonely" ;
Artist[2] = "Akon" ;
Album[2] = "Trouble" ;
}
{
Song[3] = "Nightclub" ;
Artist[3] = "Birdman" ;
Album[3] = "Pricele$$" ;
}
{
Song[4] = "You" ;
Artist[4] = "Candlebox" ;
Album[4] = "Candlebox" ;
}
{
Song[5] = "Mosh" ;
Artist[5] = "Eminem" ;
Album[5] = "Encore" ;
}
{
Song[6] = "Changes" ;
Artist[6] = "Godsmack" ;
Album[6] ="Faceless" ;
}
{
Song[7] = "Fuel" ;
Artist[7] = "Metallica" ;
Album[7] = "Reload" ;
}
{
Song[8] = "Lithium" ;
Artist[8] = "Nirvana" ;
Album[8] = "Nevermind" ;
}
{
Song[9] = "Gasoline" ;
Artist[9] = "Seether" ;
Album[9] = "Disclamer" ;
}
{
Song[10] = "Mudshovel" ;
Artist[10] = "Staind" ;
Album[10] = "Dysfunction" ;
}
printDatabase ();
while (true )
{operation = printMenu ();
cout << operation << endl;
}
} //end main ****
// function to print a menu and get the user choice
int printMenu( )
{
int x;
cout << " _________________________________ " << endl;
cout << " | |" << endl;
cout << "|| 1. Print Entire Database |" << endl;
cout << "|| 2. Change Song |" << endl;
cout << "|| 3. Change Artist |" << endl;
cout << "|| 4. Change Album |" << endl;
cout << "|| 0. Exit Program |" << endl;
cout << "||_________________________________|" << endl;
cout << "||||||||||||||||||||||||||||||||||| " << endl;
cout << endl;
cout << "Please enter choice: " ;
cin >> x;
return x;
switch (x) //choices
{
case '0' : return 0;
case '1' :
printDatabase( );
break ;
case '2' :
changeSong ( );
break ;
case '3' :
changeArtist ( );
break ;
case '4' :
changeAlbum ( );
break ;
}
}
I get:
1 2 3 4 5 6 7 8 9 10 11 12
C:\Users\Ben\AppData\Local\Temp\cck8X9uI.o: In function `main':
Lab5.cpp:72: undefined reference to `printDatabase(void)'
C:\Users\Ben\AppData\Local\Temp\cck8X9uI.o: In function `printMenu(void)':
Lab5.cpp:104: undefined reference to `printDatabase(void)'
Lab5.cpp:109: undefined reference to `changeSong(void)'
Lab5.cpp:114: undefined reference to `changeArtist(void)'
Lab5.cpp:119: undefined reference to `changeAlbum(void)'
collect2: ld returned 1 exit status
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
Nov 5, 2011 at 1:00am UTC
You didn't give your functions any definitions?
Nov 5, 2011 at 1:34am UTC
how do I do that?
Nov 5, 2011 at 1:55am UTC
The same way you did for Printmenu. But as you said you are not finished yet so maybe you've yet to define them
Topic archived. No new replies allowed.