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
|
#include <iostream>
#include <string>
using namespace std;
struct MusicTrack{
string artist;
string genre;
string trackLength;
string format;
string title;
};
void getTracks(MusicTrack[], int SIZE);
int main(){
const int SIZE=3;
MusicTrack info[SIZE]={{"Beyonce", "rock", "65:22", "digital", "lemonade"},
{"Sylvan Esso", "epop", "6:01", "digital", "Kick Jump Twist"},
{"Paul Simon", "folk", "2:01", "vinyl", "7 O'Clock News/Silent Night"}};
getTracks(info, SIZE);
}
void getTracks(MusicTrack temp[], int SIZE){
temp=new MusicTrack[SIZE];
for (int i=0; i<SIZE; i++){
cout<<temp[i].artist<<", "<<temp[i].genre<<", "
<<temp[i].trackLength<<", "<<temp[i].format<<", "
<<temp[i].title<<endl<<endl;
}
}
|