structtest.cpp

来自「C++高级编程这本书所附的源代码」· C++ 代码 · 共 28 行

CPP
28
字号
// structtest.cpp

#include <iostream>
#include "employeestruct.h"

using namespace std;

int main (int argc, char** argv)
{
  // create and populate an employee
  EmployeeT anEmployee;

  anEmployee.firstInitial = 'M';
  anEmployee.middleInitial = 'R';
  anEmployee.lastInitial = 'G';
  anEmployee.employeeNumber = 42;
  anEmployee.salary = 80000;

  // output the values of an employee
  cout << "Employee: " << anEmployee.firstInitial << 
    anEmployee.middleInitial <<
    anEmployee.lastInitial << endl;
  cout << "Number: " << anEmployee.employeeNumber << endl;
  cout << "Salary: $" << anEmployee.salary << endl;

  return 0;
}

⌨️ 快捷键说明

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