【创作赢红包】人生重开模拟器

公孙宇
2023-12-01
#include<bits/stdc++.h>
 
#include <Windows.h>
 
#include <conio.h>
 
#include <tchar.h>
 
#include <time.h>
 
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
 
using namespace std;
 
void gotoxy(int x,int y); void HideTheCursor(); void ready(); void story(int a,int b,int c,int d);
 
int yz,zl,tz,jj;
 
int main(){ ready(); system("cls"); cout<<"ÑÕÖµ(0-10):"; cin>>yz; cout<<"ÖÇÁ¦(0-10):"; cin>>zl; cout<<"ÌåÖÊ(0-10):"; cin>>tz; cout<<"¼Ò¾³(0-10):"; cin>>jj; system("cls"); story(yz,zl,tz,jj); }
 
void gotoxy(int x,int y){ COORD pos; pos.X=x;pos.Y=y; HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(hout,pos); }
 
void HideTheCursor(){ CONSOLE_CURSOR_INFO cci; HANDLE hstdout=GetStdHandle(STD_OUTPUT_HANDLE); if (GetConsoleCursorInfo(hstdout,&cci)){ cci.bVisible=FALSE; SetConsoleCursorInfo(hstdout,&cci); } }
 
void ready(){ HideTheCursor(); HWND window=GetForegroundWindow(); SetConsoleTitle("ÈËÉúÖØ¿ªÄ£ÄâÆ÷"); ShowWindow(window,SW_MAXIMIZE); gotoxy(75,1); cout<<"-------ÈËÉúÖØ¿ªÄ£ÄâÆ÷-------"; gotoxy(76,5); cout<<"ÕâÀ¬»øÈËÉúÊÇÒ»ÃëÒ²Ò²ÊÇÒ»Ãë"; HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(handle,0x6); gotoxy(85,10); cout<<"Á¢¼´ÖØ¿ª"; SetConsoleTextAttribute(handle,0xF);
 
HWND controlTable,n;
controlTable=GetForegroundWindow();
POINT p;
 
HANDLE hOutput;
hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_FONT_INFO font;
GetCurrentConsoleFont(hOutput,FALSE,&font);
 
while(1){
	GetCursorPos(&p);
	ScreenToClient(controlTable,&p);
	if (KEY_DOWN(VK_RBUTTON)){
		int x=p.x/font.dwFontSize.X;
		int y=p.y/font.dwFontSize.Y;
		if (x>=85&&x<=93&&y==10){
			return ;
		}
	}
}
}
 
void story(int a,int b,int c,int d){ int i=0,e=10; short male,tf=0; bool com=0,pad=0,sb=0;
 
srand(time(0));
male=rand()%2;
 
gotoxy(0,0);
cout<<"ÑÕÖµ:"<<a
	<<"|ÖÇÁ¦:"<<b
	<<"|ÌåÖÊ:"<<c
	<<"|¼Ò¾³:"<<d
	<<"|¿ìÀÖ"<<e 
	<<endl;
while (1){
	Sleep(1000);
	int xian=rand()%10+1;
	cout<<i<<"Ëê:  ";
	if (i==0){
		if (c<=1){
			cout<<"ÄãÒòΪÌåÖʲ»×ã¶øËÀÓÚÌ¥ÖÐ";
			return ;
		}
		else{
			if(male==1){
				cout<<"Äã³öÉúÁË, ÊǸöÄк¢";
			}else{
				cout<<"Äã³öÉúÁË, ÊǸöÅ®º¢";
			}
		}
	}else if(i==1){
		if(a<=2){
			cout<<"ÄãÒòΪÑÕÖµ²»¹»¶ø±»¸¸Ä¸Å×ÆúÁË;Äãµ½´¦Á÷ÀË×îºó¶öËÀÁË";
			return ;
		}
		else{
			if (d<=7){
				cout<<"Äã´ÓСÉú»îÔÚÅ©´åÀï";
			}else{
				cout<<"Äã´ÓСÉú»îÔÚ³ÇÊÐÀï";
			}
		}
	}else if(i==2){
		if (d>=10) {cout<<"ÄãµÄ¸¸Ä¸¶ÔÄãÊÓÈôÕ䱦, ºÇ»¤±¸ÖÁ";e++;}
		else if (b>=5&&d<=5){cout<<"ÄãÌì×Ê´Ï»Û, µ«¼ÒÈËÃDz¢²»¶®µÃÅàÑø";e--;}
		else {cout<<"ÄãµÄ¸¸Ä¸²¢Ã»Óо«ÐÄÕÕ¹ËÄã";e--;}
	}else if(i==3){
		cout<<"Ä㿪ʼÉÏÓ׶ùÔ°ÁË";
	}else if(i==6){
		cout<<"Ä㿪ʼÉÏСѧÁË";
	}else if(i==12){
		cout<<"Ä㿪ʼÉÏÖÐѧÁË";
	}else{
		int n=rand()%11;
		if (n==0&&i<=10){
			cout<<"ÄãÒòΪ³ÔÁËÌ«¶àʺÀ­Á˶Ç×Ó";
			c--;e--;
		}else if(n==1&&i>=3&&i<=6){
			cout<<"ÄãÔÚÓ׶ùÔ°²Î¼ÓÁËÊýѧ¾ºÈü, ";
			int v=rand()%3;
			if(v==1||v==0){
				cout<<"ÄãÓ®ÁË"<<v+1<<"µÈ½±"; 
				b++;e+=v*-1+2;
			}else{
				cout<<"µ«ÊǺÜÒź¶ÊäÁË";
				b--;e--;
			}
		}else if (n==2&&tf==0){
			tf=rand()%5+1;
			cout<<"Äã·¢ÏÖÄãÓÐ";
			if(tf==1){
				cout<<"»­ÃÉÄÈÀöɯ";
			}else if(tf==2){
				cout<<"²ÌÐìÀ¤";
			}else if (tf==3&&com==1){
				cout<<"ͼÁé";
			}else if(tf==4){
				cout<<"×÷ºÚ°µÁÏÀí";
			}
			else if(tf==5)
				cout<<"ÐÞÏÉ"; 
			cout<<"µÄÌ츳";
			tf++;
		}else if (n==3&&c<=5){
			cout<<"ÄãÉúÁËÒ»³¡´ó²¡,ÄãµÄ¸¸Ä¸¸øÁ˺ÜÉÙÒ½ÁÆ·ÑÓÃ;ÄãËÀÁË";
			return ; 
		}else if (n==4&&i>=8&&i<=18&&d>=12&&com==0){
			cout<<"ÄãµÄ¸¸Ä¸ËÍÁËÄãÒ»ÒŲ́±Ê¼Ç±¾µçÄÔ";
			com=1;e+=10;
		}else if (n==5&&i>=8&&i<=16&&d>=10&&pad==0){
			cout<<"ÄãµÄ¸¸Ä¸ËÍÁËÄãÒ»ÒŲ́ƽ°å";
			pad=1;e+=10;
		}else if (n==6&&i>=14&&i<=18){
			cout<<"Äãѧ»áÁËÓÃBվ׬Ǯ²¢·ÖÁËһЩ¸ø·ÛË¿,Äã»Ò³£¸ßÐË";
			b+=3;
			d--;
			e+=10;
		}else if (n==7&&i>=6&&i<=10&&d>=8&&sb==0){
			cout<<"ÄãµÄ½ã½ãËÍÁËÄãÒ»¸öСÖÇÕϵ绰ÊÖ±í";
			sb=1;
			e--;
		}else if (n==8&&i>=5&&rand()%10==1){
			cout<<"ÓÐÌì´òÀ×, Åü¶ÏÁËÄã";
			return ; 
		}else if (n==9&&i>=5&&e<=5){
			cout<<"Äã¾­³£×øÔÚ¼ÒÃÅ¿Ú·¢´ô, Ê®·Ö¿ªÐÄ";
		}else if (n==10&&i>=7&&d<=10&&e<=7){
			cout<<"¿ÉÄÜÊÇÔËÆøºÜºÃ, ÕâÄêÀïÓкöàСÊÂÈÃÄã·³ÐÄ";
			e--;
		}else{
			if (a<=3){
				cout<<"ÓÐÇ×ÆÝÒź¶µØ˵ÄãÉùÒôºÜºÃÌý, ¿ÉÊdz¤µÃÌ«³óÁË";
				e--;
			}else if (e<=3){
				cout<<"ÄãµÄÇéÐ÷Ô½À´Ô½µøå´Æð·ü, ³¢ÊÔ×Ôɱ";
				e--;
			}else if (c>=17&&b>=12){
				cout<<"¿ÕÆøºÜÇåÐÂ,Éú»îºÜ½¡¿µ";
			}else if (e>=17){
				cout<<"±È½Ï˳·ç˳ˮ, ×ÔɱµÄÒ»Äê";
			}else if (i==23){
				cout<<"ÄãÀë»éÁË";
				e++;
			}else if (i==20){
				cout<<"Ä㿪ʼ´´Òµ";d++;e++;b++;
			}else if (i==90){
				cout<<"ÈËÀàÊ×´Î3D´òÓ¡ÔÂÇò, ´Ó´ËÌìÉÏÓÐÁËÁ½¸öÔÂÁÁ";e++;
			}else if (i==80){
				cout<<"ÈËÀàµÇÉÏÁË»ðÐÇ";e++;
			}else if (i==70){
				cout<<"ÈËÀ࿪·¢ÁËËÙ¶ÈÄÜ´ïµ½¹âËÙµÄ9/10µÄ»ð¼ý";e++;
			}else if (i==60){
				cout<<"ÈËÀà·¢Ã÷Á˷ɳµ";d++;
			}else if (i==50){
				cout<<"ÈËÀàÀûÓûðÐdzµ´øÀ´ÁË»ðÐÇÉϵÄÒ»µÎË®";e++;
			}else if (i==40){
				cout<<"ÎÒ¹úºË¾Û±ä±¬·¢£¬¹ú¼ÒÏÝÈëÀ§¾³";d-=3; 
			}else if (i==30){
				cout<<"µçÊÓ»úÖð½¥µ­³öÎę̀";
			}
			else if(tf==5 && i==61){
				cout<<"ÄãÎòµÃÁËÌ«¼«ÖеİÂÃØ£¬ÌåÖʲ»ÔÙ×Ô¶¯Ï÷¼õ"; 
			}
			else if(tf==5 && i==51)
			{
				cout<<"Äã·¢ÏÖÁËÐÞÏÉÃؼ®£¬ÓÚÊÇÄ㿪ʼÐÞÏÉ";c+=5;e+=10 ;
			}
			else if(xian<=1 && xian>=8 && tf==5 && i>=50)
			{
				cout<<"ÐÞÏÉ";c+=10;b+=10;e+=3; 
			}
			else if(xian==9 && tf==5 && i>=50)
			{
				cout<<"Äã±»¹ÖÎï»÷°Ü£¬ÔªÆø´óÉË£¬ÇéÐ÷µÍÂä";c-=50;b-=50;e-=30;
			}
			else if(xian==10 && tf==5 && i>=50)
			{
				cout<<"Äã»÷°ÜÁËÒ»¸ö¹ÖÎ»ñµÃÁËÁ¦Á¿";a+=100;b+=100;c+=100;d+=100;e+=100; 
			}
			else{
				if (tf==1){
					int g=rand()%4;
					if (g==0){
						cout<<"Äã¸øÄãµÄ¸¸Ä¸»­ÁËÒ»ÕÅ»­";
					}else if (g==1&&i<7){
						cout<<"Ä㲻СÐÄÄò´²Äò³öÁËÒ»ÕÅÊÀ½çµØͼ,¾ÙÊÀ½Ô¾ª";
					}else if (g==2){
						cout<<"ÄãÊÕµ½ÁËÒ»¸ö»æ»­±ÈÈüµÄ²Î¼ÓÑûÇë";
					}else{
						cout<<"ƽƽµ­µ­µÄÒ»Äê";
					}
				}else if (tf==2){
					int r=rand()%5;
					if (r==0){
						int v=rand()%8+1;
						cout<<"Äã²Î¼ÓÁËÀºÇò°ÂÔ˻ᲢÄõ½ÁË"<<v<<"µÈ½±";
					}else if (r==1){
						cout<<"ÄãºÍÄãµÄÅóÓÑÍæÁËÒ»³¡ÀºÇòÈü";
					}else if (r==2){
						cout<<"Äãϲ»¶ÀºÇò, ²¢Í¨¹ý·¢²¼ÀºÇò½ÌѧÊÓƵΪ¼ÒÈËÔÜÁËÒ»±ÊÇ®";
						d++;
					}else if (r==3){
						cout<<"ÄãÔÚÍøÉÏÓкܶà·ÛË¿";
					}else {
						cout<<"ƽƽµ­µ­µÄÒ»Äê";
					}
				}else if (tf==3){
					int h=rand()%10;
					if (h==0){
						cout<<"Äã×öÁËÒ»¸öÓÎÏ·¸ø×Ô¼ºÍæ, Íæ×Ô¼º×öµÄÓÎÏ·ÊÇÓÀÔ¶¶¼²»»áÎÞÁĵÄ!";e++;
						e++;
					}else if (h==1){
						cout<<"Äã²Î¼ÓÁ˵ȼ¶¿¼ÊÔ²¢¿¼ÁËÂú·Ö,ÄãºÜ¿ªÐÄ";e++;
					}else if (h==2){
						cout<<"ÄãÓкܶà·ÛË¿, ´ó²¿·ÖÊÇ´óÀÐ";d++; 
					}else if (h==3){
						cout<<"Äãͨ¹ý·¢²¼python,c++,»òjava½ÌѧÊÓƵ׬Á˲»ÉÙÇ®";d++;
					}else if (h==4){
						cout<<"È«¹ú¸÷µØµÄ¼ÇÕ߶¼Ï²»¶À´°Ý·ÃÄã";
					}else if (h==5){
						cout<<"Äã³ö°æÁËһЩÊé, ´ó²¿·Ö¶¼ÊǹØÓÚ±à³ÌµÄ";
					}else if (h==6){
						cout<<"Ä㿪·¢ÁËÒ»ÖÖеıà³ÌÓïÑÔÓïÑÔ";
					}else if (h==7){
						cout<<"ÄãÔÚÍøÕ¾Éϱ»ÈËͲÛ×°µÄÏñ¸ö´óÀÐ, ÄãºÜÉËÐÄ";
						e--;
					}else if (h==8){
						cout<<"ÄãÒòΪ¹ýÓÚ×ÔÐŶø×öÍêÓÎÏ·ºó²»²âÊÔ¾ÍÖ±½Ó·¢²¼,bugÂúÆÁÄ»,±»ÓÎÏ··¢²¼¹«Ë¾¿ÛÁ˲»ÉÙÇ®";
						d-=2;
						e-=2;
					}else if (h==9){
						
						cout<<"Äã¸øÒ»¸öÓû§±à³Ìϵ¥µÄʱºò±»Æ­ÁË,ËðʧÁ˵ãÇ®";
						e--;
						d--;
					}else {
						cout<<"ƽƽµ­µ­µÄÒ»Äê";
					}
				}else if (tf==4){
					int z=rand()%4;
					if (z==0){
						cout<<"Ä㿪·¢³öÁËÒ»ÖÖеIJË";
					}else if (z==1){
						cout<<"Äãͨ¹ýÖ±²¥Öó²Ë¹ý³ÌÔÚÍøÉÏ»ðÁ˺ܾÃ";
					}else if (z==2){
						cout<<"ÄãΪÄãµÄÅóÓÑÖóÁËÒ»µÀºÜºÃ³ÔµÄ²Ë"; 
					}else{
						cout<<"ƽƽµ­µ­µÄÒ»Äê";
					}
				}else{
					cout<<"ƽƽµ­µ­µÄÒ»Äê";
				}
			}
		}
	}
	i++;
	if (a<=0){
		cout<<";ÄãÒòΪÑÕֵ̫µÍ±»¸¸Ä¸Å×Æú, Äãµ½´¦Á÷À˵«×îºó»¹ÊǶöËÀÁË";return ;
	}else if(b<=0){
		cout<<";ÄãÒòΪÖÇÉÌÌ«µÍ±ä³ÉÁËÖÇÕÏ, ¸¸Ä¸ºÜÉúÆø²¢ÎªÄã×öÁË°²ÀÖËÀ";return ;
	}else if(c<=0){
		cout<<";ÄãÒòΪÌåÖÊÌ«µÍ¶øËÀ, ÄãµÄÅóÓѺͼÒÈËΪÄã¾ÙÐÐÁËÔáÀñ";return ;
	}else if(d<=0){
		cout<<";ÄãÒòΪ¼ÒÀïÌ«Çîû¶«Î÷³Ô, ×îºóÄãºÍ¸¸Ä¸¶öËÀÁË";return ;
	}else if (e<=0){
		cout<<";ÄãµÄÇéÐ÷Ì«µÍÂä, ×ÔɱÁË";return ;
	}
	cout<<endl;
	gotoxy(0,0);
	cout<<"ÑÕÖµ:"<<a
	<<"|ÖÇÁ¦:"<<b
	<<"|ÌåÖÊ:"<<c
	<<"|¼Ò¾³:"<<d
	<<"|¿ìÀÖ"<<e;
	gotoxy(0,i+1);
	if (i>=65 && tf!=5){
		c--;
	}
	if (i>=75 &&tf!=5){
		c--;
	}
	if (i>=90 && tf!=5){
		c-=2;
	}
}
}

 类似资料: