Actually, std::map is the way to go with this one for the simplest solution if ranking the names is something that the OP is going to need to consider later in his program. I don't normally do this, however my new pet peeve is seeing C code in C++, so:
Code:
#include <iostream>
#include <string>
#include <map>
int main(){
std::map<int, std::string>NameList;
std::map<int,std::string>::iterator ii;
std::string Name;
int rank;
for(int i=0;i<5;i++){
std::cout<<"Enter name: ";
std::getline(std::cin, Name);
std::cout<<"Enter rank: ";
std::cin >> rank;
std::cin.ignore();
NameList.insert(std::pair<int,std::string>(rank,Name));
}
for(ii=NameList.begin(); ii!= NameList.end(); ii++){
std::cout<<ii->first <<" "<<ii->second<<std::endl;
}
std::cin.get();
return(0);
}