Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Miley Virus
Apr 9, 2010

hey speaking of c++ someone help me understand what my crazy teacher is talking about

got an assignment to make a linked list, simple enough but she's asking me to pass an int to the functions that remove either a head or tail node and i have no idea why

quote:

Q: What is the parameter for in RemoveHead() and RemoveTail() functions?
A: The reference parameter is for extracting the item (data) from the head or tail node. Like this...

int item;
if(L1.RemoveHead(item)) cout << item;
After the item is assigned to the reference parameter thesr fns should delete the head or tail node and leave the list safe. See lecture notes on Collections.

i mean i get that there should be a function to remove a given value from the list but neither RemoveHead or RemoveTail do that in the spec as far as i can tell (we were just given a class prototype with commented code that says "removes item from head" and "removes item from tail")

Adbot
ADBOT LOVES YOU

Miley Virus
Apr 9, 2010

it is
if ur a retard like me

Miley Virus
Apr 9, 2010

oh jesus christ i AM loving retarded 'swhat i get for just glancing at stuff i guess

Miley Virus
Apr 9, 2010

OBAMA BIN LAUGHIN posted:

so what is the int for
the int is just a roundabout way of returning both a bool (which is what the method was returning) and an int. it wasnt visible from the code itself but if you read the text below it the int is being passed by reference which i failed to notice in the prototype and my definition code i copy/pasted

so you pass the method the int, it sets it to the value you're removing from the list then deletes the node so you can output what you actually took out

really simple but lol who actually reads things these days

Miley Virus
Apr 9, 2010

its okay i forgive you obama

Miley Virus
Apr 9, 2010

loving stuck at 99% on this nyt article, SOMEONE PLZ SEED

Miley Virus
Apr 9, 2010

i love how tor is secure and poo poo except for the part where the people at the end of the connection can see absolutely everything you browse/do

Miley Virus
Apr 9, 2010

Sweeper posted:

lol web scripting

Miley Virus
Apr 9, 2010

also its dawned upon me that i'm a pos coder so now my goal in life is to bullshit enough to get a lovely job with little responsibility

Adbot
ADBOT LOVES YOU

Miley Virus
Apr 9, 2010

Orbi posted:

also its dawned upon me that i'm a pos

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply