Week 6 computer task Project 6-salary

Source: Internet
Author: User
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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.