anyone wanna help me with my computer science homework? You do? Thought so!

stonecold3169

Platinum Member
Jan 30, 2001
2,060
0
76

Here's my problem, and perhaps it's a dumb one. Just got done playing around with pointers, and our CS teacher gave us a project in which we're supposed to make a dictionary program. Now, I've got 99.9% of it all finished, but one problem. He gave us a very strict guideline for how to do it. Oh, and by the way, this is c++ we're dealing with.

1) We're ONLY allowed to use linked lists, and we can only define them once(This would be easy for me because I already know vectors and templates, but we can't use them)

2) we have a class Entry with private members word and definition.

3) we have a typedef dictionary, which is a linked list of entries (Okay, so we're officially forced to declare our list of type Entry)

4) Definition is actually a linked list itself, made up of mulitple lines of definitions read out of a file

Okay, so normally if I had declared a list of type string, I could go, say, node->item= string. Unfortunetly, item now is an entry, which has 2 data members.

Now, the next trick comes into play. We're doing this in teams to expriance modularity and true programing, and I'm only allowed to touch the big linked lists. My initial thought was to use a constructor, like node->item= entry b (word, def), but I don't have the right to make the constructor, which makes me believe there is another way. Any advice?
 

Czar

Lifer
Oct 9, 1999
28,510
0
0


<< Swoosh! Right over the top of my head :confused:! >>


and I even thought he meant we were going to play Counter Strike :eek:
 

JetBlack69

Diamond Member
Sep 16, 2001
4,580
1
0
CS = Computer Science != Counter Strike

Sorry, but I only know a limited amount in JAVA.
 

Azraele

Elite Member
Nov 5, 2000
16,524
29
91


<< Swoosh! Right over the top of my head :confused:! >>


Lol, me too. I got lost at about the second sentence. :Q
 

manly

Lifer
Jan 25, 2000
13,306
4,084
136
If I understand the problem correctly, the real question is how do you do higher-level work if your lazy ass project partner is out getting faded?

The first part of the answer is to for you two to agree upon the interface between your code and his code. It seems like you've somewhat decided, because you assume a particular constuctor call.

So, all you need to do is stub out the interface. Meaning you write a skeletal module that matches the interface of the code he's supposed to produce. Your skeletal module doesn't implement real behavior.

Then you can write your code, and bang on it all you want.
 

stonecold3169

Platinum Member
Jan 30, 2001
2,060
0
76
thanks manly(that just sounds wrong), you hit it right on the head. I was hoping there was a way of writing it in and doing it on a lower level, but I guess for now I'll just use headers and make sure it compiles as an object and merge later... thank you much!
 

NeoMadHatter

Platinum Member
Nov 29, 2000
2,355
0
0
johntwang.com
linked lists suck. vectors are so much better. i would help you out. but i'm better at doing stuff on paper. if you we in umd cp i'd be glad to help you. i took c++ with linked lists last semester.
 

stonecold3169

Platinum Member
Jan 30, 2001
2,060
0
76
Oh, don't get me wrong, I agree 100% that in this case I should be using a linked list AND a vector... trouble was that I independatly learned before school what I thought would be useful, and now for HW I need to do stuff the crappy way just so that the next week we can learn how to do it the better way. It sucks, but I'll deal
 

UglyCasanova

Lifer
Mar 25, 2001
19,275
1,361
126
Hey, what level class are you taking? I am trying to teach myself C++ before I go to college next fall and major in CS.
 

stonecold3169

Platinum Member
Jan 30, 2001
2,060
0
76
I'm only in CS142, which is the second semester class of my freshman year. If you really wanna get ahead in school, you'll need to find out what outline that school follows. Here, we don't do anything with a GUI until first semester of our junier year (Unless you take electives, like I am. I'm take advanced Java next semester). The advantage of having a school that teaches c or c++ first is that it makes learning other languages very easy.

Many schools now start with java, and instead of teaching people why something works the way it does, they just teach them how to write it and move on. In the long run this will kill them IMHO. I can't wait till they get to the compiler course and have no clue what is going on.
 

UglyCasanova

Lifer
Mar 25, 2001
19,275
1,361
126
Where do you attend school? I'm not sure how my school goes, but the first course is an introductory programming/history of computers type class followed by a class on algorithms and such. I will most likely take a bunch of comp classes as electives as well. I have a question. In order to major in CS I have to minor in math, physics, or something else that I can't remember but didn't want to do anyways. Out of math or physics, which do you think would help me more in the long run? I love both, so I could do either. I was just wondering between math and physics, which would help a programmer out more?
 

stonecold3169

Platinum Member
Jan 30, 2001
2,060
0
76
I go to school at Clarkson University, in Potsdam NY. Our first semester we learned c, because even though it's dated, its the backbone of many languages. This semester we're doing the c++ stuff. At this school, CS is an engineering major, which means you HAVE to take two semesters of calc based physics, and 2 semesters of calc. In many schools CS is a math or science major, so you take, say, 3-4 semesters of one or the other. The way that the classes work out here, if I take 3 more math courses then what I am already required, I dual major in math, which is nice.

As far as which you should go into, calc is easy compared to the physics here. The physics here is nuts, but that is only because we're desperatley trying to become an ivy-league school. Because of this, they're trying to make it so that people can no longer slip through the cracks, so in every class the pass/fail rate is about 50/50, except in the basic math courses because the buisness students are required to take those too
rolleye.gif
. Anyways, I strongly suggest even if you aren't required that you take some physics in college, as it's a bit more practical then what you learn in HS.