| |
| |
| |
|
Page: 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
<roopjm> internal linkage? hmm *looks it up* <jamesd-> Yes, std::list::size is causing flamewars in the committee again right now. <infohunt> ok, the last one for today about vectors ... is it possbile to initialize the vector in a way like 'vector<string> MonthNames=("Jan","Feb")' ?? <jamesd-> infohunt: not yet. <galbi`> i mean for stl container list <infohunt> jamesd: so i really have to use push_back as i did it in my example ?? <Drad> newbie question <WhatAHam> infohunt, no, not with STL vectors.. :) <WhatAHam> :( <Drad> char menuOptions[][4] = { <Drad> "START", "", "", "", <Drad> "Main Mode", "Standard", "Game Mode", "Chess Clock", <Drad> "Counting Direction", "Count Down", "Count Up", "", <Drad> "Lap Timer Mode", "Lap Timer 1", "Lap Timer 2", "" <Drad> }; <jamesd-> infohunt: you can also use an array and the range container, as I've said three times now, ever so patiently. <xdank-> nice <WhatAHam> but if you look at the boost libs i would be surprised if they don't have some vector work-alike that can be initialized that way <Drad> what do i need to change to make that work? <galbi`> for stl lists, it's like a stack , right <jamesd-> Drad: char const **menuOptions[] = { .... }; <jamesd-> galbi: what do you mean by the stack question?! <roopjm> Drad: first off, char* <Drad> oh <infohunt> jamesd: ups ... sorry ... think i will go to sleep now ... maybe i will be a bit cleverer tomorrow morning ... thanks for all the informations .... bye <galbi`> i mean, in this code i have 10 20 40 60 80 100 120 140 160 180 200 <Drad> it's 3 dimensions <galbi`> oops sorrt <jamesd-> Drad: one fewer * than I wrote. <galbi`> in this code <Drad> oh <jamesd-> Sorry, typo. <galbi`> http://rafb.net/paste/results/O5MYnz88.html <galbi`> in this code <galbi`> i have push_back <galbi`> to insrt into list <WhatAHam> galbi`, you can probably treat a list like a stack, sure.. although i hear deque is better for that type of thing <galbi`> i start the for loop <galbi`> at index = 1 <galbi`> not sure why i get 6 elements <jamesd-> calc scroll <CalcMe> scroll = Using longer sentences instead of having a verbal diarrhea helps to keep the scroll down. <galbi`> instead of 5 <WhatAHam> calc ****s <ZorbaTHut> calc calc <CalcMe> calc = Calcs are for you, the user, to learn from and for us, the ops and regulars, to teach you with. CalcMe is a bot which responds only to ops and regulars (others - don't bother trying to calc). <CalcMeII> ****s = the people that run this channel <galbi`> any ideas why? <jamesd-> Eh?!! <WhiteWolf> you *cough* put the host in the wrong spot <WhiteWolf> <.< <jamesd-> WhiteWolf: I didn't... I missed the @ completely. <WhiteWolf> oh, silly ircd ***uming <jamesd-> Or silly client. <jamesd-> And dumb*** me for mistyping. <WhiteWolf> IRCD I DECLARE ;) <ZorbaTHut> I just didn't bother banning him. :P <jamesd-> Zorba: you're nicer than I am. but I didn't permban, so there's still hope for me. <galbi`> any ideas why?? <galbi`> WHY WHY WHYyyyyyyyyy <WhiteWolf> jamesd-: you didn't ban him at all. <roopjm> galbi`: chill out <ZorbaTHut> white, he tried to! :P <jamesd-> LOL. <galbi`> ;p <jamesd-> WhiteWolf: Zorba has a point; the evil intention was there. <WhiteWolf> missed the plus he did though <jamesd-> Now the moment has p***ed and I won't bother. <galbi`> hi roopjm, lomng time :) <WhiteWolf> humm... evil... no <WhiteWolf> nesscate? yes <roopjm> 6 elements =, 0 1 2 3 4 5 <roopjm> heh <galbi`> index starts at 1 though <roopjm> did that book help? <ZorbaTHut> galbi, print out the elements, see what you get. <galbi`> i did, i got 6 elements <roopjm> 1; <= 5? <galbi`> it should be 5 <galbi`> yes <galbi`> http://rafb.net/paste/results/O5MYnz88.html <galbi`> look <WhiteWolf> please stop barfing <snibril> calc scroll <CalcMe> scroll = Using longer sentences instead of having a verbal diarrhea helps to keep the scroll down. <galbi`> lol <snibril> galbi`: and yes, it means you <galbi`> calc scroll <WhiteWolf> galbi`: you should really start your indexes at 0 <galbi`> i know, my ta was demonstrating this to me <galbi`> he wrote that part <WhiteWolf> fire him, heh <galbi`> :) <WhiteWolf> oh, you're a student <galbi`> ya <WhiteWolf> can't quite do that <galbi`> im not a professor :) <WhiteWolf> list<> doesn't set the size using ***ignment i don't think <ZorbaTHut> galbi, don't print out the *number* of elements <ZorbaTHut> print out the elements <ZorbaTHut> see what they are <galbi`> yeah i did <roopjm> that looks proper to me galbi' <ZorbaTHut> galbi, and? :P <galbi`> the first list that prints is 10 20 40 60 80 100 120 140 160 180 200 <WhiteWolf> ... <galbi`> and then <ZorbaTHut> that looks like 11, not 5 or 6 <galbi`> 5 20 40 60 80 100 <galbi`> which is size 6 <ZorbaTHut> ah, that would be 6. yep. <kawfee> size 5 <galbi`> heh <kawfee> 0, 1, 2, 3, 4, 5 <galbi`> ya it should be 5 <galbi`> but it's 6 <kawfee> who knows <roopjm> try.. just for ****s and giggles < 5 not <= <galbi`> am i supposed to start i = 2 :) <WhiteWolf> no <WhiteWolf> just get rid of the equal sign <galbi`> heh alright <|Phreak|> 1 to <= 5 is 5 iterations <|Phreak|> normally one would do 0 to < 5 <|Phreak|> which is also 5 <ZorbaTHut> galbi, wait. how are you getting the number of elements? <galbi`> i get 5 20 40 60 80 <galbi`> yay <galbi`> haha <WhiteWolf> galbi`: just an FYI, l2.size = 5; DOES NOT set the size. <galbi`> is it supposed to work this way? <ZorbaTHut> oh man this is going to end in tears <WhiteWolf> galbi`: size() returns the size. <roopjm> yeah <galbi`> what? <ZorbaTHut> am I the only one who's figured out what's actually going on here? :P <roopjm> The real killer is a snake Sherlock?! <WhiteWolf> galbi`: the method size() is read-only and returns the size. <WhiteWolf> it's not setable <ZorbaTHut> galbi: why is the first number in that list 5? <snibril> btw, what crappy teacher told you to have public members? <|Phreak|> he is printing the address of the size() function as far as I can see <galbi`> wait, so <WhiteWolf> snibril: TA <galbi`> l2.size=5; <WhiteWolf> galbi`: doesn't set the size. <galbi`> does absolutely nothin? <galbi`> l2.size=5; <WhiteWolf> your making it resize 5 times when you add elements <snibril> or write cl***es w/o a defined purpose
Return to c++ or Go to some related
logs:
politics c++ do people get caught leeching off irc canada pmode
|
|