#include <iostream> 
#include <string> 

using namespace std; 

int main()
{
      string names[4] = {"Anna" , "Jenny", "George" , "Michael"};   
      int score[4];
      
      for(int i = 0; i < 3; i++) 
      { 
            cout << names[i] << ": ";     
            cin >> score[i];     
            cin.ignore(); 
            }
            
              //sort by score   
              for ( int i = 0; i < 3; i++ ) 	
              { score[i];   
                    for ( int j = 0; j < 3; j++ )     
                    {       
                            if( score[i] < score[j] )       
                            {          
                                       string tmp_string;          
                                       int temp;           
                                       temp = score[i];            
                                       tmp_string = names[i];           
                                       score[i] = score[j];           
                                       names[i] = names[j];           
                                       score[j] = temp;          
                                       names[j] = tmp_string;
                            }    
                    }   
              } 
              
              for ( int k = 0; k < 3; k++ )   
              {
                      cout << endl;  
                      cout <<names[k] << " = "<< score[k] << "        ";
                     
                     
                      }
              system("pause");
}

I've compiled it (with dev-c++), and it runs well.
I just need a few minor things.

1. I need it to sort descendingly, not ascendingly.
2. I need to know how to either print the output, or get the output sent to a word processor so it can be printed.
3. When the output is displayed, is there a way to clear the screen before-hand, so the input is cleared?

--thanks a million, guys.

1. I need it to sort descendingly, not ascendingly.

try rethinking this part of your code:

if( score[i] < score[j] )       
{          
...
}

Lol. Yeah... i feel pretty stupid. =p
I got it though

Do you think you can help with anything else?

Is the printing to a file/Word part of the assignment or just so you can print it out and turn it in?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.