User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 392,021 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,238 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:

HELP me as soon as possible ..!

Join Date: May 2005
Posts: 5
Reputation: hessa is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hessa hessa is offline Offline
Newbie Poster

Re: HELP me as soon as possible ..!

  #5  
May 6th, 2005
I changed the sort by name like this

char s[10][100];
if ( x == 3 ){
      for ( i=0 ; i <3 ; i++ ){
        char s1=*s[i];
        char s2=*s[i+1];
        y=strcmp ( s[i] , s[i+1]);
        if ( y > 0 ) {
          *s[i] = s2;
          *s[i+1]=s1;
        }
<< moderator edit: added [code][/code] tags >>

but it doesn't work like what I want,

if I entered
aaa 111 1
ccc 222 2
bbb 333 3

the program should sort them like this
aaa 111 1
bbb 333 3
ccc 222 2

but it do this

aaa 111 1
bcc 222 2
cbb 333 3

How can I fix this problem ,plz ??
Reply With Quote  
All times are GMT -4. The time now is 10:43 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC