cpp28.cpp
来自「C++参考书」· C++ 代码 · 共 48 行
CPP
48 行
// Coded by plusir -- Dec.28.2002.
// Standard C++ Bible -- (P197-6-28)
#include <iostream>
using namespace std ;
struct Date
{
int month ;
int day ;
int year ;
} ;
struct Employee
{
int empno ;
char name[35] ;
Date dates[3] ;
float salary ;
} ;
Employee staff[] = {
{ 1, "Bill", { { 12, 1, 88 }, { 2, 24, 92 }, { 5, 5, 95 } }, 35000 },
{ 2, "Paul", { { 10, 3, 87 }, { 5, 17, 94 }, { 3, 7, 96 } }, 25000 },
{ 3, "Jim", { { 9, 5, 80 }, { 9, 11, 96 }, { 0, 0, 0 } }, 42000 },
{ 0 }
} ;
int main()
{
Employee *pEmpl = staff ;
while ( pEmpl->empno != 0 ) {
for ( int i = 0; i < 3; i++ ) {
Date& rd = pEmpl->dates[i] ;
cout << rd.month << '/' << rd.day << '/' << rd.year << ' ' ;
}
cout << endl ;
pEmpl++ ;
}
return 0 ;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?