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

📄 main.cpp

📁 this a good book.
💻 CPP
字号:
#include<iostream.h>
#include<fstream>
#include<iomanip>
#include<cmath>
using namespace std;

void WriteFile(int c)
{
	ofstream out1;
	out1.open("out3.txt",ios_base::app);
	out1 << c << ' ';
    out1.close();
}
void WriteFile(char* str)
{
	ofstream out1;
	out1.open("out3.txt",ios_base::app);
	out1 <<str;
    out1.close();
}
void ClearFile()
{
	ofstream out1;
	out1.open("out3.txt");
    out1.close();
}

class Date
{
public:
	Date(int y,int m,int d)
	{
// * * 2 * *
		
	}
	void print() const;
	// * * 3 * *

	{
		month+=m;
		int i = month/12;
		int j = month%12;

		if( j==0)
		{
			year += (i-1);
			month = 12; 
		}
		else
		{
			year += i;
			month = j;
		}
		return *this;
	}

private:
	// * * 1 * *
	
};

void Date::print() const
{
	// * * 4 * *

	WriteFile(year);
	WriteFile("年");
	WriteFile(month);
	WriteFile("月");
	WriteFile(day);
	WriteFile("日");
}

int main()
{
	ClearFile();
	Date national_day(1959,10,1);
	national_day += 3;
	national_day.print();
	return 0;
}

⌨️ 快捷键说明

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