|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 Sj中国智造 于 2018-5-13 13:54 编辑
- #include <windows.h>
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #include <cmath>
- #include <string>
- #include <tchar.h>
- #pragma comment(lib,"Winmm.lib")//播放音乐的
- using namespace std;
- float f(float x, float y, float z) {
- float a = x * x + 9.0f / 4.0f * y * y + z * z - 1;
- return a * a * a - x * x * z * z * z - 9.0f / 80.0f * y * y * z * z * z;
- }
- float h(float x, float z) {
- for (float y = 1.0f; y >= 0.0f; y -= 0.001f)
- if (f(x, y, z) <= 0.0f)
- return y;
- return 0.0f;
- }
- int main()
- {
- system("mode con cols=120 lines=40");
- HANDLE fd = GetStdHandle(STD_OUTPUT_HANDLE);
- CONSOLE_CURSOR_INFO cinfo;
- cinfo.bVisible = 0;
- cinfo.dwSize = 1;
- SetConsoleCursorInfo(fd, &cinfo);
- MessageBox(NULL, TEXT("开始前,请把电脑的声音开大!"), TEXT("即将开始...."), MB_ICONINFORMATION);
- MessageBox(NULL, TEXT("今天是2018年5月13日,妈妈,母亲节快乐!"), TEXT("开始"), MB_OK);
- mciSendString(TEXT("open "./muqin.mp3" alias mymusic"), NULL, 0, NULL);
- mciSendString(TEXT("play mymusic"), NULL, 0, NULL);
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x0C);
- HANDLE o = GetStdHandle(STD_OUTPUT_HANDLE);
- _TCHAR buffer[25][80] = { _T(' ') };
- _TCHAR ramp[] = _T(".:-=+*#%@");
- int count = 0;
- int count1 = 0;
- double second = 270;
- int minute = int (second/60);
- for (float t = 0.0f;minute!=0; t += 0.1f) {
- int sy = 0;
- float s = sinf(t);//返回一个sin的浮点数
- float a = s * s * s * s * 0.2f;
- for (float z = 1.3f; z > -1.2f; z -= 0.1f) {
- _TCHAR* p = &buffer[sy++][0];
- float tz = z * (1.2f - a);
- for (float x = -1.5f; x < 1.5f; x += 0.05f) {
- float tx = x * (1.2f + a);
- float v = f(tx, 0.0f, tz);
- if (v <= 0.0f) {
- float y0 = h(tx, tz);
- float ny = 0.01f;
- float nx = h(tx + ny, tz) - y0;
- float nz = h(tx, tz + ny) - y0;
- float nd = 1.0f / sqrtf(nx * nx + ny * ny + nz * nz);
- float d = (nx + ny - nz) * nd * 0.5f + 0.5f;
- *p++ = ramp[(int)(d * 5.0f)];
- }
- else
- *p++ = ' ';
- }
- }
- for (sy = 0; sy < 25; sy++) {
- COORD coord = { 0, sy };
- SetConsoleCursorPosition(o, coord);
- WriteConsole(o, buffer[sy], 79, NULL, 0);
- }
- Sleep(66);
- second = second - 100.0 / 1000;
- minute =int(second / 60);
- cout << "祝老妈2018年母亲节快乐!" << endl;
- cout << "\t\t\t\t\t\t\t\t\t\t\t致我最最爱的妈妈!-------儿子" << endl<<endl<<endl;
- printf("\t\t\t\t\t\t\t\t\t\t还剩%d分钟哦!请耐心等待,末尾有彩蛋!\n",minute);
- }
- system("cls");//清屏
- for (int i = 0; i < 10; i++)
- {
- COORD coord = { 50,10 };
- SetConsoleCursorPosition(o, coord);
- printf("%d秒后,惊喜即将出现!\n", 10-i);
- Sleep(1000);
- }
- COORD coord = { 0,0 };
- SetConsoleCursorPosition(o, coord);
- for (int i = 0; i < 10; i++)
- {
- cout << "ooooooooooooooooooooo\t\t\t\t\t\t\tooooo\t\t\tooooo" << endl;
- cout << "ooooooooooooooooooooo\t\t\t\t\t\t\tooooo\t\t\tooooo" << endl;
- cout << "ooooooooooooooooooooo\t\t\t\t\t\t\tooooo\t\t\tooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << " oooooo ooooo ooooo" << endl;
- cout << "ooooooooooooooooooooo \t\t oooo oooo " << endl;
- cout << "ooooooooooooooooooooo \t\t ooo ooo " << endl;
- cout << "ooooooooooooooooooooo \t\t ooooooooooooooooooo " << endl;
-
- Sleep(1000);
- coord.X = 0;
- coord.Y = 0;
- SetConsoleCursorPosition(o, coord);
- for (float y = 1.5f; y > -1.5f; y -= 0.1f) {
- for (float x = -1.5f; x < 1.5f; x += 0.05f) {
- float a = x * x + y * y - 1;
- putchar(a * a * a - x * x * y * y * y <= 0.0f ? '*' : ' ');
- }
- putchar('\n');
- Sleep(33);
- }
- Sleep(1000);
- system("cls");
- if (i == 3)
- {
- mciSendString(TEXT("stop mymusic"), NULL, 0, NULL);
- system(".\\2.mp4");
- }
- }
- return 0;
- }
复制代码
源码上传,资源文件请通过百度云下载,在win7和win10上运行正常!祝全天下母亲母亲节快乐!!
链接: https://pan.baidu.com/s/1t8HoTq3DWJks6CIkJAkOEQ 密码: f2gp |
|