ch11cemployee.cpp

来自「此例子是学习C++的好东西」· C++ 代码 · 共 34 行

CPP
34
字号
//Program 11-5 CCEO      CCEO class with CEmployee and CBoss

//File:  Ch11CEmployee.cpp

#include "Ch11CEmployee.h"
#include <iostream.h>
#include <string.h>

CEmployee::CEmployee()
{
	name[0] = '\0';
	SSN[0] = '\0';
	salary = 0;
	dept = 0;
}

void CEmployee::GetEmpInfo()
{
	char extra_enter;
	cout << "\n Enter the employee's name    ";
	cin.getline(name,50);
	cout << "\n Enter the employee's SSN   ";
	cin.getline(SSN,15);
	cout << "\n Enter the dept code and salary   ";
	cin >> dept >> salary;
	cin.get(extra_enter);
}

void CEmployee::WriteEmpInfo()
{
	cout << "\n Employee: " << name <<  "\n      SSN: " << SSN;
	cout << "\n     Dept:  " << dept << "\n   Salary:  $" << salary;

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?