跳到正文

休闲·娱乐

想不清楚怎么用

qqqaaazzz_qwq约 6 分钟
原文
文章信息与版本

文章信息

发布
2026年8月27日
收录
2026年8月29日
更新
2026年11月9日
篇幅
约 6 分钟

版本

  1. v1当前
C++
#include <bits/stdc++.h>
#include <windows.h>

#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)

using namespace std;

int mon[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int run(int x){
	if(x%400==0||x%4==0&&x%100!=0)return 1;
	else return 0;
}
string F[]={"日","一","二","三","四","五","六"};
int y=2026,m=8,d=27,s=14,f=36,ms=40;
int u=4;

void play(){
	ms++;
	if(ms==60)ms=0,f++;
	if(f==60)f=0,s++;
	if(s==24)s=0,d++,u=(u+1)%7;
	if(d==mon[m]+(m==2&&run(y))+1)d=1,m++;
	if(m==13)y++,m=1;
}
void gotoxy(int x,int y)
{
    COORD pos = {x,y};
    HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOut,pos);
    return;
}
int all[5000010];
string gan[5000010];
int cnt;
string t(string f){
	for(auto &i:f)i=(i+111)%256;
	return f;
}
string t2(string f){
	for(auto &i:f)i=(i+145)%256;
	return f;
}

void end(){
	freopen("CuteLocalStorage.qaz","w",stdout);
	cout<<cnt<<"\n";
	for(int i=1;i<=cnt;i++){
		cout<<all[i]<<" "<<gan[i]<<"\n";
	}
	exit(0);
}

signed main()
{
//	FILE *ori_stdin = stdin; // 保存原来标准输入指针
	cout<<"记下来此时此刻想说的话吧!!\n";
	string cc;
	cin>>cc;
	int UU=time(0);
	system("cls"); 
	
	freopen("CuteLocalStorage.qaz","r",stdin);
	cin>>cnt;
	for(int i=1;i<=cnt;i++){
		cin>>all[i]>>gan[i];
	}
	if(cnt>1)cout<<"欢迎回来!! "<<all[cnt]-all[cnt-1]<<" 秒不见,甚是想念\n";
	else cout<<"初次见面!!\n";
	
	int bonus=time(0)-1787812600;
	while(bonus--){
		play();
	}
	int old=time(0);
	cout<<y<<" 年 "<<m << " 月 "<<d<<" 日 星期"<<F[u]<<"\n";
	cout<<"现在是 "<<s<<" 点 "<<f<< " 分 "<<ms<<" 秒\n";
	while(1){ 
		if(time(0)!=old){
			old=time(0);
			play();
			gotoxy(0,1);
			cout<<"                                                  \n                                                  \n";
			gotoxy(0,1);
			cout<<y<<" 年 "<<m << " 月 "<<d<<" 日 星期"<<F[u]<<"\n";
			cout<<"现在是 "<<s<<" 点 "<<f<< " 分 "<<ms<<" 秒\n";
		}
		if(KEY_DOWN(VK_SPACE)){
			++cnt;
			all[cnt]=UU;
			gan[cnt]=cc;
			cout<<"再见!欢迎下次再来!!!\n";
			end();
		}
	}
	return 0;
}
C++
#include <iostream>
#include <fstream>
using namespace std;

const char FILENAME[] = "DreamOfYou.cute";

// READ:从文件读取3个整数存入数组a,打开失败不修改数组
void READ(int a[])
{
    ifstream fin(FILENAME);
    if (!fin.is_open())
    {
        return;
    }
    fin >> a[0] >> a[1] >> a[2];
    fin.close();
}

// WRITE:把数组a[0],a[1],a[2]写入文件;只有成功打开才写入,避免清空文件
void WRITE(const int a[])
{
    ofstream fout(FILENAME);
    if (!fout.is_open())
    {
        return;
    }
    fout << a[0] << " " << a[1] << " " << a[2];
    fout.flush();
    fout.close();
}

int main()
{
    int buf[3] = {0, 0, 0};
    while (true)
    {
        int x, y, z;
        cin >> x >> y >> z;

        // 输入 -1 -1 -1,直接结束程序,不操作文件
        if (x == -1 && y == -1 && z == -1)
        {
            break;
        }

        if (x == 0 && y == 0 && z == 0)
        {
            READ(buf);
            cout << "Last : " << buf[0] << "," << buf[1] << "," << buf[2] << endl;
        }
        else
        {
            buf[0] = x;
            buf[1] = y;
            buf[2] = z;
            WRITE(buf);
            cout << "ok" << endl;
        }
    }
    return 0;
}
原文