C++, the hell (basically need Help!!!)

Associate
Joined
7 Dec 2005
Posts
16
hi guys, now i'm one of these people who are proud and if can help it will not ask for help unless i need it, and i pretty do need it lol.

i'm very (where very is really really very) bad at C++ and i do not like the language, however i have an assignment to do and cannot figure out some things.

basically its a stereo type CLI program, with mp3 and cd players. i have done an active mode and standy mode, and have the basics of an MP3, but i need to read from a file and sort of skip tracks.

if i was to print
1, John Lennon, Imagine, 1/52

the 1/52, how would i skip that by 1, by 10? and how can i read this from a file, with other tracks in?

any help, would be appricieated, as i'm very poor at this. if any more info is needed i will put it here.
 
ok what i have got is very basic, and its just a case of understanding.

the mp3 should skip forward 1 unit and 10, back 1 and 10 and next and previous. how am i meant to read from file as well?

code so far is..

MP3 Header
Code:
// MP3 Header files

class MP3
{
private:
	// Private Atts set
	char	strTrackName[50];
	char	strArtistName[50];
	int		nTrackLength;

public:
	// The Constuctors
	MP3(char *strTrack, char *strArtist, int nLength);
	MP3(char *strTrack);
	MP3(void);

	// The Methods
	void SetTrack(char *);
	void SetTrack(void);
	void SetArtist(char *);
	void SetArtist(void);
	void SetLength(int);
	void SetLength(void);

	char * GetTrack(void);
	char * GetArtist(void);
	int GetLength(void);

	void PrintDetails(void);

};

// The Implementation
MP3::MP3(char *strTrack, char *strArtist, int nLength)
{
	strcpy(strTrackName, strTrack);
	strcpy(strArtistName, strArtist);
	nTrackLength = nLength;

}

int MP3::GetLength(void)
{
	return nTrackLength;
}
char * MP3::GetArtist(void)
{
	return strArtistName;
}
char * MP3::GetTrack(void)
{
	return strTrackName;
}
void MP3::PrintDetails(void)
{
	cout << "Track Details" << endl;
	cout << "Track		:" << strTrackName << endl;
	cout << "Artist	:" << strArtistName << endl;
	cout << "Track Length			: " << nTrackLength << endl << endl;
}

void MP3::SetLength(int nNumber)
{
	nTrackLength = nNumber;
}
void MP3::SetTrack(char * strTrack)
{
	strcpy(strTrackName, strTrack);
}
void MP3::SetArtist(char * strArtist)
{
	strcpy(strArtistName, strArtist);
}

and Main

Code:
// MediaPlayer.cpp
#include <iostream>
#include <fstream>
using namespace std;
//#include "MP3Header.h"

void Active();
void MP3Player();
void Standby();





int main(void)
{      
	 Standby();
	return 0;
}


 void Standby()
 {
int StandbyMenu;

        cout<< " 1- Activate Player" << endl;
        cout << " 2- Exit application "<<endl;
        cin >> StandbyMenu;

    switch (StandbyMenu)
    {
    case 1:
        Active ();
		break;
	case 2:
		cout << "Exit" << endl << endl;
		break;
    }
}
void Active()
{
		int menu;
		cout << "You have now Activated the Player" << endl << endl;
		cout << " 1 - MP3" << endl;
		cout << " 2 - CD" << endl;
		cout << " 3 - Streaming" << endl;
		cout << " 4 - Go to Standby Mode " << endl << endl;
	   cin >> menu;
	
	switch (menu)
	{
	case 1:
    MP3Player ();
		break;
	case 2:
		cout << "CD" << endl << endl;
		break;
	case 3:
		cout << "Streaming" << endl << endl;
		break;
	case 4:
	cout << "Entering Standby Mode" << endl << endl;
		Standby();
        break;
	}
}

void MP3Player()
{
    int MP3menu;
    
    //cout << (here will print the first song that will be played
    cout << " 1 - Select the Next MP3 Track: " << endl;
    cout << " 2 - Select the Previous MP3 Track " << endl;
    cout << " 3 - Fast Forward by 1 Position Unit " << endl;
    cout << " 4 - Fast Forward by 10 Position Unit " << endl;
    cout << " 5 - Rewind by 10 Position Units " << endl;
    cout << " 6 - Go Back to Player Menu " << endl;
    cin >> MP3menu;
    
    	switch (MP3menu)
	{
	case 1:
    
		cout << "Next MP3 Playing" << endl << endl;
		//next mp3;
		break;
	case 2:
		cout << "Previous MP3 Playing" << endl << endl;
        //previous mp3;
		break;
	case 3:
		cout << "forward by 1 unit" << endl << endl;
		// one unit;
		break;
	case 4:
        cout << "forward by 10 units" << endl << endl;
        break; 
    case 5: 
        cout << "rewind by 10 units" << endl << endl;
        break;
    case 6:
        cout << "you have exited the mp3 player!" << endl << endl;
        Active();
        break;
        
    }
   
}
 
Back
Top Bottom