-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
118 additions
and
168 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+8.63 MB
(130%)
.vs/banksysten1/v16/ipch/AutoPCH/56a00252fd499d32/MAIN.ipch
Binary file not shown.
Binary file modified
BIN
+4.38 MB
(110%)
.vs/banksysten1/v16/ipch/AutoPCH/ecab3328522283e8/ACCOUNT.ipch
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
.vs/banksysten1/v16/ipch/AutoPCH/efa007da48a9b125/DATE.ipch
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
正在生成代码 | ||
1 of 162 functions ( 0.6%) were compiled, the rest were copied from previous compilation. | ||
0 functions were new in current compilation | ||
0 functions had inline decision re-evaluated but remain unchanged | ||
account.cpp | ||
main.cpp | ||
正在生成代码 | ||
68 of 323 functions (21.1%) were compiled, the rest were copied from previous compilation. | ||
43 functions were new in current compilation | ||
46 functions had inline decision re-evaluated but remain unchanged | ||
已完成代码的生成 | ||
banksysten1.vcxproj -> E:\code\cplusplus\banksysten1\Release\banksysten1.exe |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,26 @@ | ||
#include <iostream> // cout | ||
#include <cstdlib> // exit() | ||
#include<iostream> | ||
#include "date.h" | ||
|
||
namespace { // 每月累计天数 | ||
int BEFORE_MONTH_DAYS[] = { 0,31,59,90,120,151,181,212,243,273,304,334,365 }; | ||
} | ||
|
||
const int BEFROE_MONTH_DAYS[] = { 0,31,59,90,120,151,181,212,143,273,304,334,365 }; | ||
Date::Date(int year, int month, int day) :year(year), month(month), day(day) { | ||
if (day > getMaxDays() || day <= 0 || month <= 0 || month > 12 || year < 0 ) { | ||
int years = year - 1; | ||
if (day > getMaxDays()) { | ||
std::cout << "Invalid date!" << std::endl; | ||
exit(1); // 日期无效,退出 | ||
exit(1); | ||
} | ||
int years = year - 1; | ||
totalDays = years * 365 + years / 4 - years / 100 + years / 400 + | ||
BEFORE_MONTH_DAYS[month - 1] + day; | ||
totalDays = years * 365 + years / 4 - years / 100 + years / 400 + BEFROE_MONTH_DAYS[month - 1] + day; | ||
if (isLeapYear()) totalDays++; | ||
} | ||
|
||
int Date::getMaxDays() const { // 获取每月最大天数 | ||
return BEFORE_MONTH_DAYS[month] - BEFORE_MONTH_DAYS[month-1]; | ||
int Date::getMaxDays() const { | ||
return BEFROE_MONTH_DAYS[month] - BEFROE_MONTH_DAYS[month - 1]; | ||
} | ||
|
||
bool Date::isLeapYear() const { | ||
return(year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); | ||
Date Date::read() { | ||
char c; | ||
int year, month, day; | ||
std::cin >> year >> c >> month >> c >> day; | ||
return Date(year, month, day); | ||
} | ||
void Date::show() const{ | ||
|
||
void Date::show() const { | ||
std::cout << year << "-" << month << "-" << day; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
#ifndef DATE_H | ||
#define DATE_H | ||
class Date { | ||
class Date{ | ||
private: | ||
int year; | ||
int month; | ||
int month; | ||
int day; | ||
int totalDays; | ||
public: | ||
Date(int year, int month, int day); | ||
Date(int year=1, int month=1, int day=1); | ||
int getYear() const { return year; } | ||
int getMonth() const { return month; } | ||
int getDay() const { return day; } | ||
bool isLeapYear() const; | ||
int getTotalDays() const{ return totalDays; } | ||
bool isLeapYear() const{ return year % 4 == 0 && year % 100 != 0 || year % 400 == 0; } | ||
int getMaxDays() const; | ||
int getTotalDays() const { return totalDays; } | ||
int operator-(const Date& date) const{ | ||
int operator-(const Date& date) const { | ||
return totalDays - date.totalDays; | ||
} | ||
static Date read(); | ||
bool operator<(const Date& date) const { | ||
return totalDays < date.totalDays; | ||
} | ||
void show() const; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.