⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pr15003.cpp

📁 c++编程宝典源码及Quincy99编译器 是《标准C++编程宝典》电子工业出版社的光盘
💻 CPP
字号:
////////////////////////////////////////
// File Name: pr15003.cpp
////////////////////////////////////////
#include <iostream>
#include <iomanip>

#include <Date.h>
#include "Barray.h"

int main()
{
    // A bounded array of dates.
    Array<Date, 5> dateArray;

    // Some dates.
    Date dt1(12,17,37);
    Date dt2(11,30,38);
    Date dt3(6,24,40);
    Date dt4(10,31,42);
    Date dt5(8,5,44);

    // Put the dates in the array.
    dateArray[0] = dt1;
    dateArray[1] = dt2;
    dateArray[2] = dt3;
    dateArray[3] = dt4;
    dateArray[4] = dt5;

    // Display the dates.
    for (int i = 0; i < 5; i++)
        std::cout << dateArray[i] << std::endl;
    std::cout << std::flush;

    // Try to put a date in the array
    // outside the range of the subscript.
    Date dt6(1,29,92);
    dateArray[5] = dt6;  // Template's assertion aborts.

    return 0;
}

⌨️ 快捷键说明

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