Hi, i received this homework assignment and need some help. I need to create an iTunes database that can hold 10 song/artist/album records as well as allow the user to change the song/artist/album. This is what i have so far. I dotn understand functions very well and know I need some but I dont know how to create them. Any help would be great. Thanks
#include <iostream>
#include <string>
using namespace std;
//Arrays with the song name, artist, and album
//array has 10 elements ranging from 0 to 9
string songName[10];
string artistName[10];
string albumName[10];
//start of main
int main()
{
//fill the arrays
songName[ 0 ] = "Octavarium";
artistName [ 0 ] = "Dream Theater";
albumName [ 0 ] = "Octavarium";
I dotn understand functions very well and know I need some but I dont know how to create them
i assumed he is new to functions, which means he has a limited knowledge of how to use them, therefore my question.
for dan: on the other hand since you defined global variables (personally i avoid them) your functions do not really need any arguments, if you declare them within main, then all you should need to do is return the string in the array you want to change song[i] into the changing value, so you would do
song[i] = changesongname(song[i]);
and so on. that is one of the ways for you to accomplish this.
this is what i came up with to change the song name, not sure whats wrong with it.
voidchangesongName(string songtoChange)
{
int x;
string "newSong";
cout << endl << "Please enter what song you'd like to change" << x;
cin >> songName[x];
cout << endl << "Please enter the new song name" << "newSong" ;
cin >> "newSong";
songName[ songtoChange ] = "newSong";