Article View: csu.cs.200
Article #389Assignment 4 HELP needed
From: mark casteel
Date: Tue, 24 Feb 1998 00:00
Date: Tue, 24 Feb 1998 00:00
83 lines
2951 bytes
2951 bytes
LIke a dumbass I have been trying for the last week on assignment 4. I've
heard it s just a simple cut and paste job from the previous
assignment(we'll I didnt get that one working either.) I'm wondering if
someone could help me out here?
I'm having problems with all parts but I think if I can get Read_Load_List
to work, I can figure out the rest of it.
So far I have figured out that we have to have the class "LIST" at the top
of the .h file. Do I have to have a second (struct/list?) inside with a
pointer to next-correct? I then copy LISTdata data to LIST?
class LIST
{
public: // everything is public for now until it all works.
int job_ID;
int job_value;
char file[MAX_FILE_NAME];
LIST*next;
void LIST::LIST_AddAtEnd(LISTdata &data);
LISTdata LIST::LIST_Get(int i);
};
LIST qlist;
A.) First we call qlist.LIST_AddAtEnd(data); How do I declare this so I can
pass back out my data that I copy into LIST(the way I have it declared now
I get garbage)? I am able to read in jobid and value ok. but have a
problem reading in file.
void LIST::LIST_AddAtEnd(LISTdata &data)
{
ifstream in;
newptr=new LIST ;
newptr->job_ID=data.job_ID;
newptr->job_value=data.job_value;
Here is my "file copy"- I get a "cannot convert int of char*" error-
data.file is declared as a char in LIST - what is my problem? I have
messed with this for hours and still cant get this one line- any
suggestions?
strcpy(filename[MAX_FILE_NAME],data.file[MAX_FILE_NAME]);
newptr->next=NULL;
//prevptr->next=newptr;
prevptr=newptr;
}
B.) How do I do the LIST_GET(int); routine to traverse any given list- all
we are given in Main4.C is a parameter of int for this function, dont we
also need to pass in a call to a list name and headptr, or somesuch? This
is my biggest problem with this assignment.
LISTdata LIST::LIST_Get(int i)
{
int j;
LIST *newptr,*headptr;
newptr=headptr->next;
LISTdata crap;
//headptr=NULL; // compiler dont like this line either
??//TRAVERSE//??
crap.job_ID=job_ID;
crap.job_value=job_value;
//crap.file[MAX_FILE_NAME]=file[MAX_FILE_NAME];
return crap;
}
Any and ALL help would be greatly appreciated. THANKS.
--
Thanks, cya, mark 8-|
casteelm@info2000.net
PHITS of N. Co. NAR Section#565;
http://www.pageplus.com/~cwbrown/phits/phits.htm
Tripoli Rocky Mountain's, Prefecture #72;
http://www.dohram.com/trm/
Technical Details
Message-ID:
<01bd415f$a1b600c0$LocalHost@default>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 127144,1c68dbc9631ca0f6,start X-Google-Attributes: gid127144,public From: "mark casteel " <casteelm@info2000.net> Subject: Assignment 4 HELP needed Date: 1998/02/24 Message-ID: <01bd415f$a1b600c0$LocalHost@default> X-Deja-AN: 328268718 X-NNTP-Posting-Host: 199.45.255.1 Organization: Pre-installed Company Newsgroups: csu.cs.200