structtest.cpp
上传用户:gtl068a
上传日期:2007-01-25
资源大小:233k
文件大小:1k
源码类别:

VC书籍

开发平台:

Visual C++

  1. // structtest.cpp
  2. #include <iostream>
  3. #include "employeestruct.h"
  4. using namespace std;
  5. int main (int argc, char** argv)
  6. {
  7.   // create and populate an employee
  8.   EmployeeT anEmployee;
  9.   anEmployee.firstInitial = 'M';
  10.   anEmployee.middleInitial = 'R';
  11.   anEmployee.lastInitial = 'G';
  12.   anEmployee.employeeNumber = 42;
  13.   anEmployee.salary = 80000;
  14.   // output the values of an employee
  15.   cout << "Employee: " << anEmployee.firstInitial << 
  16.     anEmployee.middleInitial <<
  17.     anEmployee.lastInitial << endl;
  18.   cout << "Number: " << anEmployee.employeeNumber << endl;
  19.   cout << "Salary: $" << anEmployee.salary << endl;
  20.   return 0;
  21. }