資源簡介
C++實戰源碼-何年是閏年(入門級實例045).zip
代碼片段和文件信息
//?LeapYear.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?“stdafx.h“
int?main()
{
int?year; //定義基本整型變量year
printf(“請輸入年份:\n“);
scanf(“%d“?&year); //從鍵盤輸入表示年份的整數
printf(“╔═════════════════╗\n“);
printf(“║??????????????????????????????????║\n“);
if?((year?%?4?==?0?&&?year?%?100?!=?0)?||?year?%?400?==?0) //判斷閏年條件
printf(“║???????????%d年是閏年???????????║\n“?year); //滿足條件的輸出是閏年
else
printf(“║???????????%d年不是閏年?????????║\n“?year); //否則輸出不是閏年
printf(“║??????????????????????????????????║\n“);
printf(“╚═════════════════╝\n“);
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????730??2010-07-31?14:38??LeapYear\LeapYear.cpp
?????文件????????4560??2010-07-31?14:18??LeapYear\LeapYear.dsp
?????文件?????????541??2010-07-31?14:18??LeapYear\LeapYear.dsw
?????文件?????????295??2010-07-31?14:18??LeapYear\StdAfx.cpp
?????文件?????????769??2010-07-31?14:18??LeapYear\StdAfx.h
- 上一篇:C++實戰源碼-const函數的使用
- 下一篇:C++實戰源碼-遍歷磁盤目錄
評論
共有 條評論