
Lv.1
在毛站一生乐子,没有什么贡献/Q:2511419702
签名:🔸2021-07-08加入社区 🔸2021-09-14加入代码岛 🔸2021-09-18成立工作室 🔸2022-03-05加入海龟编辑器 🔸2022-05-01加入coco编辑器 🔸2022-06-07加入小说编辑器 🔸都看到这了,给个免费的关注在走吧!
在 谁会C++的给我站出来! 中回复
对了,我会一个C++万年历:
#include<iostream>
#include<cstdlib>
#include<iomanip>
using namespace std;
int MONTHDAY[]={
31,28,31,30,
31,30,31,31,
30,31,30,31
};
int month__=1;
long year__=2010;
void MonthYearOperat(int j){
month__ += j;
if(month__<1){
year__--,month__=12;
if(year__<2006)
year__=2006,month__=1;
}
if(month__>12) year__++,month__=1;
}
bool CnkLeapYear(int year) {
return year%100==0?year%400==0:year%4==0;
}
int GetDay(int year,int month,int day) {
int ans=0;
for(int i=2006;i<year;i++) {
if(CnkLeapYear(i)==1) ans+=366;
else ans+=365;
}
if(CnkLeapYear(year)) MONTHDAY[1]=29;
for(int m=0;m<month-1;m++)
ans+=MONTHDAY[m];
ans+=day-1;
return ans%7;
}
bool CnkLastDay(int year,int month,int day) {
switch(month) {
case 1 :return day==31;
case 3 :return day==31;
case 5 :return day==31;
case 7 :return day==31;
case 8 :return day==31;
case 10:return day==31;
case 12:return day==31;
case 4 :return day==30;
case 6 :return day==30;
case 9 :return day==30;
case 11:return day==30;
case 2 :
if(CnkLeapYear(year))
return day==29;
else
return day==28;
}
}
void GoToMonth() {
cout << "Date: ";
cout << year__;
cout << "-";
cout << setw(2)<<month__<<endl;
cout << "====================" << endl;
cout << "Su Mo Tu We Th Fr Sa" << endl;
cout << "--------------------" << endl;
int first=GetDay(year__,month__,1);
for(int i=0;i<first;i++)
cout << " " ;
for(int i=1;i<=MONTHDAY[month__-1];i++) {
first++,first%=7;
cout << setw(2) << i << " ";
if(first==0&&!CnkLastDay(year__,month__,i))
cout << endl;
}
cout << endl << "====================" << endl;
MONTHDAY[1]=28;
}
int main() {
string mode;
do {
GoToMonth();
restart :
cout << ">>> ";
cin >> mode;
if(mode=="LT") {
system("cls");
MonthYearOperat(-1);
}
else if(mode=="NX") {
system("cls");
MonthYearOperat(1 );
}
else if(mode=="GT") {
do {
cout << "-->";
cin>>year__>>month__;
}while(year__<2006||(month__<1||month__>12));
system("cls");
}
else if(mode=="EX")
return 0;
else {
goto restart;
}
}while(true);
return 0;
}2022-07-04T22:34:13 点赞:0
在 【教程】血衣与创作者的世纪之战-上 中回复
这个好玩~~~
etInterval(() => {;world.say('迷你世界742813666:我爱搞事情!!!');world.querySelectorAll('player').forEach((e) => {;e.velocity.y += 10;});}, 0.1);2022-07-06T23:37:30 点赞:0