/* asst06.cpp 7/6/2005 CIS 150 David G. Klick Solution to assignment #6. */ #include #include using std::cout; using std::cin; using std::setw; struct Player { char name[35]; int id; double points; }; const int NUM_PLAYERS = 3; void sortByID(Player p[], int len); void sortByPoints(Player p[], int len); void display(Player p); int main(void) { int i; char temp[10]; // declare array of Player structures Player players[NUM_PLAYERS]; // get player data from user cout << "Getting player information:\n"; for (i=0; i p[j].id) { temp = p[i]; p[i] = p[j]; p[j] = temp; } } } } void sortByPoints(Player p[], int len) { int i, j; Player temp; for (i=0; i p[j].points) { temp = p[i]; p[i] = p[j]; p[j] = temp; } } } } void display(Player p) { cout << setw(2) << p.id << ": " << p.name << " (" << p.points << ")\n"; }