#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>
using namespace std;
void gotoxy(int y,int x)
{
COORD coord;
coord.X=x;
coord.Y=y;
HANDLE a=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(a,coord);
}
void bukakeqingping(){
gotoxy(0,0);
for (int i = 0; i < 100; i++) {
cout << " " << endl;
}
gotoxy(0,0);
}
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);
}
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 truefalse3 = 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(truefalse3!=false){
getch();
bukakeqingping();
}
}
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);
//ksjm();
//start();
}
void sjxjs()
{
color(6);
gotoxy(20,40);
coutAIO(" 三 角 形 面 积 计 算 ",3);
gotoxy(22,40);
coutAIO(" sān jiǎo xíng miàn jí jì suàn",3);
Sleep(2000);
gotoxy(24,40);
coutAIO(" H E P P Y ",3);
Sleep(200);
gotoxy(26,40);
coutAIO(" 作者: i m X 2 G ",3);
Sleep(1000);
color(3);
gotoxy(28,45);
coutAIO(" imX2G出品,必是精品! ",3);
Sleep(2000);
color(2);
system("cls");
start(60);
gotoxy(0,60);
system("cls");
bool xii=true;
while(xii)
{
cout<<"\t\t\t\t\t\tv.1.0.0";
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");
double a,b,c,hcy,ans;
gotoxy(2,2);
coutAIO("这是一个三角面积计算器,请输入第一、二、三条边:");
gotoxy(3,2);
cin >> a;
gotoxy(4,2);
cin >> b;
gotoxy(5,2);
cin >> c;
gotoxy(6,2);
if(a+b<=c||a+c<=b||b+c<=a||a<0||b<0||c<0){
bukakeqingping();
color(4);
cout<<"这个图形不符合三角形的成立条件!!!";
Sleep(3000);
bukakeqingping();
goto flag;
}
hcy=(a+b+c)/2;
ans=sqrt(hcy*(hcy-a)*(hcy-b)*(hcy-c));
coutAIO("这个三角形的面积是:");
gotoxy(6,8);
cout << ans;
flag:
gotoxy(7,2);
coutAIO("输入0退出,输入1继续");
gotoxy(6,18);
cin >> xii;
bukakeqingping();
}
}
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);
}
int main()
{
full_screen();
sjxjs();
gotoxy(27,2);
getch();
exit(0);
}