you mean C+, the programming language? yes, i know C+. what's up?
tracyg
Posted:
Member since
Re: anyone know c++?
no, it's c++ we're doing.
how do you compare 3 strings? i could do 2, but not 3. (in lexicographical order)
NovemberSue
Posted:
Member since
Re: anyone know c++?
What subject is that?
tracyg
Posted:
Member since
Re: anyone know c++?
computer science (algorithmic problem solving)
NovemberSue
Posted:
Member since
Re: anyone know c++?
Oh! Science was never one of my favorites.
smooch
Posted:
Member since
Re: anyone know c++?
do you need to compare all 3 at once? can you compare a,b then b,c then a,c?
tracyg
Posted:
Member since
Re: anyone know c++?
i tried doing all three at once but it didn't work. I think i have to compare 2 at a time, but it has to output them in order. and thats whats stumping me. I guess i compare 2 at a time and assign them values like 'first', 'second' and so on? grrrrr my head hurts. im tired of thinking!
smooch
Posted:
Member since
Re: anyone know c++?
are the strings in variables? how are you outputting them? are they in an array? or just outputting to the screen? are you comparing so you can sort alphabetically?
tracyg
Posted:
Member since
Re: anyone know c++?
yeah, comparing so we can sort it alphabetically. then output all three words in order
do you use arrays yet? if so, i'd compare word1, word2. put the 'first' one in array position 0, put the 'second' in array position 1. then compare word3 with the one in the first position. if it's greater than, shift the array down 1, putting word3 in the 0th position. if it's less then, then you must compare with position 1, shift down if greater than. if less than, put in array position 2.
if you are not using arrays, i'd create 3 variables: first, second, third as strings. compare word1, word2. if word1 > word2 then first = word1 second = word2 else first = word2 second = word1
... now compare word3, putting it in the right position and moving first and second appropriately. does this help?
tracyg
Posted:
Member since
Re: anyone know c++?
it helps a little. thanks I have the comparing of the first two... but then once i introduce the third number it messes things up. f it, i'll just hand it in incomplete... nothing is working.
smooch
Posted:
Member since
Re: anyone know c++?
don't give up! give me your logic for the 3rd string. we can work through this!
tracyg
Posted:
Member since
Re: anyone know c++?
i ended up doing it the long way. Setting it up for each instance. then i finally got it to work when i found i was missing curly brackets in places.
it bugs me i can't get it the (probably) more simpler way, but as long as i got it to work (since its due today) thats what counts.