01. /* 02. * copyright and version Declaration of the program part 03. * Copyright (c) 2013, Yantai University Computer college student 04. * All rightsreserved. 05. * file name: salary. cpp 06. * Author: Zhao guanzhe 07. * Completion Date: April 8, April 7, 2013. * version: v1.0 09. * input Description: 0. * Problem description: 11. */# include <iostream> using namespace std; class Salary {public: Salary (int n); // n indicates the number of employees. space allocation is completed during initialization ~ Salary (); // release the space allocated during initialization in The Destructor void input_salary (); void show_salary (); private: double * salary; int number ;}; // Salary: Salary (int n) {number = n; salary = new double [number];} Salary ::~ Salary () {delete [] salary;} void Salary: input_salary () {cout <"enter" <number <"Name of employee Salary: "<endl; for (int I = 0; I <number; I ++) cin> salary [I];} void Salary: show_salary () {cout <"Employee salary:"; for (int I = 0; I <number; I ++) cout <salary [I] <endl ;} // The following is the test function int main () {Salary s (10); s. input_salary (); s. show_salary (); return 0 ;}
Running result: