Hi there,
I'm trying to write a program to accept some details about mp3 files, and store them in an array. I am also hoping to process some of the parameters of each entry to the array.
I am trying to create an object of type "Track", and then define a method "createTrack" to define some parameters to describe the Object "Track". This is what I've come up with, but needless to say, it doesn't work! :( If anyone could suggest some adjustments, it would be much appreciated!
#include<iostream>
#include<string>
using namespace std;
using std::string;
class Track{
public:
Track(void);
void time();
void createTrack();
};
void Track::createTrack()
{
string title;
string artist;
float duration;
cout <<"Please enter track title: ";
cin >> title;
cout <<"Please enter track artist: ";
cin >> artist;
cout <<"Please enter track duration in seconds: ";
cin >> duration;
}
void Track:time(int duration)
{
mins = (duration/60);
secs = (duration%60);
cout << "The track time is: " << mins << "minutes and" << secs << "seconds" << endl;
}
int main()
{
for (int i=0; i<5; i++)
{
Track a; //Create a new object of type "Track"
TrackArray[i] = a.createTrack; //Call the "createTrack" method on the object
} //"a" and store it in the array "TrackArray[4]"
TrackArray[1].time; //Call the "time" method on the 1th entry of the array
system("Pause");
return EXIT_SUCCESS;
}