[Cpp]/** Copyright (c) 2013, School of Computer Science, Yantai University * All rights reserved. * file name: test. cpp * Author: Fan Lulu * Completion Date: July 15, March 23, 2013 * version: v1.0 ** input Description: none * Problem description: * program output: * Problem Analysis: * Algorithm Design: omitted */header file: [cpp] class Salary {public: void getSalary (); // enter the salary and save the Salary to the salary array, the actual number of people is saved to number void raiseSalary (int x); // raise salary void sortSalary (); // sort the salary void outputSalary (); // output salary private: double salary [50]; int number;}; class definition file: [cpp] # include "Salary. h "# include <iostream> using namespace std; void Salary: getSalary () {int I; cout <" Enter the number of workers "<endl; cin> number; cout <"Enter the salary" <endl; for (I = 0; I <number; I ++) cin> Salary [I];} void salary :: raiseSalary (int x) {int I; for (I = 0; I <number; I ++) salary [I] + = x;} void Salary: sortSalary () {int I, j; double t; for (I = 0; I <number-1; I ++) for (j = 0; j <number-i-1; j ++) if (salary [j] <salary [j + 1]) {t = salary [j]; salary [j] = salary [j + 1]; salary [j + 1] = t ;}} void Salary: outputSalary () {int I; for (I = 0; I <number; I ++) cout <salary [I] <";} Main file: [cpp] # include" Salary. h "# include <iostream> using namespace std; int main () {Salary s; int money; s. getSalary (); cout <"Enter the salary increase:"; cin> money; s. raiseSalary (money); cout <"after salary increase" <endl; s. outputSalary (); cout <endl; s. sortSalary (); cout <"after wage sorting" <endl; s. outputSalary (); cout <endl; system ("PAUSE"); return 0;} running result: