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

📄 pr06008.cpp

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

// Function prototype.
void DisplayCalendar(int cal[][7]);

////////////////////////////////////////
// The main() function.
////////////////////////////////////////
int main()
{
    static int calendar[5][7] =
    {
        {  1, 2, 3, 4, 5, 6, 7 },
        {  8, 9,10,11,12,13,14 },
        { 15,16,17,18,19,20,21 },
        { 22,23,24,25,26,27,28 },
        { 29,30,31 }
    };

    DisplayCalendar(calendar);

    return 0;
}

////////////////////////////////////////
// The cal argument here points to the
// first element of an array of seven-
// element arrays.
////////////////////////////////////////
void DisplayCalendar(int cal[][7])
{
    std::cout << "Sun Mon Tue Wed Thu Fri Sat" << std::endl;

    for (int week = 0; week < 5; week++)
    {
        for (int day = 0; day < 7; day++)
        {
            int date = cal[week][day];
            if (date)
                std::cout << std::setw(3) << date << ' ';
        }

        std::cout << std::endl;
    }
}

⌨️ 快捷键说明

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