A CD Program (Last program)

Hey guys, this is my last assignment of the year. My grade in c++ isn't that good and I just want to finish this program completely so I can bump up my grade a bit.
The program has to use classes. I attempted it a bit but I'm not too familiar with classes(only spent about 3 days on it).
Here is the program requirements:

- A textfile with 15 songs (must have artist, title, and time of track, but you can format it however you'd like)
- A CD class
- The user should be able to choose songs from the textfile to add to the cd
- the user should be able to "delete" songs from the cd
- the user should be able to see a current list of songs
- the user should be able to see a length of any song, or the length of the entire cd in the format "hh:mm:ss"
- in addition, the user should able to request to see a specific song's information - for example if they want to get all the
information on the song "don't speak" you'll get "no doubt - don't speak - 3:48" or something along those lines.

I got the textfile with the songs done:

Dream on - Aerosmith - 4:28
Sweet Child O' Mine - Guns N' Roses - 5:56
Thunderstruck - AC/DC - 4:52
Breathe Into Me - Red - 3:36
Fireproof - Pillar - 3:46
Hero - Skillet - 3:09
Don't Stop Believin' - Journey - 4:11
New Divide - Linkin Park - 4:37
Wanted Dead Or Alive - Bon Jovi - 5:11
All The Right Moves - OneRepublic - 3:24
Sweet Home Alabama - lynyrd Skynyrd - 4:45
One - Metallica - 7:24
Crazy Train - Ozzy Osbourne - 4:52
Back in Black - AC/DC - 4:16
Iron Man - Black Sabbath - 5:37


I will post my code once I finish with the int main. Thanks to anyone that helps!
That sounds pretty straightforward right? Just create a stack. A function to "push" a new song into the stack shouldn't be that hard. Deleting might get slightly more complicated however. The rest sounds like basic I/O file handling.
Ok so I tried making the int main and combing the class with it, also this is due by the end of today so any help is grateful. Here is my code so far:

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

class CD
{
      private:
              string Song;
      public:
             void Delete(string Song);
             void AddSongs(string Song);
             void SeeSongs();
             void Time(string song);
}
void CD::AddSongs(string Song)
{
     for(int x = 0; x < 15; x++)
     {
             Song = SongList[x];
     }
}
void CD::Delete(string Song)
{
     if(Song != CDList)
             cout << "This song is not added on your CD list." << endl;
     else
     {
             Song.delete;
             cout << "The song was deleted." << endl;
     }
}
void CD::SeeSongs()
{
     for(int x = 0; x < 15; x++)
     {
             getline(CDPlayer, Song, '#');
             cout << Song << endl;;
     }
}
void CD::Time(string Song)
{
     
}
int main()
{
    CDPlayer AddSong, DeleteSong, ListSongs, Time;
    string SongList[15] = {""};
    ifstream CD;
    string Song;
    int Option;
    char Continue = ' ';
    
    CDPlayer.open("CD Program", ios::in);
    
    Continue = 'y';
    while(Continue == 'y')
    {
            cout << "Press 1 to add songs, 2 to delete songs, 3 to see a current list of songs,"
            " 4 to see entire length, or 5 to see a specific song information: ";
            cin >> Option;
            
                   if(Option == 1)
                   {
                             cout << "Enter the song you want to add: ";
                             cin >> Song;
                             AddSong.AddSongs(Song);
                             cout << Song << " was added to your CD." << endl;
                   }
                   else if(Option == 2)
                   {
                        cout << "Enter the song you want to delete: ";
                        cin >> Song;
                        DeleteSong.Delete(Song);
                        cout << Song << " was deleted from your CD." << endl;
                   }
                   else if(Option == 3)
                   {
                        ListSongs.SeeSongs();
                   }
                   else
                   {
                       Time.Time(string Song);
                   }
                                           
    cout << "Would you like to continue? ";
    cin >> Continue;
    }
    
    system("PAUSE");
    return 0;
}
Last edited on
I have about 3 hours left. Any help at all is helpful.
Hi,

just found this post! Perhaps you can tell if you did well, or not?

DG
Topic archived. No new replies allowed.