1.前言
今天是母亲节,祝全天下的母亲节日快乐,除此之外,我还带来了c++的代码,用c++代码送来额外的祝福。
2.源码
这段代码支持中英双语祝福,
以下是作者写的c++代码
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
void drawheart() {
cout << " ***** *****\n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << " ******* *******\n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << "********* *********\n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << "*******************\n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << " *****************\n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << " *************** \n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << " ************* \n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << " *********** \n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << " ********* \n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << " ******* \n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << " ***** \n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << " *** \n";
std::this_thread::sleep_for(std::chrono::milliseconds(300));
cout << " * \n";
std::this_thread::sleep_for(std::chrono::milliseconds(700));
}
bool lan(int l) { //0为中文,1为英文。
if (l == 1) {
return 0;
}
if (l == 2) {
return 1;
}
}
void cn() {
cout << "今天是母亲节" << endl;
std::this_thread::sleep_for(std::chrono::milliseconds(900));
cout << "祝天下所有母亲母亲节快乐" << endl;
std::this_thread::sleep_for(std::chrono::milliseconds(900));
cout << "愿天堂的母亲无忧无愁" << endl;
std::this_thread::sleep_for(std::chrono::milliseconds(900));
cout<<"6秒后有惊喜"<<endl;
std::this_thread::sleep_for(std::chrono::milliseconds(6000));
drawheart();
cout<<"我爱你,母亲";
}
void eng()
{
cout << "Today is Mother's Day" << endl;
std::this_thread::sleep_for(std::chrono::milliseconds(900));
cout << "Wishing all mothers in the world a happy Mother's Day" << endl;
std::this_thread::sleep_for(std::chrono::milliseconds(900));
cout << "May the mother of heaven be carefree and carefree" << endl;
std::this_thread::sleep_for(std::chrono::milliseconds(900));
cout<<"Surprise in 6 seconds"<<endl;
std::this_thread::sleep_for(std::chrono::milliseconds(6000));
drawheart();
cout<<"I love you, mother";
}
int main() {
cout << "请选择语言(填数字):" << endl;
cout << "Please select language (fill in numbers):" << endl;
int l;
cout << "[1]中文" << endl;
cout << "[2]English" << endl;
cin >> l;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, FOREGROUND_RED);
if (lan(l)) {
eng();
} else {
cn();
}
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
return 0;
}
3.相关软件
为了运行上面的代码,这里我推荐dev-cpp:
4.后记
这段代码是给天下所有母亲写的,希望我这个代码会给更多的母亲看到。
作者向所有伟大的母亲致敬,有了您,才有了我们。