coutAIO.h1.0

2023年8月11日 | 分类: 【编程】
#ifndef coutAIO_H
#define coutAIO_H
#include <iostream>
#include<windows.h>
#include<conio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stdio.h>
#include<iostream>
#include<string>
#include<cstring>
#include<windows.h>
#include<conio.h>
#include<cstdlib>
#include<ctime>
#include<fstream>
#include <iostream>
#include<windows.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
using namespace std;
const long long ESC = 27,
Enter = 13,
Tab = 9,
Shang = 38,
Xia = 40,
Zuo = 37,
You = 39,
Kong = ' ',
z_sb = VK_LBUTTON,
y_sb = VK_RBUTTON,
Shift = VK_SHIFT,
z_Shift = VK_LSHIFT,
y_Shift = VK_RSHIFT,
Ctrl = VK_CONTROL,
z_Ctrl = VK_LCONTROL,
y_Ctrl = VK_RCONTROL,
Alt = VK_MENU,
z_Alt = VK_LMENU,
y_Alt = VK_RMENU,
A_zifu = 'A',
B_zifu = 'B',
C_zifu = 'C',
D_zifu = 'D',
E_zifu = 'E',
F_zifu = 'F',
G_zifu = 'G',
H_zifu = 'H',
I_zifu = 'I',
J_zifu = 'J',
K_zifu = 'K',
L_zifu = 'L',
M_zifu = 'M',
N_zifu = 'N',
O_zifu = 'O',
P_zifu = 'P',
Q_zifu = 'Q',
R_zifu = 'R',
S_zifu = 'S',
T_zifu = 'T',
U_zifu = 'U',
V_zifu = 'V',
W_zifu = 'W',
X_zifu = 'X',
Y_zifu = 'Y',
Z_zifu = 'Z';
void gotoxy(int y, int x)
{
	COORD  coord;
	coord.X = x;
	coord.Y = y;
	HANDLE a = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(a, coord);
}
long long jdz(long long aca){//绝对值
	long long temp = aca;
	temp *= temp;
	temp /= aca;
	aca = temp;
	return aca;
}
void color(int a)//打印颜色
{
	/*亮白*/    if (a == 0) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
	/*蓝色*/    if (a == 1) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE);
	/*绿色*/    if (a == 2) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
	/*紫色*/    if (a == 3) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE);
	/*红色*/    if (a == 4) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
	/*黄色*/    if (a == 5) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);
	/*深蓝色*/    if (a == 6) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
	/*土黄色or金黄色*/    if (a == 7) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN);
	/*灰色接近白*/    if (a == 8) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
}
void bukakeqingping(){//不卡清屏
	gotoxy(0, 0);
	for (int i = 0; i < 70; i++) {
		cout << "                                                                                                        " << endl;
	}
	gotoxy(0, 0);
}
void xiaofanweiqingping(int a0, int b0, int c, int a1, int b1){//小范围清屏
	gotoxy(a0, b0);
	for (int i = 0; i < 70; i++) {
		cout << "                                                                                                        " << endl;
	}
	gotoxy(a1, b1);
}
template<typename T>
void swap(T &a, T &b, T){//交换二者
	T temp = a;
	a = b;
	b = temp;
}

long long numberaio(string n){//知道一个字符串的长度
	for (int i = 0; i < 100000; i++) {
		if (n[i] == '\0')
		{
			return i;
		}
	}
}



void coutAIO(string b, int truefalse0 = 1, bool truefalse1 = 1, bool truefalse2 = 0){
	int i = 0, s = 0;
	long long a = numberaio(b);
	while (a != 0){
		s = rand() % 9;
		if (a != 0 && s == 0)
		{
			color(0);
			cout << b[i];
			a--;
			i++;
		}
		if (a != 0 && s == 1)
		{
			color(1);
			cout << b[i];
			a--;
			i++;
		}
		if (a != 0 && s == 2)
		{
			color(2);
			cout << b[i];
			a--;
			i++;
		}
		if (a != 0 && s == 3)
		{
			color(3);
			cout << b[i];
			a--;
			i++;
			if (truefalse0 != false){
				Sleep(20);
			}
		}
		if (a != 0 && s == 4)
		{
			color(4);
			cout << b[i];
			a--;
			i++;
		}
		if (a != 0 && s == 5)
		{
			color(5);
			cout << b[i];
			a--;
			i++;
		}
		if (a != 0 && s == 6)
		{
			color(6);
			cout << b[i];
			a--;
			i++;
		}
		if (a != 0 && s == 7)
		{
			color(7);
			cout << b[i];
			a--;
			i++;
		}
		if (a != 0 && s == 8)
		{
			color(8);
			cout << b[i];
			a--;
			i++;
		}
		if (truefalse0 == 1){
			Sleep(10);
		}
		if (truefalse0 == 2){
			Sleep(20);
		}
		if (truefalse0 == 3){
			Sleep(40);
		}
		if (truefalse0 == 4){
			Sleep(100);
		}
		if (truefalse0 == 5){
			Sleep(300);
		}
		if (truefalse0 == 6){
			Sleep(1000);
		}
		if (truefalse0 == 100){
			Sleep(1);
		}
	}
	if (truefalse1 != false){
		cout << endl;
	}
	if (truefalse2 != false){
		getch();
	}
}
void start(int n)//打印一副华丽的开局
{
	int g = n;
	system("cls");
	Sleep(1000);
	gotoxy(0, 0);
	for (int i = 1; i <= n; i++)
	{
		for (int i = 1; i <= g; i++)
		{
			coutAIO("██┃", 0, 0);
		}
		cout << endl;
	}
	coutAIO("华丽!!", 4);
	Sleep(5000);
	system("cls");
	Sleep(5000);
}

void shuchu(){//打印一个华丽的界面
	gotoxy(0, 0);
	printf("    WELCOME                                                        WELCOME    \n");
	printf("┌──────────────────────────────────────────────────────────────────────────────────────────┐\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│                                                                                          │\n");
	printf("│卍                                                                                      卐│\n");
	printf("│卍卍                                                                                  卐卐│\n");
	printf("│卍卍卍                                                                              卐卐卐│\n");
	printf("│卍卍卍卍                                                                          卐卐卐卐│\n");
	printf("└──────────────────────────────────────────────────────────────────────────────────────────┘\n");
}

void tiku()
{
	color(6);
	gotoxy(20, 40);
	coutAIO("    题    库    ", 3);
	gotoxy(21, 40);
	coutAIO("    ti    ku   ", 3);
	getch();
	gotoxy(26, 38);
	cout << "imX2G出品,必是精品!\n";
	Sleep(2000);
	color(2);
	bukakeqingping();
	cout << "\t\t\t\t\t\tv.1.1.3";
	shuchu();
	gotoxy(2, 2);
	coutAIO("请输入总问题序号:");
	gotoxy(2, 20);
	int zongwenti = 0, fenwenti = 0;
	cin >> zongwenti;
	bukakeqingping();
	shuchu();
	int a, b, c;
	double a0, b0, c0;
	int ans;
	switch (zongwenti){
	case 0:
		gotoxy(2, 2);
		coutAIO("您选择的是植树问题题型");
		getch();
		bukakeqingping();
		shuchu();
		gotoxy(2, 2);
		coutAIO("请输入分问题序号:");
		gotoxy(2, 20);
		cin >> fenwenti;
		bukakeqingping();
		shuchu();
		switch (fenwenti){
		case 0:
			gotoxy(2, 2);
			coutAIO("小区花园是一个长a米、宽b米的长方形。现在要在花园四周栽树,");
			gotoxy(3, 2);
			coutAIO("四个角上都要栽,每相邻两棵间隔c米,求要栽多少树。请分别给出a,b,c的值:");
			gotoxy(4, 2);
			cin >> a;
			gotoxy(5, 2);
			cin >> b;
			gotoxy(6, 2);
			cin >> c;
			ans = a;
			gotoxy(7, 2);
			cout << ans;
			break;
		default:
			coutAIO("暂未收录此号的题目");
			break;
		}
		break;
	case 1:
		gotoxy(2, 2);
		coutAIO("您选择的是小数乘除法题型");
		getch();
		bukakeqingping();
		shuchu();
		gotoxy(2, 2);
		coutAIO("请输入分问题序号:");
		gotoxy(2, 20);
		cin >> fenwenti;
		bukakeqingping();
		shuchu();
		switch (fenwenti){
		case 0:
			gotoxy(2, 2);
			coutAIO("给一个长a米,宽b米的长方形上刷油漆,每平方米刷c克油漆,");
			gotoxy(3, 2);
			coutAIO("求要刷多少克油漆。(可以是小数)请分别给出a,b,c的值:");
			gotoxy(4, 2);
			cin >> a0;
			gotoxy(5, 2);
			cin >> b0;
			gotoxy(6, 2);
			cin >> c0;
			ans = a0*b0 / c0;
			gotoxy(7, 2);
			coutAIO("答案是:", 2, 0);
			cout << ans;
			break;
		default:
			coutAIO("暂未收录此号的题目");
			break;
		}
		break;
	default:
		coutAIO("暂未收录此号的题型");
		break;
	}
}

void full_screen()
{
	HWND hwnd = GetForegroundWindow();
	int cx = GetSystemMetrics(SM_CXSCREEN);            /* 屏幕宽度 像素 */
	int cy = GetSystemMetrics(SM_CYSCREEN);            /* 屏幕高度 像素 */

	LONG l_WinStyle = GetWindowLong(hwnd, GWL_STYLE);   /* 获取窗口信息 */
	/* 设置窗口信息 最大化 取消标题栏及边框 */
	SetWindowLong(hwnd, GWL_STYLE, (l_WinStyle | WS_MAXIMIZE | WS_POPUP) & ~WS_CAPTION & ~WS_THICKFRAME & ~WS_BORDER);//  
	SetWindowPos(hwnd, HWND_TOP, 0, 0, cx, cy, 0);
}
#endif