daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
unfourtantly i dont have a clue what this is and i doubt i could even use it as we havent been taught it yet in my CMPT103 class, ill see if i can figure it out and run it by my instructor before its due and see if i can get away with it, id just like to know why the windows freezing
Ov course you don't, but many people here feel that vectors are the only solution to using arrays. Theylove suggesting things obviously beyond your level.
Problem 1 is your formatting. Please format your code so we can read it easier. We can't tell your program structure the way you have it. This is something that for some reason instructors seem to think is unnecessary. It isn't.
Based on what I can see, your value count does nothing useful, and definitely not what you think it's doing. Rethink your sort -- it is not a sort, it's just a string mover.
Go through your code by hand and you'll see what I mean.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
I see a problem right away
char list[9][31];
char sorted[9][31];
//--------Main Program Body----------
cout << "****Alphebetical Sorting Program***"<<endl<<endl;
cout<<"please enter 10 strings you wish to sort"<<endl;
Your arrays are 9 X 31 and should be 10 X 31.
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
i apologize ive only been working with c++ for a couple months...
Really? You aren't a seasoned professional? :icon_twisted:
Naturally we can tell. It's obvious...do you at least understand what im trying to do?
Of course. You want to sort strings. Nothing complicated about understanding. Doing is a little more complicated though.how exactly should the count work then or is there a better way to do this that im just not seeing?
You don't want to count anything. You want to find two strings that need to be switched and switch them.
What sort are you trying to implement? Do you know how a sort works? I think you need to read up on the concept so you know the basic ideas you need to implement.
And heed whatgerard4143 said. He's correct.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
you dont have to be such a . i got count working without your help why are you here? isnt this supposed to be a forum to help people? the only useful peice of information i obtained was what gerard said here:
And you still got it wrong: char list[9][31]; all i was doing wrong was not setting the count to 0 after each pass, an easy fix, if i can see that and you cant maybe im a better programmer than you
As I said, I couldn't read your code because of the formatting. Still can't.
Because I have no idea what you know, I was justified in asking. I'll remember not to offer help next time since you take offense at it.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
@beejay321 as you may have already found from personal message sent to you, your behavior is inappropriate. If you want help you need to cooperate and investigated recommended resources. If you believe answer from another member is inappropriate then use "Flag Bad Post" button let the moderators/admins know there is a possible issue, instead of "taking law in your hands" and abuse supposed offender
PS: WaltP was correct in saying that two dimensional array is wrong and you been right it will compile. The thing is that WaltP is right because you are supposed to used arrays of same size. In this scenario so far it is harmless since random array size is smaller then sorted, but if you start using array size method instead of hard coding number of loops in for statement (10) you will get in trouble since there will be null values in last set
peter_budo
Code tags enforcer
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902