Click here to Skip to main content
15,915,513 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralNTML/Proxy/WinInet/WinSock Pin
13-Nov-00 20:42
suss13-Nov-00 20:42 
Generalnot really a C++ question Pin
13-Nov-00 15:33
suss13-Nov-00 15:33 
GeneralRe: not really a C++ question Pin
14-Nov-00 5:36
suss14-Nov-00 5:36 
GeneralRe: not really a C++ question Pin
14-Nov-00 13:59
suss14-Nov-00 13:59 
GeneralIE favorites and Visual C++ Pin
13-Nov-00 11:27
suss13-Nov-00 11:27 
Generalc++ killer assignment please help Pin
Jimbo Jones13-Nov-00 9:57
Jimbo Jones13-Nov-00 9:57 
GeneralRe: c++ killer assignment please help Pin
Christian Graus13-Nov-00 13:51
protectorChristian Graus13-Nov-00 13:51 
GeneralRe: c++ killer assignment please help Pin
Jimbo Jones13-Nov-00 18:17
Jimbo Jones13-Nov-00 18:17 
Okay, I made those variable static...
I've made a bunch of changes. I think my header file is coming along. I still do not know where to begin with this linked list thing.

/* mp3list.h

Your classes must all be declared in a header named mp3list.h.
Their definitions must reside in the file mp3list.cpp
(capitalize those correctly). */


/*
Mp3 Class

Stores information about an mp3 file: artist name, song title, and
bit rate (an integer greater than 0 that represents kbits / sec).
The constructor accepts all values as parameters
(strings arguments should be passed by reference).
Two public methods must be defined in the class:
1. equals( const Mp3 & ): returns true if the passed argument's
instance variables are equal to the current instance and false
otherwise.
2. display(): displays the Mp3 data in the following form
(using example data):
Artist: Nirvana
Title: Smells Like Teen Spirit
Bit Rate: 128 kbits/sec
This method doesn't return a value.
*/

//prevent multiple inclusion of header
#ifndef __mp3list_h__
#define __mp3list_h__

#include <string>

class Mp3
{
public:
//constructor
Mp3(string &Artist, string &Title, int &Bit){
static string art = Artist;
static string tit = Title;
static int bit = Bit;
}


bool equals(const Mp3& ComparedMp3) const {
return if ((art == ComparedMp3.art) && (tit == ComparedMp3.tit) && (bit == ComparedMp3.bit));


}

void display(){
cout << "Artist: " << art << endl;
cout << "Title: " << tit << endl;
cout << "Bit Rate: " << bit << endl;
}

}



/* Mp3ListNode Class
An object to represent a single node of the linked list.
*/

typedef Mp3ListNode *Mp3ListNode_ptr;

class Mp3ListNode
{
public:
/* constructor
Two instance variables are needed: a pointer to an Mp3 object
(the data held by the node) and a pointer to an Mp3ListNode that
points to the next node in the chain. The constructor must take
the three Mp3 data values (artist, title, rate) as arguments and is
responsible for creating an instance of Mp3 using the given data and
to save it in its instance pointer variable. It should also
initialize the pointer to the next list node to NULL
*/

Mp3(string &Artist, string &Title, int &Bit){
static string art = Artist;
static string tit = Title;
static int bit = Bit;
static Mp3ListNode_ptr curr;
static Mp3ListNode_ptr next = null;
}


/*
Three public methods must be defined in the class:
1. getMp3(): returns a copy of the pointer to the Mp3 object.
2. getNext(): returns a copy of the next Mp3ListNode pointer.
3. setNext(Mp3ListNode *): sets the values of the next Mp3ListNode
pointer to the passed pointer argument.

*/

getMp3() const {
return curr;
}

getNext() const {
return next;
}
//do I need a return type here? what return type is a pointer?

setNext(Mp3ListNode* SentNextMp3ListNode) {
next = SentMp3ListNode;
}


}


----------------------------------


/* mp3list.cpp

Mp3List
An object that represents a linked list. It provides methods for
common list operations such as adding, deleting, searching, and
inserting.

/*
The object should have three instance variables:
An Mp3ListNode pointer that points to the head (first) node of the
list, another Mp3ListNode pointer that points to the tail (last)
node of the list, and a count of the number of nodes currently in
the list. The constructor for the class takes no arguments and
initializes both pointers to NULL and the counter to 0 (the list
is created empty).
*/


typedef Mp3ListNode *Mp3ListNode_ptr;
class mp3list
{
public:
mp3list() {
Mp3ListNode head = null;
Mp3ListNode tail = null;
Mp3ListNode count = 0;
}

/*



Several public methods must be defined by the class:
1. getNumNodes(): returns the current number of nodes in
the list.
*/
int getNumNodes()
{
return count;
}

/*
2. add(const string &, const string &, int): Adds an
entry to the end of the list. Arguments passed
correspond to artist name, song title, and bitrate.
*/

void add(const string& addart, const string& addtit, int addbit)
{
Mp3ListNode_ptr new_node = new Mp3ListNode;
strcpy(new_node->mp3.art, addart);
strcpy(new_node->mp3.tit, addtit);
new_node->mp3.bit = addbit;

if (count == 0)
{
new_node->tail = ;
new_node->head =

/* i am completely lost here

3. find(const string &, const string &, int): returns a pointer
to the Mp3 that matches the given arguments (artist, title, and bitrate). If no matching element is found, it returns NULL.
4. del(): deletes all the nodes in the list. No value is returned.
5. del(const string &, const string &, int): deletes the entry
that matches the given arguments (artist, title, bitrate) and
returns true. If no match is found then no deletion takes place
and the method returns false.
6. insert(const string &, const string &, int, int): inserts at the
given index position and returns true if successful. If the index
is out of bounds, then no insertion takes place and the method
returns false.
7. display(): traverses all the nodes and calls each Mp3's display()
method to produce output in the format:

List data - total node count: 6
---------- INDEX 0 -----------
Artist: Nirvana
Title: Smells Like Teen Spirit
Bit Rate: 128 kbits / sec
---------- INDEX 1 -----------
Artist: Fila Brazilia
Title: Tunstall & Californian Haddock
Bit Rate: 128 kbits / sec
*/
GeneralMulti Platform Compatibility Pin
Arvind Pai13-Nov-00 7:42
Arvind Pai13-Nov-00 7:42 
GeneralRe: Multi Platform Compatibility Pin
Anders Molin13-Nov-00 9:47
professionalAnders Molin13-Nov-00 9:47 
GeneralRe: Multi Platform Compatibility Pin
Erik Funkenbusch13-Nov-00 12:12
Erik Funkenbusch13-Nov-00 12:12 
GeneralRe: Multi Platform Compatibility Pin
Michael Dunn13-Nov-00 15:39
sitebuilderMichael Dunn13-Nov-00 15:39 
GeneralRe: Multi Platform Compatibility Pin
14-Nov-00 5:32
suss14-Nov-00 5:32 
GeneralSmart Pointers Pin
Gerry13-Nov-00 5:44
Gerry13-Nov-00 5:44 
GeneralRe: Smart Pointers Pin
Erik Funkenbusch13-Nov-00 7:24
Erik Funkenbusch13-Nov-00 7:24 
GeneralRe: Smart Pointers Pin
Gerry13-Nov-00 22:39
Gerry13-Nov-00 22:39 
GeneralRe: Smart Pointers Pin
Erik Funkenbusch14-Nov-00 10:37
Erik Funkenbusch14-Nov-00 10:37 
QuestionHow do I determine mouse cursor size? Pin
13-Nov-00 5:37
suss13-Nov-00 5:37 
AnswerRe: How do I determine mouse cursor size? Pin
14-Nov-00 5:19
suss14-Nov-00 5:19 
GeneralProblem to launch WIN NT 'Net Send' programatically Pin
13-Nov-00 4:14
suss13-Nov-00 4:14 
GeneralWeird DAO Problems Pin
13-Nov-00 1:11
suss13-Nov-00 1:11 
GeneralCString in non-MFC application Pin
12-Nov-00 17:58
suss12-Nov-00 17:58 
GeneralRe: CString in non-MFC application Pin
Uwe Keim12-Nov-00 19:23
sitebuilderUwe Keim12-Nov-00 19:23 
GeneralDirectX problem Pin
rtortora12-Nov-00 11:12
rtortora12-Nov-00 11:12 
GeneralPassing Class Pointers Pin
12-Nov-00 9:59
suss12-Nov-00 9:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.