Hi all,
Hate C++, but have to do it as a module soooo....
Trying to make a CLI based media player, and I need a MP3, Streamer & CD player... anyway, i'm trying to start on the Mp3 player.
I need to basically input the following from a file;
Title, Artist, Length
At the moment i'm just trying to create the class, and instantiate a few and add them to a vector!
The code i've got is;
And... the main;
So basically i've created the class, and then in main i've created the four variables again so I can add them to the vector but using the class structure... anyone understand? :s
I've been using code bodged from everwhere, but i'm trying to get little thigns working individually because its getting messy in my actual program.
ANY HELP would be apprecated, i'm more into my networking
Hate C++, but have to do it as a module soooo....
Trying to make a CLI based media player, and I need a MP3, Streamer & CD player... anyway, i'm trying to start on the Mp3 player.
I need to basically input the following from a file;
Title, Artist, Length
At the moment i'm just trying to create the class, and instantiate a few and add them to a vector!
The code i've got is;
mp3.h said://Class File
#include <vector>
using namespace std;
class Mp3
{
public:
char songTitle[30];
char songArtist[30];
int songLength;
int currentPos;
Mp3(char *title, char *artist, int length, int pos)
{
strcpy(songTitle,title);
strcpy(songArtist,artist);
songLength = length;
currentPos = pos;
}
void print(void)
{
cout << songTitle;
}
};
And... the main;
main.cpp said:#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
#include "mp3.h"
int main()
{
vector<Mp3> v();
char title, artist;
int length, pos;
while (cin >> title >> artist >> length >> pos)
{
v.push_back(Mp3(title, artist length, pos));
};
system("PAUSE");
}
So basically i've created the class, and then in main i've created the four variables again so I can add them to the vector but using the class structure... anyone understand? :s
I've been using code bodged from everwhere, but i'm trying to get little thigns working individually because its getting messy in my actual program.
ANY HELP would be apprecated, i'm more into my networking
