Thread: HighScores Menu

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2016
    Posts
    6

    HighScores Menu

    Hi everybody im doing this game project and i got stock in the last part.
    so the problem is that is i can make scores to sort from highest to lowest but the name of players will eventually printf in the order it was scanned how can relate this 2 to every player's score print with their own name from highest to lowest
    here is my code

    Code:
        Scores[Counter2]=HIGHSCORE;    
    
    TheLastOne[Counter2]=HIGHSCORE; 
           char Name[20][20];/*names are scanned and store in this array in another part of code*/
    
        for (j=0 ; j<19 ; j++)
        {
            for (i=0 ; i<19 ; i++)
            {
                if (Scores[i+1] < Scores[i])
                {
                    t = Scores[i];
                    Scores[i] = Scores[i + 1];
                    Scores[i + 1] = t;
    
    
                }
            }
        }
        system("cls");
        for (i=20 ; i>=20-Counter2 ; i--)
        {
            printf ("%d-%s=>%d\n",21-i,Name[20-i],Scores[i-1]);
        }
    i tried store the names in another array by comparing them with this code below but didnt work
    Code:
            for(int k=0;k<20;k++)
        {
                for(int z=0;z<20;z++)
                {
                    if(TheLastOne[k]==Scores[z])
                        for(int u=0;u<20;u++)
                        {
                            Name2[u][k]=Name[u][19-z];
                        }
                
                }
        }
    Last edited by parham-box; 12-02-2016 at 03:04 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 01-16-2015, 02:32 PM
  2. help menu
    By a.mlw.walker in forum C Programming
    Replies: 1
    Last Post: 03-27-2009, 06:06 AM
  3. Menu?
    By killmr in forum C++ Programming
    Replies: 8
    Last Post: 03-22-2005, 08:45 AM
  4. Menu
    By bahumat_12 in forum C Programming
    Replies: 4
    Last Post: 02-22-2004, 03:16 AM
  5. How to modify a menu into a menu Folder(contains submenus) ??
    By L.O.K. in forum Windows Programming
    Replies: 3
    Last Post: 01-09-2003, 02:26 PM

Tags for this Thread