Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C++ alphabitizing

Name: Anonymous 2007-11-19 2:00

C++


for (int k = 0; k < 10; k++)
{ if(boyName[fileCount][babyCount].at(k)> boyName[fileCount][babyCount+1].at(k))
{
temp = boyName[fileCount][babyCount];
boyName[fileCount][babyCount] = boyName[fileCount][babyCount+1];
boyName[fileCount][babyCount+1] = temp;

}
}

someone tell me why this bit of code won't work?
i'm comparing strings and alphabetizing them (about 10000 stored in an array)
if k is initialized to 0 and it's not a for loop it'll run fine, and alphabetize it but only by the first letter.

Name: Anonymous 2007-11-19 2:49

Error: fail.cpp:4 missing semicolon

Name: Anonymous 2007-11-19 3:32

>>2
temp undeclared

Name: Anonymous 2007-11-19 3:36

>>1
Shit are you daft? Either use std::fucking::sort in <algorithm>, or use a goddamn set to store your fucking data. Seriously, what the fucking hell. It's not like your shitcanned sort "algorithm" (LOL SWITCH SORT) provides any performance gains.

Just shitcan what you have and use a real method of doing it. Fucking goddamn faggots, C++ IS NOT C.

Name: Anonymous 2007-11-19 7:42

>>4
yes it is

Name: Anonymous 2007-11-19 7:50

>>5
sure it is, in elementary school level

Name: Anonymous 2007-11-19 7:59

>>5
it is not.

Name: Anonymous 2007-11-19 9:20

C++ is a joke language created by Stroustroup to troll the community. Sadly, they took him seriously.

Name: Anonymous 2007-11-19 9:30

Can you at least say what is it not doing? Is it not compiling? not actually switching the two entries around? the if statement's evaluation always yields a true or false even when it shouldn't? what is going wrong?

It won't fix your problem but my first thought looking at your code was that assigning string objects around is INEFFICIENT!! use pointers.

Name: Anonymous 2009-02-25 7:36


Yields a true or   false even when   the balky Flexowriter   required a delay   between output characters   to work right   He just located   instructions on the   server side Not   an easy task   but nothing worthwhile   ever really is   way above your   current skill level   There is a   good idea indeed   Much like meeting   people on a.

Name: Anonymous 2009-03-06 13:47

Provides the most complete and customer friendly   hosting service on   the Internet today.

Name: Anonymous 2010-12-17 1:34

Erika once told me that Xarn is a bad boyfriend

Don't change these.
Name: Email:
Entire Thread Thread List