Student class to store monitor information

Source: Internet
Author: User

/**copyright (c) 2016, College of Computer Science, Yantai University *all rights reserved.* file name: main.cpp* Author: Guo Hui * completed: May 10, 2016 * version number: v1.0** Problem Description: Project-store monitor information Student class * Input description: None. * Program output: Student information.  */#include <iostream> #include <string>using namespace Std;class Stu//Declaration base class {Public:stu (int n, string  NAM);          Base class constructor void display ();      member function, output base class data member Protected://(*) Access rights are protected data member int num;  Student study number string name; Student name}; Stu::stu (int n, string nam) {Num=n;name=nam;} void Stu::d isplay () {cout<< "monitor info" <<endl;cout<< "Study No.:" <<num<<endl;cout<< "Name:" <<name<<endl;} Class Studetail:public Stu//Declaration derived class Studetail {public://student NAM, study number n,a years old, live ad, his monitor is NAM1, study number N1 Studeta Il (int n, String nam,int A, string ad,int n1, string nam1); Derived class constructor void show ();    member function, output student's information void Show_monitor ();   member function, the output monitor information Private:stu monitor;       The class monitor of the student, the monitor is the student, is the member of the Stu class int age;   Student Age string Addr; Student's address};  Studetail::studetail (int n, String nam,int A, string ad,int n1, String nam1): Stu (N,nam), age (a), addr (AD), monitor (n1,nam1      ) {}void studetail::show () {cout<< "Student Info:" <<endl;               cout<< "Study No.:" <<num<<endl;      cout<< "Name:" <<name<<endl;                 cout<< "Age:" <<age<<endl;  cout<< "Address:" <<addr<<endl<<endl; }void Studetail::show_monitor () {Monitor.display ();} int main () {//Students Wang Li, No. 10,010th, 19 years old, lives in Shanghai's Beijing Road, his monitor is Jason, study number 10001 Studetail s (10010, "Wang-li", "," Beijing Road,shang      Hai ", 10001," Li-sun ");                       S.show ();                Output Student information s.show_monitor ();  Output monitor information return 0; }

Student class to store monitor information

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.