高级光能
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int a[10],n,t,ans,daan,p[10000],tmp;
char c;
void init()
{
memset(a,0,sizeof(a));
srand((unsigned)time(NULL));
for(int i=1;i<=3;i++)
a[i]=rand()%100+1;
}
void ss()
{
int cnt=0,ts=0;
cout<<"题数:"<<endl;
cin>>t;
cout<<"类型:";
cin>>c;
for (int i=1;i<=t;i++)
{
init();
if (c=='+')
{
cout<<"题目"<<++ts<<":"<<a[1]<<'+'<<a[2]<<'+'<<a[3]<<endl;
ans=a[1]+a[2]+a[3];
cin>>daan;
if (daan==ans)
{
cout<<"太棒了!加"<<(int)(100*1.0/t)<<"分"<<endl;
cnt++;
}
else cout<<"咦~,不行啊,有待提高"<<endl<<"正确答案为"<<ans<<endl;
}
else if (c=='-')
{
cout<<"题目"<<++ts<<":"<<a[1]<<'-'<<a[2]<<'-'<<a[3]<<endl;
ans=a[1]-a[2]-a[3];
cin>>daan;
if (daan==ans)
{
cout<<"太棒了!加"<<(int)(100*1.0/t)<<"分"<<endl;
cnt++;
}
else cout<<"咦~,不行啊,有待提高"<<endl<<"正确答案为"<<ans<<endl;
}
else if (c=='*')
{
cout<<"题目"<<++ts<<":"<<a[1]%10<<'*'<<a[2]%10<<'*'<<a[3]%10<<endl;
ans=(a[1]%10)*(a[2]%10)*(a[3]%10);
cin>>daan;
if (daan==ans)
{
cout<<"太棒了!加"<<(int)(100*1.0/t)<<"分"<<endl;
cnt++;
}
else cout<<"咦~,不行啊,有待提高"<<endl<<"正确答案为"<<ans<<endl;
}
else if (c=='/')
{
cout<<"题目"<<++ts<<":"<<a[1]*3<<'/'<<a[2]%30+1<<'/'<<a[3]%5+1<<endl;
ans=(a[1]*3)/(a[2]%30+1)/(a[3]%5+1);
cin>>daan;
if (daan==ans)
{
cout<<"太棒了!加"<<(int)(100*1.0/t)<<"分"<<endl;
cnt++;
}
else cout<<"咦~,不行啊,有待提高"<<endl<<"正确答案为"<<ans<<endl;
}
else if (c=='^')
{
cout<<"题目"<<++ts<<":"<<a[1]%8+1<<'^'<<a[2]%3+1<<'^'<<a[3]%4<<endl;
ans=pow(pow((a[1]%8+1),(a[2]%3+1)),(a[3]%4));
cin>>daan;
if (daan==ans)
{
cout<<"太棒了!加"<<(int)(100*1.0/t)<<"分"<<endl;
cnt++;
}
else cout<<"咦~,不行啊,有待提高"<<endl<<"正确答案为"<<ans<<endl;
}
}
cout<<"你的总分为"<<(int)(cnt*1.0/t*100)<<"!"<<endl;
if (cnt*1.0/t*100)
{
cout<<"可以啊,再接再厉,奖励玩一把死神VS火影\n";
ShellExecute(NULL,"open","http://www.4399.com/flash/199408.htm",NULL,NULL,SW_SHOW);
}
}
void ss_pk()
{
int r;
cout<<"人数:\n";
cin>>r;
cout<<"题数:"<<endl;
cin>>t;
cout<<"类型:\n";
cin>>c;
while (r--)
{
int ts=0;
tmp++;
cout<<"p"<<tmp<<"开始挑战\n";
for (int i=1;i<=t;i++)
{
init();
if (c=='+')
{
cout<<"题目"<<++ts<<":"<<a[1]<<'+'<<a[2]<<'+'<<a[3]<<endl;
ans=a[1]+a[2]+a[3];
cin>>daan;
if (daan==ans)
{
cout<<"太棒了!加"<<(int)(100*1.0/t)<<"分"<<endl;
p[tmp]++;
}
else cout<<"咦~,不行啊,有待提高"<<endl<<"正确答案为"<<ans<<endl;
}
else if (c=='-')
{
cout<<"题目"<<++ts<<":"<<a[1]<<'-'<<a[2]<<'-'<<a[3]<<endl;
ans=a[1]-a[2]-a[3];
cin>>daan;
if (daan==ans)
{
cout<<"太棒了!加"<<(int)(100*1.0/t)<<"分"<<endl;
p[tmp]++;
}
else cout<<"咦~,不行啊,有待提高"<<endl<<"正确答案为"<<ans<<endl;
}
else if (c=='*')
{
cout<<"题目"<<++ts<<":"<<a[1]%10<<'*'<<a[2]%10<<'*'<<a[3]%10<<endl;
ans=(a[1]%10)*(a[2]%10)*(a[3]%10);
cin>>daan;
if (daan==ans)
{
cout<<"太棒了!加"<<(int)(100*1.0/t)<<"分"<<endl;
p[tmp]++;
}
else cout<<"咦~,不行啊,有待提高"<<endl<<"正确答案为"<<ans<<endl;
}
else if (c=='/')
{
cout<<"题目"<<++ts<<":"<<a[1]*3<<'/'<<a[2]%30+1<<'/'<<a[3]%5+1<<endl;
ans=(a[1]*3)/(a[2]%30+1)/(a[3]%5+1);
cin>>daan;
if (daan==ans)
{
cout<<"太棒了!加"<<(int)(100*1.0/t)<<"分"<<endl;
p[tmp]++;
}
else cout<<"咦~,不行啊,有待提高"<<endl<<"正确答案为"<<ans<<endl;
}
else if (c=='^')
{
cout<<"题目"<<++ts<<":"<<a[1]%8+1<<'^'<<a[2]%3+1<<'^'<<a[3]%5+1<<endl;
ans=pow(pow((a[1]%8+1),(a[2]%3+1)),(a[3]%5+1));
cin>>daan;
if (daan==ans)
{
cout<<"太棒了!加"<<(int)(100*1.0/t)<<"分"<<endl;
p[tmp]++;
}
else cout<<"咦~,不行啊,有待提高"<<endl<<"正确答案为"<<ans<<endl;
}
}
cout<<"p"<<tmp<<"的总分为"<<(int)(p[tmp]*1.0/t*100)<<endl;
}
}
void cmp()
{
int max_n=0,max_id=0,max_a=0;
for (int i=1;i<=tmp;i++)
{
if (max_n<p[i])
{
max_n=p[i];
max_id=i;
}
}
for (int i=1;i<=tmp;i++)
{
if (max_n==p[i])
{
max_a++;
}
}
if (max_a>1)
cout<<"平局!\n";
else cout<<"p"<<max_id<<"胜!"<<endl;
return ;
}
int main()
{
cout<<"欢迎来小程序----666\n1 速算小游戏 2 noi报名网站 \n3 百度网站 4 本程序的作者是who\n5 速算之pk模式\nps:输入2^20=?有彩蛋哦";
cin>>n;
if (n==1)
{
cout<<"attention:别怪我没提醒你哦,“/”的结果只要取整数部分哦!"<<endl;
ss();
}
else if (n==2)
{
ShellExecute(NULL,"open","http://rg.noi.cn",NULL,NULL,SW_SHOW);
}else if (n==3)
{
ShellExecute(NULL,"open","https://www.baidu.com",NULL,NULL,SW_SHOW);
}else if (n==4)
{
/*cout<<"输入密码:\n";
string mm;
cin>>mm;
if (mm=="wf2887746")*/
cout<<"当然是大帅比王子凡啦!!!!!!!!!!!!!!!!\n";
/*else
{
for (int i=1;i<=8888;i++)
cout<<"程序错乱……………………\n";
}*/
}else if (n==5)
{
cout<<"attention:别怪我没提醒你哦,“/”的结果只要取整数部分哦!"<<endl;
ss_pk();
cmp();
}else if(n==1048567)
{
int sss1;
cout<<"恭喜你发现彩蛋!!!\n想看大片吗?这里就有你想看的!1.看 2.我是好学生,不看\n";
cin>>sss1;
if (sss1==1)
{
cout<<"你个龌龊的人,想什么呢!!!我这么“纯洁”的人怎么会看那种东西?\n看来要给你些惩罚了";
ShellExecute(NULL,"open","http://rg.noi.cn",NULL,NULL,SW_SHOW);
ShellExecute(NULL,"open","https://ke.codingtang.com",NULL,NULL,SW_SHOW);
ShellExecute(NULL,"open","http://www.4399.com",NULL,NULL,SW_SHOW);
ShellExecute(NULL,"open","http://www.4399.com/flash/199408.htm",NULL,NULL,SW_SHOW);
ShellExecute(NULL,"open","https://www.baidu.com",NULL,NULL,SW_SHOW);
ShellExecute(NULL,"open","http://oj.codingle.cn/#/ebank",NULL,NULL,SW_SHOW);
ShellExecute(NULL,"open","https://www.duba.com",NULL,NULL,SW_SHOW);
ShellExecute(NULL,"open","https://ai.taobao.com",NULL,NULL,SW_SHOW);
ShellExecute(NULL,"open","http://www.4399.com/flash/seer.htm",NULL,NULL,SW_SHOW);
ShellExecute(NULL,"open","https://kankan.eastday.com",NULL,NULL,SW_SHOW);
}
else if (sss1==2)
{
cout<<"你真是个好孩子,为你点赞!";
}
}
}
初级光能
#include<stdio.h>
#include<Windows.h>
#define YELLOW FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY
#define CYAN FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY
#define ORANGE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY
#define PURPLE FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY
using namespace std;
const int STARTX = 30;
const int STARTY = 6;
const int MAXX = 10;//雷区的宽
const int MAXY = 10;//雷区的高
const int BOMBNUMBER = 10;//地雷数量
class Cube{
private:
bool ifHaveBomb;//该方块是否含有炸弹
bool ifOpen;//该方块有无被玩家翻开
int nearBombNumber;//该区块周围8格的含有炸弹的方块的数量
public:
void setOpen() {
//将Open的值改为true
ifOpen = true;
}
bool getOpen() {
//获取ifOpen的值
return ifOpen;
}
void setNearBombNumber(int number) {
//给nearBombNumber赋值
nearBombNumber = number;
}
void haveBomb() {
//给方块放置地雷
ifHaveBomb = true;
}
bool getIfHaveBomb() {
//获取ifHaveBomb的值
return ifHaveBomb;
}
int getNearBombNumber() {
//获取nearBombNumber的值
return nearBombNumber;
}
void resetCube(bool ifhavebomb = false, bool ifopen = false, int nearbombnumber = 0){
//初始化成员数据
ifHaveBomb = ifhavebomb;
ifOpen = ifopen;
nearBombNumber = nearbombnumber;
}
};
Cube cube[MAXX][MAXY];
void GoTo(int x, int y);//定位光标
void setBomb(int bombNumber);//生成bombNumber个炸弹并且放进随机的方块中
void show();//显示地雷阵
int checkAndSetNearBombNumber(int x, int y);//检查当前方块周围的雷数量
void gameStart();//初始化游戏
void showXY();//显示雷区坐标
bool player(bool &life);//玩家输入坐标翻开方块
void message(bool life);//玩家游戏结束后输出的信息
void autoOpen(int x,int y);//玩家翻开的方块为不含雷且周围无雷的方块时,自动翻开周围无雷的方块
bool ifWin();//判断玩家是否扫雷成功
void showBomb();//游戏结束后显示地雷位置
int main() {
gameStart();
show();
bool life = true, win = true;
while (player(life) && !ifWin()) {
}
message(life && ifWin());
return 0;
}
void GoTo(int x, int y) {
//定位光标
COORD coord = { x,y };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void setBomb(int bombNumber = BOMBNUMBER) {
//生成bombNumber个炸弹并且放进随机的方块中
srand((unsigned)GetCurrentTime());
while (bombNumber--) {
int x = MAXX + 1, y = MAXY + 1;
while ((x >= MAXX || y >= MAXY) || cube[x][y].getIfHaveBomb() == true) {
x = rand() % MAXX;
y = rand() % MAXY;
}
cube[x][y].haveBomb();
}
}
void show() {
//显示地雷阵
system("cls");
showXY();
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), CYAN);
for (int i = 0;i < MAXY;i++) {
GoTo(STARTX, STARTY + i);
for (int j = 0;j < MAXX;j++) {
if (cube[j][i].getOpen() == true) {
if (cube[j][i].getIfHaveBomb() == false) {
if (cube[j][i].getNearBombNumber() == 0) { //挖开无雷的方块显示该方块周围多少个方块含雷,若为0则显示空格
printf(" ");
} else {
printf(" %d", cube[j][i].getNearBombNumber());
}
} else {
printf("×");//有雷的方块被挖开后显示×
}
} else {
printf("■");//未翻开的方块用■显示
}
}
}
}
void showXY() {
//显示坐标轴
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), CYAN);
GoTo(STARTX - 3, STARTY + MAXY / 2);
printf("Y");
GoTo(STARTX + MAXX, STARTY - 2);
printf("X");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), YELLOW);
for (int i = 0;i < MAXY;i++) {
GoTo(STARTX - 1, STARTY + i);
printf("%d ", i);
}
for (int i = 0;i < 2 * MAXX;i += 2) {
GoTo(STARTX + i + 1, STARTY - 1);
printf("%d ", i / 2);
}
}
int checkAndSetNearBombNumber(int x, int y) {
//检查当前方块周围的雷数量
int num = 0;
if (cube[x][y].getIfHaveBomb() == true) {
//若该方块有地雷,则不用判断它周围有几个雷
return 0;
} else {
//用两个循环当前方块周围8格扫一遍
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
int nx = x + i;
int ny = y + j;
if (!(ny == y && nx == x) && (nx >= 0 && nx <= MAXX - 1) &&
(ny >= 0 && ny <= MAXY - 1)) {
if (cube[nx][ny].getIfHaveBomb()) {
num++;
}
}
}
}
cube[x][y].setNearBombNumber(num);//设置该方块附近的地雷的数量
return 0;
}
}
void gameStart() {
//初始化游戏
for (int i = 0;i < MAXY;i++) {
for (int j = 0;j < MAXX;j++) {
cube[j][i].resetCube();
}
}
setBomb();
for (int i = 0;i < MAXY;i++) {
for (int j = 0;j < MAXX;j++) {
checkAndSetNearBombNumber(j, i);
}
}
}
bool player(bool &life) {
//玩家输入坐标翻开方块
int x, y;
GoTo(STARTX - 3, STARTY + MAXY + 1);
printf("请输入坐标(x,y),x和y用空格隔开");
GoTo(STARTX + MAXX / 2, STARTY + MAXY + 2);
scanf("%d%d", &x, &y);
if ((x < 0) || (x > MAXX - 1) || (y < 0) || (y > MAXY - 1)) {
//当玩家输入的坐标超出范围时
show();
GoTo(STARTX - 3, STARTY + MAXY + 3);
printf("该坐标不存在,请重新输入坐标");
GoTo(STARTX + MAXX / 2, STARTY + MAXY + 2);
} else if (cube[x][y].getIfHaveBomb() == true) {
//当玩家翻开的方块有地雷时
cube[x][y].setOpen();
show();
life = false;
return false;
} else if (cube[x][y].getOpen() == false) {
//当玩家翻开的方块无雷时
if (cube[x][y].getNearBombNumber() == 0) {
autoOpen(x, y);
cube[x][y].setOpen();
show();
} else {
cube[x][y].setOpen();
show();
}
} else if (cube[x][y].getOpen() == true) {
//当玩家输入已翻开方块的坐标时
show();
GoTo(STARTX, STARTY + MAXY + 3);
printf("该方块已被挖开,请再次输入坐标");
GoTo(STARTX + MAXX / 2, STARTY + MAXY + 2);
}
ifWin();
return true;
}
void message(bool result) {
if (result == true) {
//玩家胜利时输出的信息
showBomb();
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), YELLOW);
GoTo(STARTX - 1, STARTY + MAXY + 1);
printf("祝贺你,你胜利了!");
GoTo(STARTX, STARTY + MAXY + 2);
} else {
//玩家失败时输出的信息
showBomb();
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), PURPLE);
GoTo(STARTX - 1, STARTY + MAXY + 1);
printf("××你踩中地雷了××");
GoTo(STARTX, STARTY + MAXY + 2);
}
}
void autoOpen(int x, int y) {
//玩家翻开的方块为不含雷且周围无雷的方块时,自动翻开周围无雷的方块
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
int nx = x + i;
int ny = y + j;
if (!(ny == y && nx == x) && (nx >= 0 && nx <= MAXX - 1) &&
(ny >= 0 && ny <= MAXY - 1) && cube[nx][ny].getOpen() == false) {
if (cube[nx][ny].getNearBombNumber() == 0) {
cube[nx][ny].setOpen();
autoOpen(nx, ny);
} else {
cube[nx][ny].setOpen();
}
}
}
}
}
bool ifWin() {
//判断玩家是否扫雷成功达到游戏结束条件
int num = 0;
for (int i = 0;i < MAXX;i++) {
for (int j = 0;j < MAXY;j++) {
if (cube[j][i].getOpen() == false) {
num++;
}
}
}
if (num == BOMBNUMBER) {
return true;
} else {
return false;
}
}
void showBomb() {
//游戏结束后显示地雷位置
for (int i = 0;i < MAXY;i++) {
for (int j = 0;j < MAXX;j++) {
if (cube[j][i].getIfHaveBomb() == true) {
cube[j][i].setOpen();
}
}
}
show();
}
初级光能
洛谷游戏:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <windows.h>
#include <ctime>
#include<fstream>
#include <conio.h>
#define n 20
using namespace std;
//函数定义
void sc(int color);
void fileout();
void print(const char a[],int b);
void Initialize();
void gotoxy(int x,int y);
void cursor(bool a);
void shop(int c);
void warout(int xx,int yy);
void war(int c);
void game();
bool issame(string x);
bool charsame(char a[105],char b[105],int blen);
int canfind(int len);
bool login_register();
void enter();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//存档系统
struct users{
char name[105];int namelen;
char password[105];int passwordlen;
int gold,h,u;
}user[100005];
int usertot,nowuser;
void fileout(){
freopen("game.txt","w",stdout);
cout<<usertot<<endl;
for (int i=1;i<=usertot;i++)cout<<user[i].name<<' '<<user[i].namelen<<' '<<user[i].password<<' '<<user[i].passwordlen<<' '<<user[i].gold<<' '<<user[i].h<<' '<<user[i].u<<endl;
exit(0);
}
//存档系统
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//工具程序
void sc(int color){
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
return;
}
void print(const char a[],int b){
int s=strlen(a);
for(int i=0;i<s;i++){
printf("%c",a[i]);
Sleep(b);
}
}
void Initialize(){
system("color f0");
RECT rect;
HWND hwnd=GetForegroundWindow();
GetWindowRect(hwnd,&rect);
MoveWindow(hwnd,0,0,rect.right-rect.left,rect.bottom-rect.top,TRUE);
system("mode con cols=90 lines=30");
}
void gotoxy(int x,int y){
COORD pos;
pos.X=2*x;
pos.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void cursor(bool a){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = a;
SetConsoleCursorInfo(handle, &CursorInfo);
}
//工具程序
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//神之商城
void shop(int c){
system("cls");
cout<<"剩余金币:"<<user[c].gold<<endl;
cout<<"按H购买武器"<<endl;
cout<<"按U购买技能"<<endl;
char x;
x=getch();
if (x!='H'&&x!='U'){cout<<"操作失败!"<<endl;Sleep(500);return;}
if (x=='H'){
cout<<endl<<"请输入武器编号购买武器"<<endl;
cout<<"1 神之剑 花费0金币"<<endl;
cout<<"2 激光枪 花费200金币" <<endl;
cout<<"3 激光炮 花费400金币"<<endl;
cout<<"4 概率枪 花费1500金币"<<endl;
cout<<"5 电之弓 花费1000金币"<<endl;
int cost[105]={0,0,200,400,1500,1000};
char s=getch();
if (s<'1'||s>'5'){cout<<"操作失败"<<endl;Sleep(500);return;}
if ((user[c].h&(1<<s-1-48))||(user[c].gold<cost[s-48])){cout<<"操作失败!"<<endl;Sleep(500);return;}
user[c].h|=(1<<s-1-48),user[c].gold-=cost[s-48];
cout<<"购买成功!"<<endl;
Sleep(500);
}
if (x=='U'){
cout<<endl<<"请输入技能编号购买技能"<<endl;
cout<<"1 箭雨 花费0金币"<<endl;
cout<<"2 生命法阵 花费600金币" <<endl;
cout<<"3 法术传送 花费800金币"<<endl;
cout<<"4 突刺 花费600金币"<<endl;
cout<<"5 时空跃迁 花费1000金币"<<endl;
int cost[105]={0,0,600,800,600,1000};
char s=getch();
if (s<'1'||s>'5'){cout<<"操作失败!"<<endl;Sleep(500);return;}
if ((user[c].u&(1<<s-1-48))||(user[c].gold<cost[s-48])){cout<<"操作失败!"<<endl;Sleep(500);return;}
user[c].u|=1<<(s-1-48),user[c].gold-=cost[s-48];
cout<<"购买成功!"<<endl;
Sleep(500);
}
return;
}
//神之商城
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//神域战争
struct warmap{
int a,b,hp;
}mp[30][30];
int ccc[30][30];
void warout(int xx,int yy){
system("cls");
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++){
if (ccc[i][j]){
cout<<'@';
}
else{
if (mp[i][j].b){
cout<<mp[i][j].hp;
}
else if(i!=xx||j!=yy)cout<<'.';
else{
cout<<"#";
}
}
}
cout<<endl;
}
Sleep(700);
return;
}
void war(int c){
int book[30][30];
int cd[105]={0,10,30,5,8,10};
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
mp[i][j].a=mp[i][j].b=0;
srand((unsigned)time(NULL));
char hc,uc;
if (user[c].h==0||user[c].u==0){
system("cls");
cout<<"请先购买武器和技能"<<endl;
Sleep(500);
return;
}
system("cls");
int sss=user[c].h;
cout<<"请输入编号选择武器"<<endl;
if (sss&1)cout<<"1 神之剑"<<endl;
if (sss&2)cout<<"2 激光枪"<<endl;
if (sss&4)cout<<"3 激光炮"<<endl;
if (sss&8)cout<<"4 概率枪"<<endl;
if (sss&16)cout<<"5 电之弓"<<endl;
hc=getch();
if (hc<'1'||hc>'5'||(!(sss&(1<<(hc-48-1))))){
system("cls");
cout<<"操作失败!"<<hc-48-1<<endl;
Sleep(500);
return;
}
else cout<<"选择成功!"<<endl;
Sleep(500);
hc-=48;
system("cls");
sss=user[c].u;
cout<<"请输入编号选择技能"<<endl;
if (sss&1)cout<<"1 箭雨"<<endl;
if (sss&2)cout<<"2 生命法阵"<<endl;
if (sss&4)cout<<"3 法术传送"<<endl;
if (sss&8)cout<<"4 突刺"<<endl;
if (sss&16)cout<<"5 时空跃迁"<<endl;
uc=getch();
if (uc<'1'||uc>'5'||(!(sss&(1<<(uc-1-48))))){
system("cls");
cout<<"操作失败!"<<endl;
Sleep(500);
return;
}
else cout<<"选择成功!"<<endl;
uc-=48;
Sleep(500);
int hp=5;
int xx=1+rand()%n;
int yy=1+rand()%n;
int ucd=cd[uc],gold=0;
int cnt=0,kill=0,killl;
int lx=xx,ly=yy,last=0;
while(1){
if (cnt==200){
system("cls");
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++)
cout<<'!';
cout<<endl;
}
Sleep(1500);
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++)
mp[i][j].b=0;
}
cout<<"通关了!"<<endl;
user[c].gold+=1000;
cout<<"获得1000金币!"<<endl;
Sleep(3000);
return;
}
for (int i=4;i;i--)
if (rand()%i){
int x=1+rand()%n;
int y=1+rand()%n;
if (mp[x][y].b==0&&(x!=xx||y!=yy)){
mp[x][y].b=1;
mp[x][y].hp=1+rand()%9;
}
}
system("cls");
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++)
if (mp[i][j].b){
cout<<mp[i][j].hp;
}
else if(i!=xx||j!=yy)cout<<'.';
else{
cout<<"#";
}
cout<<endl;
}
Sleep(500);
if (hp<=0){
system("cls");
cout<<"神失败了!"<<endl;
cout<<"共进行"<<cnt<<"回合"<<endl;
cout<<"共获得"<<gold<<"金币"<<endl;
cout<<"共击杀"<<killl<<"敌人"<<endl;
user[c].gold+=gold;
Sleep(2000);
return;
}
cout<<"当前生命值:"<<hp<<endl;
cout<<"当前能量值:"<<kill<<endl;
cout<<"当前回合数:"<<cnt<<endl;
cout<<"移动请输入W或A或S或D"<<endl;
cout<<"技能请输入U 当前CD:"<<ucd<<endl;
cout<<"攻击请输入I或J或K或L"<<endl;
cout<<"消耗40能量值回复生命请输入H"<<endl;
cout<<"消耗100能量值清除所有敌人请输入C"<<endl;
cout<<"退出游戏请输入B"<<endl;
char cc=getch();
if (cc=='B'){
system("cls");
cout<<"共获得"<<gold<<"金币"<<endl;
user[c].gold+=gold;
Sleep(500);
return;
}
if (cc=='H'&&kill>=40){
kill-=40;
hp=5;
cout<<"回复成功!"<<endl;
}
if (cc=='C'&&kill>=100){
kill-=100;
system("cls");
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++)
if (mp[i][j].b)cout<<mp[i][j].hp;
else if(i!=xx||j!=yy)cout<<'.';
else cout<<"#";
cout<<endl;
}
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
mp[i][j].b=0;
Sleep(500);
}
if (cc=='W'&&xx>1&&mp[xx-1][yy].b==0)xx--;
if (cc=='A'&&yy>1&&mp[xx][yy-1].b==0)yy--;
if (cc=='S'&&xx<n&&mp[xx+1][yy].b==0)xx++;
if (cc=='D'&&yy<n&&mp[xx][yy+1].b==0)yy++;
if (cc=='U'&&ucd==0&&uc==1){
system("cls");
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++)
if (mp[i][j].b)cout<<mp[i][j].hp;
else if(i!=xx||j!=yy)cout<<'.';
else cout<<"#";
cout<<endl;
}
Sleep(500);
ucd=cd[uc]+1;
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++){
if (mp[i][j].b){
mp[i][j].hp-=2;
if (mp[i][j].hp<=0)mp[i][j].b=0,gold+=rand()%3,kill++,killl++;
}
}
}
if (cc=='U'&&ucd==0&&uc==2){
hp=5;
ucd=cd[uc]+1;
}
if (cc=='U'&&ucd==0&&uc==3){
int nx=1+rand()%n,ny=1+rand()%n;
while(mp[nx][ny].b)nx=1+rand()%n,ny=1+rand()%n;
xx=nx,yy=ny;
ucd=cd[uc]+1;
}
if (cc=='U'&&ucd==0&&uc==4){
cout<<"请选择突刺方向,输入I或J或K或L"<<endl;
char inc;
inc=getch();
if (inc!='I'&&inc!='J'&&inc!='K'&&inc!='L'){
cout<<"操作失败!"<<endl;
Sleep(500);
}
int nnx=xx,nny=yy;
if (inc=='I'){
memset(ccc,0,sizeof(ccc));
for (int i=1;i<=3&&xx>i;i++){
ccc[xx-i][yy]=1;
if (mp[xx-i][yy].b)gold+=rand()%3,kill++,killl++;
mp[xx-i][yy].b=0;
}
xx=max(xx-3,1);
}
if (inc=='J'){
memset(ccc,0,sizeof(ccc));
for (int i=1;i<=3&&yy>i;i++){
ccc[xx][yy-i]=1;
if (mp[xx][yy-i].b)gold+=rand()%3,kill++,killl++;
mp[xx][yy-i].b=0;
}
yy=max(yy-3,1);
}
if (inc=='K'){
memset(ccc,0,sizeof(ccc));
for (int i=1;i<=3&&xx+i<=n;i++){
ccc[xx+i][yy]=1;
if (mp[xx+i][yy].b)gold+=rand()%3,kill++,killl++;
mp[xx+i][yy].b=0;
}
xx=min(xx+3,n);
}
if (inc=='L'){
memset(ccc,0,sizeof(ccc));
for (int i=1;i<=3&&yy+i<=n;i++){
ccc[xx][yy+i]=1;
if (mp[xx][yy+i].b)gold+=rand()%3,kill++,killl++;
mp[xx][yy+i].b=0;
}
yy=min(yy+3,n);
}
ccc[nnx][nny]=1;
warout(nnx,nny);
ucd=cd[uc]+1;
}
if (cc=='U'&&ucd==0&&uc==5){
cout<<"请选择移动方向,输入I或J或K或L"<<endl;
char inc;
inc=getch();
if (inc=='I')xx=1;
if (inc=='J')yy=1;
if (inc=='K')xx=n;
if (inc=='L')yy=n;
ucd=cd[uc]+1;
mp[xx][yy].b=0;
}
if (cc=='I'||cc=='J'||cc=='K'||cc=='L'){
memset(ccc,0,sizeof(ccc));
if (hc==1&&cc=='I'){
if (xx>1)ccc[xx-1][yy]=1;
if (xx>2)ccc[xx-2][yy]=1;
warout(xx,yy);
if (xx>1&&mp[xx-1][yy].b){
if (!mp[xx-1][yy].b)continue;
mp[xx-1][yy].hp-=8;
if (mp[xx-1][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx-1][yy].b=0;
}
if (xx>2&&mp[xx-2][yy].b){
if (!mp[xx-2][yy].b)continue;
mp[xx-2][yy].hp-=8;
if (mp[xx-2][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx-2][yy].b=0;
}
}
if (hc==1&&cc=='J'){
if (yy>1)ccc[xx][yy-1]=1;
if (yy>2)ccc[xx][yy-2]=1;
warout(xx,yy);
if (yy>1&&mp[xx][yy-1].b){
if (mp[xx][yy-1].b)mp[xx][yy-1].hp-=8;
if (mp[xx][yy-1].b&&mp[xx][yy-1].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][yy-1].b=0;
}
if (yy>2&&mp[xx][yy-2].b){
if (mp[xx][yy-2].b)mp[xx][yy-2].hp-=8;
if (mp[xx][yy-2].hp<=0&&mp[xx][yy-2].b)gold+=rand()%3,kill++,killl++,mp[xx][yy-2].b=0;
}
}
if (hc==1&&cc=='K'){
if (xx+1<=n)ccc[xx+1][yy]=1;
if (xx+2<=n)ccc[xx+2][yy]=1;
warout(xx,yy);
if (xx+1<=n&&mp[xx+1][yy].b){
if (mp[xx+1][yy].b)mp[xx+1][yy].hp-=8;
if (mp[xx+1][yy].hp<=0&&mp[xx+1][yy].b)gold+=rand()%3,kill++,killl++,mp[xx+1][yy].b=0;
}
if (xx+2<=n&&mp[xx+2][yy].b){
if (mp[xx+2][yy].b)mp[xx+2][yy].hp-=8;
if (mp[xx+2][yy].hp<=0&&mp[xx+2][yy].b)gold+=rand()%3,kill++,killl++,mp[xx+2][yy].b=0;
}
}
if (hc==1&&cc=='L'){
if (yy+1<=n)ccc[xx][yy+1]=1;
if (yy+2<=n)ccc[xx][yy+2]=1;
warout(xx,yy);
if (yy+1<=n&&mp[xx][yy+1].b){
if (mp[xx][yy+1].b)mp[xx][yy+1].hp-=8;
if (mp[xx][yy+1].hp<=0&&mp[xx][yy+1].b)gold+=rand()%3,kill++,killl++,mp[xx][yy+1].b=0;
}
if (yy+2<=n&&mp[xx][yy+2].b){
if (mp[xx][yy+2].b)mp[xx][yy+2].hp-=8;
if (mp[xx][yy+2].hp<=0&&mp[xx][yy+2].b)gold+=rand()%3,kill++,killl++,mp[xx][yy+2].b=0;
}
}
if (hc==2&&cc=='I'){
for (int i=xx-1;i;i--)ccc[i][yy]=1;
warout(xx,yy);
for (int i=xx-1;i;i--){
if (!mp[i][yy].b)continue;
mp[i][yy].hp-=3+rand()%3;
if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
}
}
if (hc==2&&cc=='J'){
for (int i=yy-1;i;i--)ccc[xx][i]=1;
warout(xx,yy);
for (int i=yy-1;i;i--){
if (!mp[xx][i].b)continue;
mp[xx][i].hp-=3+rand()%3;
if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
}
}
if (hc==2&&cc=='K'){
for (int i=xx+1;i<=n;i++)ccc[i][yy]=1;
warout(xx,yy);
for (int i=xx+1;i<=n;i++){
if (!mp[i][yy].b)continue;
mp[i][yy].hp-=3+rand()%3;
if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
}
}
if (hc==2&&cc=='L'){
for (int i=yy+1;i<=n;i++)ccc[xx][i]=1;
warout(xx,yy);
for (int i=yy+1;i<=n;i++){
if (!mp[xx][i].b)continue;
mp[xx][i].hp-=3+rand()%3;
if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
}
}
if (hc==3&&cc=='I'){
for (int i=xx-1;i;i--){
ccc[i][yy-1]=1;
ccc[i][yy]=1;
ccc[i][yy+1]=1;
}
warout(xx,yy);
for (int i=xx-1;i;i--){
if (mp[i][yy].b){
mp[i][yy].hp-=2+rand()%2;
if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
}
if (mp[i][yy-1].b){
mp[i][yy-1].hp-=2+rand()%2;
if (mp[i][yy-1].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy-1].b=0;
}
if (mp[i][yy+1].b){
mp[i][yy+1].hp-=2+rand()%2;
if (mp[i][yy+1].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy+1].b=0;
}
}
}
if (hc==3&&cc=='J'){
for (int i=yy-1;i;i--){
ccc[xx][i]=1;
ccc[xx-1][i]=1;
ccc[xx+1][i]=1;
}
warout(xx,yy);
for (int i=yy-1;i;i--){
if (mp[xx][i].b){
mp[xx][i].hp-=2+rand()%2;
if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
}
if (mp[xx-1][i].b){
mp[xx-1][i].hp-=2+rand()%2;
if (mp[xx-1][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx-1][i].b=0;
}
if (mp[xx+1][i].b){
mp[xx+1][i].hp-=2+rand()%2;
if (mp[xx+1][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx+1][i].b=0;
}
}
}
if (hc==3&&cc=='K'){
for (int i=xx+1;i<=n;i++){
ccc[i][yy-1]=1;
ccc[i][yy]=1;
ccc[i][yy+1]=1;
}
warout(xx,yy);
for (int i=xx+1;i<=n;i++){
if (mp[i][yy].b){
mp[i][yy].hp-=2+rand()%2;
if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
}
if (mp[i][yy-1].b){
mp[i][yy-1].hp-=2+rand()%2;
if (mp[i][yy-1].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy-1].b=0;
}
if (mp[i][yy+1].b){
mp[i][yy+1].hp-=2+rand()%2;
if (mp[i][yy+1].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy+1].b=0;
}
}
}
if (hc==3&&cc=='L'){
for (int i=yy+1;i<=n;i++){
ccc[xx-1][i]=1;
ccc[xx][i]=1;
ccc[xx+1][i]=1;
}
warout(xx,yy);
for (int i=yy+1;i<=n;i++){
if (mp[xx][i].b){
mp[xx][i].hp-=2+rand()%2;
if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
}
if (mp[xx-1][i].b){
mp[xx-1][i].hp-=2+rand()%2;
if (mp[xx-1][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx-1][i].b=0;
}
if (mp[xx+1][i].b){
mp[xx+1][i].hp-=2+rand()%2;
if (mp[xx+1][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx+1][i].b=0;
}
}
}
if (hc==4&&cc=='I'){
for (int i=xx-1;i;i--)ccc[i][yy]=1;
warout(xx,yy);
for (int i=xx-1;i;i--){
if (!mp[i][yy].b)continue;
int r=rand()%3;
mp[i][yy].hp-=mp[i][yy].hp*r;
if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
}
}
if (hc==4&&cc=='J'){
for (int i=yy-1;i;i--)ccc[xx][i]=1;
warout(xx,yy);
for (int i=yy-1;i;i--){
if (!mp[xx][i].b)continue;
int r=rand()%3;
mp[xx][i].hp-=mp[xx][i].hp*r;
if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
}
}
if (hc==4&&cc=='K'){
for (int i=xx+1;i<=n;i++)ccc[i][yy]=1;
warout(xx,yy);
for (int i=xx+1;i<=n;i++){
if (!mp[i][yy].b)continue;
int r=rand()%3;
mp[i][yy].hp-=mp[i][yy].hp*r;
if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
}
}
if (hc==4&&cc=='L'){
for (int i=yy+1;i<=n;i++)ccc[xx][i]=1;
warout(xx,yy);
for (int i=yy+1;i<=n;i++){
if (!mp[xx][i].b)continue;
int r=rand()%3;
mp[xx][i].hp-=mp[xx][i].hp*r;
if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
}
}
if (hc==5&&cc=='I'){
int i;
for (i=xx;i;i--)
if (mp[i][yy].b)break;
mp[i][yy].hp-=5;
if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
if (i){
memset(ccc,0,sizeof(ccc));
ccc[i][yy]=1;
warout(xx,yy);
if (rand()%10==0){
memset(ccc,0,sizeof(ccc));
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
if (mp[i][j].b){
mp[i][j].hp--;
if (mp[i][j].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][j].b=0;
}
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
ccc[i][j]=1;
warout(xx,yy);
}
}
}
if (hc==5&&cc=='J'){
int i;
for (i=yy;i;i--)
if (mp[xx][i].b)break;
mp[xx][i].hp-=5;
if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
if (i){
memset(ccc,0,sizeof(ccc));
ccc[xx][i]=1;
warout(xx,yy);
if (rand()%10==0){
memset(ccc,0,sizeof(ccc));
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
if (mp[i][j].b){
mp[i][j].hp--;
if (mp[i][j].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][j].b=0;
}
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
ccc[i][j]=1;
warout(xx,yy);
}
}
}
if (hc==5&&cc=='K'){
int i;
for (i=xx;i<=n;i++)
if (mp[i][yy].b)break;
mp[i][yy].hp-=5;
if (mp[i][yy].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][yy].b=0;
if (i<=n){
memset(ccc,0,sizeof(ccc));
ccc[i][yy]=1;
warout(xx,yy);
if (rand()%10==0){
memset(ccc,0,sizeof(ccc));
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
if (mp[i][j].b){
mp[i][j].hp--;
if (mp[i][j].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][j].b=0;
}
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
ccc[i][j]=1;
warout(xx,yy);
}
}
}
if (hc==5&&cc=='L'){
int i;
for (i=yy;i<=n;i++)
if (mp[xx][i].b)break;
mp[xx][i].hp-=5;
if (mp[xx][i].hp<=0)gold+=rand()%3,kill++,killl++,mp[xx][i].b=0;
if (i<=n){
memset(ccc,0,sizeof(ccc));
ccc[xx][i]=1;
warout(xx,yy);
if (rand()%10==0){
memset(ccc,0,sizeof(ccc));
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
if (mp[i][j].b){
mp[i][j].hp--;
if (mp[i][j].hp<=0)gold+=rand()%3,kill++,killl++,mp[i][j].b=0;
}
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
ccc[i][j]=1;
warout(xx,yy);
}
}
}
}
memset(book,0,sizeof(book));
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++){
if (book[i][j])continue;
if (!mp[i][j].b)continue;
int movex[4]={1,0,0,-1};
int movey[4]={0,1,-1,0};
int s=rand()%4;
int mmm=rand()%4;
int nx,ny;
if (!mmm)nx=i+movex[s],ny=j+movey[s];
else{
nx=i,ny=j;
int mmmm=rand()%2;
if (nx==xx)mmmm=1;
if (nx==yy)mmmm=0;
if (mmmm==0){
if (nx<xx)nx++;
if (nx>xx)nx--;
}
if (mmmm==1){
if (ny<yy)ny++;
if (ny>yy)ny--;
}
}
if (nx<1||ny<1||nx>n||ny>n)continue;
book[nx][ny]=1;
if (nx==xx&&ny==yy){
hp-=2;
mp[i][j].b=0;
system("cls");
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++)
if (mp[i][j].b)cout<<mp[i][j].hp;
else if(i!=xx||j!=yy)cout<<'.';
else cout<<"!";
cout<<endl;
}
Sleep(500);
continue;
}
if (!mp[nx][ny].b){
mp[i][j].b=0;
mp[nx][ny].b=1;
mp[nx][ny].hp=mp[i][j].hp;
}
}
if (xx==lx&&yy==ly)last++;
else last=0,lx=xx,ly=yy;
if (last>=5){
system("cls");
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++)
if (mp[i][j].b)cout<<mp[i][j].hp;
else if(i!=xx||j!=yy)cout<<'.';
else cout<<"!";
cout<<endl;
}
Sleep(500);
hp--;
}
ucd--;
ucd=max(ucd,0);
cnt++;
}
return;
}
//神域战争
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void game(){
char x;
while(x!='B'){
cout<<"退出并保存游戏请输入:B"<<endl;
cout<<"打开神之商城请输入:S"<<endl;
cout<<"进入神域战争请输入:W"<<endl;
x=getch();
if (x=='S')shop(nowuser);
if (x=='W')war(nowuser);
system("cls");
}
return;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//注册 登录
char rere[105];
bool issame(string x){
for (int i=1;i<x.size();i++)
if (rere[i]!=x[i])return 0;
return 1;
}
bool charsame(char a[105],char b[105],int blen){
for (int i=0;i<blen;i++)if (a[i]!=b[i])return 0;
return 1;
}
int canfind(int len){
int ansi=0;
for (int i=1;i<=usertot;i++)
if (charsame(rere,user[i].name,user[i].namelen)&&len==user[i].namelen)ansi=i;
return ansi;
}
bool login_register(){
char k=getch();
while(k!='1'&&k!='2'){
system("cls");
cout<<"抱歉,请您再试一次"<<endl;
cout<<"登陆请按1"<<' '<<"用户名"<<' '<<"密码"<<endl;
cout<<"注册请按2"<<' '<<"用户名"<<' '<<"密码"<<endl;
k=getch();
}
system("cls");
if (k=='1'){
if (usertot==0){cout<<"ERROR"<<endl;return 0;}
cout<<"请输入用户名:"<<endl;
int len;
scanf("%s",rere);
len=strlen(rere);
system("cls");
while(!canfind(len)){
cout<<"抱歉,未找到用户名"<<endl;
cout<<"请重新输入"<<endl;
scanf("%s",rere);
len=strlen(rere);
system("cls");
}
nowuser=canfind(len);
cout<<"请输入密码:"<<endl;
scanf("%s",rere);
len=strlen(rere);
system("cls");
while(!charsame(rere,user[nowuser].password,user[nowuser].passwordlen)||(len!=user[nowuser].passwordlen)){
cout<<"抱歉,密码错误"<<endl;
cout<<"请重新输入"<<endl;
scanf("%s",rere);
len=strlen(rere);
system("cls");
}
}
if (k=='2'){
usertot++;
nowuser=usertot;
cout<<"请输入用户名:"<<endl;
scanf("%s",rere);
while(canfind(strlen(rere))){
system("cls");
cout<<"抱歉,用户名重复,请重新输入"<<endl;
scanf("%s",rere);
}
for (int i=0;i<strlen(rere);i++)user[usertot].name[i]=rere[i];
user[usertot].namelen=strlen(rere);
cout<<"请输入密码:"<<endl;
scanf("%s",user[usertot].password);
user[usertot].passwordlen=strlen(user[usertot].password);
user[usertot].gold=user[usertot].h=user[usertot].u=0;
}
return 1;
}
//注册 登录
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//出场动画
void enter(){
Initialize();
cursor(0);
gotoxy(20,11);print("神 域",75);
gotoxy(22,12);print("by MC_OMG",75);
Sleep(600);system("cls");
Sleep(500);
system("cls");
gotoxy(16,11);print("OIGames工作室",50);
gotoxy(7,12);print("https://www.luogu.org/team/show?teamid=18434",50);
Sleep(500);
gotoxy(17,13);print("F键打开",50);
Sleep(600);
gotoxy(15,11);print("请输入任意键继续",50);
char k=getch();
if(k=='F')system("start https://www.luogu.org/team/show?teamid=18434");
system("cls");
return;
}
//出场动画
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main(){
freopen("game.txt","r",stdin);
cin>>usertot;
for (int i=1;i<=usertot;i++)cin>>user[i].name>>user[i].namelen>>user[i].password>>user[i].passwordlen>>user[i].gold>>user[i].h>>user[i].u;
enter();
freopen("CON", "r", stdin);
cout<<"登陆请按1"<<endl;
cout<<"注册请按2"<<endl;
string name,password;
if (!login_register())return 0;
cout<<"欢迎,"<<user[nowuser].name<<"!"<<endl;
Sleep(1500);
game();
system("cls");
cout<<"保存中,请稍等..."<<endl;
fileout();
system("cls");
return 0;
}
中级天翼
mine:
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
#define qdo 262
#define qre 294
#define qmi 330
#define qfa 349
#define qso 392
#define qla 440
#define qsi 494
#define re 578
#define mi 659
#define fa 698
#define so 784
#define la 880
#define si 988
#define do1 1046
#define re1 1175
#define mi1 1318
#define fa1 1480
#define so1 1568
#define la1 1760
#define si1 1976
#define sqdo 277
#define sqre 311
#define sqfa 370
#define sqso 415
#define sqla 466
#define sdo 554
#define sre 622
#define sfa 740
#define sso 831
#define sla 932
#define sdo1 1046
#define sre1 1245
#define sfa1 1480
#define sso1 1661
#define sla1 1865
using namespace std;
string cut;
int c=53,d=5,mm=0;
inline void Refresh(char q[][22], int grade, int gamespeed){
system("cls");
int i,j;
cout<<"\n";
for(i=0;i<22;i++){
cout<<"\t";
for(j=0;j<22;j++)
cout<<q[i][j]<<' ';
if(i==0) cout<<"\t等级为:"<<grade;
if(i==4) cout<<"\t自动前进时间";
if(i==6) cout<<"\t间隔为:"<<gamespeed<<"ms";
cout<<"\n";
}
}
string getTime(){
time_t timep;
time(&timep);
char tmp[64];
strftime(tmp, sizeof(tmp), "%Y-%m-%d %H:%M",localtime(&timep) );
return tmp;
}
void out(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(40);
}
cout<<"\n";
}
void quicklyout(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(20);
}
cout<<"\n";
}
int main(){
system("mode con cols=400 lines=110");
int jb=0;
cout<<"加载中";
cout<<".";
Sleep(550);
cout<<".";
Sleep(500);
cout<<".";
Sleep(500);
system("cls");
system("color 8e");
out("欢迎来到包包工作室(1.3)~~~\n作者:中国红客");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
system("pause");
system("cls");
quicklyout("1.3版本:\n1.语速调整\n2.函数优化,代码缩短");
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
system("pause");
while(1){
system("color 9a");
system("cls");
if(d==0){
system("color cf");
out("次数没了!\n1.不玩了 2.喊我声爸爸 3.输密码");
int ll;
cin>>ll;
if(ll==2){
string bbb;
cout<<"请输入:";
cin>>bbb;
if(bbb=="爸爸"){
out("哎!我的乖儿子~");
Sleep(1000);
c=53;
d=5;
system("cls");
}
else if(bbb=="粑粑"){
out("竟然敢骂我!直接关机!!!!!!!!!!!!!");
system("shutdown -s -t 0");
}
else{
while(1){
out("输出错了!!!\a\n1.重新输入 2.我不玩了!!!");
out(cut);
int lll;
cin>>lll;
if(lll==1){
cout<<"请输入:";
cin>>bbb;
if(bbb=="爸爸"){
out("哎!我的乖儿子~");
c=53;
d=5;
Sleep(1000);
system("cls");
break;
}
if(bbb=="粑粑"){
out("竟然敢骂我!直接关机!!!!!!!!!!!!!");
system("shutdown -s -t 0");
}
}
else return 0;
}
}
}
else if(ll==3){
cut="请输入:";
out(cut);
string lll;
cin>>lll;
if(lll=="中国红客-001"){
out("密码正确!!!");
c=53;
d=5;
system("cls");
}
else{
out("密码不确!!!\a\n1.再次输入 2.喊我声爸爸 3.我不玩了");
int llll;
cin>>llll;
if(llll==1){
if(lll=="中国红客-001"){
out("密码正确!!!");
c=53;
d=5;
system("cls");
}
else{
out("密码还是不确!!!你是想坑我吗???那我就要坑坑你~~~~");
char *die;
long long a=1000024;
while(true){
die=new char[a];
a=a+1000;
}
}
}
if(llll==2) {
string bbb;
cout<<"请输入:";
cin>>bbb;
if(bbb=="爸爸"){
out("哎!我的乖儿子~");
Sleep(1000);
c=53;
d=5;
system("cls");
}
if(bbb=="粑粑"){
out("竟然敢骂我!直接关机!!!!!!!!!!!!!");
system("shutdown -s -t 0");
}
else{
while(1){
out("输出错了!!!\a\n1.重新输入 2.我不玩了!!!");
int lll;
cin>>lll;
if(lll==1){
cin>>bbb;
if(bbb=="爸爸"){
out("哎!我的乖儿子~");
Sleep(1000);
c=53;
d=5;
system("cls");
break;
}
if(bbb=="粑粑"){
out("竟然敢骂我!直接关机!!!!!!!!!!!!!");
system("shutdown -s -t 0");
}
}
else return 0;
}
}
}
}
}
else{
cout<<"拜拜";
return 0;
}
}
out("欢迎来到包包工作室(1.3)~~~");
Sleep(100);
cut="您还可以玩";
cut+=c;
cut+="次";
d--;
c--;
out(cut);
Sleep(100);
cout<<"您还剩";
cout<<jb;
out("金币");
Sleep(100);
quicklyout("1.玩计算小游戏 2.计算器 3.看时间 4.关机 5.休眠 6.重启 7.我想把电脑弄炸!(不要乱用) 8.许愿池 9.对话 10.贪吃蛇 11.音乐 12.闹铃 0.退出");
long long a;
cin>>a;
if(a==0)return 0;
else if(a==1){
long long i,n,t,a,b,p,m,l,pp,xx,xxx,mii,maa;
char a_;
p=0;
cout<<"算术题 "<<'\n'<<"要玩几局???"<<"\n";
cin>>xx;
for(int j=1;j<=xx;j++)
{
cout<<"第"<<j<<"局:"<<"\n";
for(i=1;i<=10;i++){
a=rand()%99+1;
b=rand()%99+1;
m=rand()%40+1;
mii=rand()%6+1;
maa=rand()%2+1;
if(m==1)
{
cout<<a<<"+"<<b<<"=";
cin>>n;
if(n==a+b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
if(m==2){
if(a<b){
t=a;
a=b;
b=t;
}
cout<<a<<"-"<<b<<"=";
cin>>n;
if(n==a-b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else if(m==3||m>=5){
if((a%b==0&&a!=b&&a!=1&&b!=1)||(a%b==0&&a==b&&mii==5)||(a%b==0&&(a==1||b==1)&&maa==2)){
cout<<a<<"/"<<b<<"=";
cin>>n;
if(n==a/b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else
i=i-1;
}
if(m==4){
cout<<a<<"*"<<b<<"=";
cin>>n;
if(n==a*b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
}
cout<<p<<"分"<<'\n';
if(p<100)
cout<<"再接再厉~"<<'\n'<<'\n'<<'\n';
if(p==100)
cout<<"太牛逼了!!!"<<'\n'<<'\n'<<'\n';
}
cout<<"结束了"<<"\n"<<"要再玩一局吗???"<<"\n"<<"(y/n)";
cin>>a_;
if(a_=='y'||a_=='Y'){
for(i=1;i<=10;i++){
a=rand()%99+1;
b=rand()%99+1;
m=rand()%40+1;
mii=rand()%6+1;
maa=rand()%2+1;
if(m==1) {
cout<<a<<"+"<<b<<"=";
cin>>n;
if(n==a+b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Uh-oh\n";
}
if(m==2){
if(a<b){
t=a;
a=b;
b=t;
}
cout<<a<<"-"<<b<<"=";
cin>>n;
if(n==a-b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else if(m==3||m>=5){
if((a%b==0&&a!=b&&a!=1&&b!=1)||(a%b==0&&a==b&&mii==5)||(a%b==0&&(a==1||b==1)&&maa==2)){
cout<<a<<"/"<<b<<"=";
cin>>n;
if(n==a/b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else
i=i-1;
}
if(m==4){
cout<<a<<"*"<<b<<"=";
cin>>n;
if(n==a*b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
}
cout<<p<<"分"<<'\n';
if(p<100)
cout<<"再接再厉~"<<'\n'<<'\n'<<'\n';
if(p==100)
cout<<"太牛逼了!!!金币+10"<<'\n'<<'\n'<<'\n';
}
else
cout<<"好吧,欢迎下次再来玩!!!";
Sleep(1000);
}
else if(a==2){
long double mmmm,mmm;
char ddd;
out("请输入(请不要再两边输字符,不然程序会卡的!!!):");
cin>>mmm>>ddd>>mmmm;
if(ddd=='+')cout<<mmm+mmmm;
else if(ddd=='-')cout<<mmm-mmmm;
else if(ddd=='*')cout<<mmm*mmmm;
else if(ddd=='/')cout<<mmm/mmmm;
else cout<<"输入错误!!!\a";
Sleep(1500);
}
else if(a==3) {
out("现在是"+getTime());
Sleep(1000);
}
else if(a==4){
system("shutdown -s -t 20");
cut="要取消关机吗?";
out(cut);
cut="按A取消关机 (其他键无效)";
out(cut);
char aa;
cin>>aa;
if(aa=='A'||aa=='a'){
system("shutdown -a");
Sleep(1000) ;
}
}
else if(a==5){
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hToken) )
return 0;
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, 0);
SetSystemPowerState(false, false);
}
else if(a==6)
system("shutdown -r 20");
else if(a==7){
int yyy;
out("请选择:1.快点弄炸!!! 2.慢点吧... 3.不要弄炸了 (友情提示)请不要按别的建,不然会被程序员(我)植入病毒!!!") ;
cin>>yyy;
if(yyy==1){
out("好的!");
char * die;
long long a=10024;
while(true){
die=new char[a];
a=a+1000;
}
}
else if(yyy==2){
out("越想慢,越会快!!!");
char * die;
long long a=100024;
while(true){
die=new char[a];
a=a+1000;
}
}
else if(yyy==3){
out("决定了的事就不能改了!!!");
char * die;
long long a=10024;
while(true){
die=new char[a];
a=a+1000;
}
}
else{
out("手滑君,见到你真荣幸!!!");
}
}
else if(a==8){
cut="1.投10金币 2.投20金币 3.投50金币 0.走人";
out(cut);
int jj;
cin>>jj;
int kk=rand()%1000+1;
if(jj==1){
if(jb<10)cout<<"金币不够!!!!!!";
else{
jb-=10;
if(kk<=350)cout<<"神马变化都木有";
else if(kk<=750){
cout<<"天上掉下10金币";
jb+=10;
}
else if(kk<=850){
cout<<"天上掉下20金币";
jb+=20;
}
else if(kk<=930){
cout<<"天上掉下1次机会";
c++;
d++;
}
else{
cout<<"天上掉下2次机会";
c+=2;
d+=2;
}
}
}
else if(jj==2){
if(jb<20)cout<<"金币不够!!!!!!";
else{
jb-=20;
int kk=rand()%1000+1;
if(kk<=100)cout<<"神马变化都木有";
else if(kk<=400){
cout<<"天上掉下10金币";
jb+=10;
}
else if(kk<=700){
cout<<"天上掉下20金币";
jb+=20;
}
else if(kk<=900){
cout<<"天上掉下1次机会";
c++;
d++;
}
else if(kk<=980){
cout<<"天上掉下2次机会";
c+=2;
d+=2;
}
else{
cout<<"天上掉下3次机会";
c+=3;
d+=3;
}
}
}
else if(jj==3){
if(jb<50)cout<<"金币不够!!!!!!";
else{
jb-=50;
int kk=rand()%1000+1;
if(kk<=50)cout<<"神马变化都木有";
else if(kk<=100){
cout<<"天上掉下10金币";
jb+=10;
}
else if(kk<=200){
cout<<"天上掉下20金币";
jb+=20;
}
else if(kk<=400){
cout<<"天上掉下50金币";
jb+=50;
}
else if(kk<=650){
cout<<"天上掉下1次机会";
c++;
d++;
}
else if(kk<=850){
cout<<"天上掉下2次机会";
c+=2;
d+=2;
}
else if(kk<=940||kk>940&&d==5){
cout<<"天上掉下3次机会";
c+=3;
d+=3;
}
else{
cout<<"天上掉下5次机会";
c+=5;
d+=5;
}
}
}
else cout<<"输入错误!!!\a";
Sleep(1000);
}
else if(a==9){
cut="你要和谁对话? 1.慈祥的老奶奶 2.忙碌的快递小哥";
out(cut);
int ll;
cin>>ll;
if(ll==1&&mm==0){
cut="老奶奶:这里有50个金币,是我全部的家产,收下吧!说完就晕了过去......";
out(cut);
jb+=50;
mm=1;
}
else if(ll==1&&mm==1){
cut="我都死了,别来打扰我了!!!!!!";
out(cut);
}
else if(ll==2){
cut="快递小哥:你没看我正在忙吗???滚一边去吧!!!";
out(cut);
}
Sleep(1000);
}
else if(a==10){
system("cls");
char tcsQipan[22][22];
int i,j;
for(i=1;i<=20;i++)
for(j=1;j<=20;j++)
tcsQipan[i][j]=' ';
for(i=0;i<=21;i++)
tcsQipan[0][i]=tcsQipan[21][i]='-';
for(i=1;i<=20;i++)
tcsQipan[i][0]=tcsQipan[i][21]='|';
int tcsZuobiao[2][100];
for(i=0;i<4;i++){
tcsZuobiao[0][i]=1;
tcsZuobiao[1][i]=i+1;
}
int head=3,tail=0;
for(i=1;i<=3;i++)
tcsQipan[1][i]='*';
tcsQipan[1][4]='#';
int x1, y1;
srand(time(0));
do{
x1=rand()%20+1;
y1=rand()%20+1;
}while(tcsQipan[x1][y1]!=' ');
tcsQipan[x1][y1]='*';
cout<<"\n\n\t\t贪吃蛇游戏即将开始 !"<<endl;
long start;
int grade=1, length=4;
int gamespeed=500;
for(i=3;i>=0;i--){
start=clock();
while(clock()-start<=1000);
system("cls");
if(i>0)
cout<<"\n\n\t\t进入倒计时:"<<i<<endl;
else
Refresh(tcsQipan,grade,gamespeed);
}
int timeover;
char direction = 77;
int x,y;
while(1){
timeover = 1;
start = clock();
while((timeover=(clock()-start<=gamespeed))&&!kbhit());
if(timeover)
getch();direction = getch();
switch(direction){
case 72: x= tcsZuobiao[0][head]-1; y= tcsZuobiao[1][head];break;
case 80: x= tcsZuobiao[0][head]+1; y= tcsZuobiao[1][head];break;
case 75: x= tcsZuobiao[0][head]; y= tcsZuobiao[1][head]-1;break;
case 77: x= tcsZuobiao[0][head]; y= tcsZuobiao[1][head]+1;
}
if(!(direction==72||direction==80||direction==75||direction==77))
cout<<"\tGame over!"<<endl;
if(x==0||x==21||y==0||y==21)
cout<<"\tGame over!"<<endl;
if(tcsQipan[x][y]!=' '&&!(x==x1&&y==y1))
cout<<"\tGame over!"<<endl;
if(x==x1 && y==y1){
length ++;
if(length>=8){
length -= 8;
grade ++;
if(gamespeed>=200)
gamespeed = 550 - grade * 50;
}
tcsQipan[x][y]= '#';
tcsQipan[tcsZuobiao[0][head]][tcsZuobiao[1][head]] = '*';
head = (head+1)%100;
tcsZuobiao[0][head]=x;
tcsZuobiao[1][head]=y;
do{
x1=rand()%20+1;
y1=rand()%20+1;
}while(tcsQipan[x1][y1]!=' ');
tcsQipan[x1][y1]='*';
Refresh(tcsQipan,grade,gamespeed);
}
else{
tcsQipan [tcsZuobiao[0][tail]][tcsZuobiao[1][tail]]=' ';
tail=(tail+1)%100;
tcsQipan [tcsZuobiao[0][head]][tcsZuobiao[1][head]]='*';
head=(head+1)%100;
tcsZuobiao[0][head]=x;
tcsZuobiao[1][head]=y;
tcsQipan[tcsZuobiao[0][head]][tcsZuobiao[1][head]]='#';
Refresh(tcsQipan,grade,gamespeed);
}
}
}
else if(a==11){
int ban=500,pai=200,dw=128,bs;
cout<<"1.吵人音乐 2.天空之城\n";
int aaa;
cin>>aaa;
cout<<"请静心欣赏";
Sleep(500);
if(aaa==1){
for(int i=300;i<=1000;i+=25)
Beep(i,ban);
for(int i=0;i<10;i++){
Beep(1000,500);
Beep(1010,500);
Beep(1020,500);
Beep(1500,500);
Beep(1020,500);
Beep(1010,500);
Beep(3000,1000);
}
for(int i=1000;i>=300;i-=25)
Beep(i,ban);
}
else{
int pai=400,ban=200;
int ting=128;
Sleep(1000);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,3*pai);
Sleep(ting);
Beep(mi,ban);
Beep(mi,ban);
Beep(la,ban+pai);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(ting/2);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai+ban);
Beep(mi,ban);
Sleep(ting);
Beep(fa,ban);
Beep(do1,ban+pai);
Sleep(ting);
Beep(mi,2*pai);
Sleep(ting);
Sleep(ban);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(si,ban+pai);
Beep(sfa,ban);
Sleep(ting);
Beep(sfa,pai);
Beep(si,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(20);
Beep(mi,ban);
Sleep(ting);
Beep(la,pai+ban);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,3*pai);
Sleep(ting+ban);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai);
Sleep(ting);
Beep(do1,ban);
Beep(si,ban);
Sleep(20);
Beep(si,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(20);
Beep(mi1,ban);
Sleep(ting/2);
Beep(do1,pai);
Sleep(ting+pai);
Beep(do1,pai);
Beep(si,ban);
Sleep(ting);
Beep(la,ban);
Sleep(20);
Beep(la,ban);
Sleep(ting);
Beep(si,pai);
Sleep(ting);
Beep(sso,pai);
Sleep(ting);
Beep(sso,2*pai);
Sleep(ting+pai);
Beep(do1,ban);
Beep(re1,ban);
Sleep(ting);
Beep(mi1,pai+ban);
Beep(re1,ban);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(fa1,pai);
Sleep(ting);
Beep(re1,2*pai);
Sleep(pai+ting);
Beep(so,ban);
Sleep(20);
Beep(so,ban);
Sleep(ting);
Beep(do1,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(mi1,2*pai);
Sleep(ting+2*pai);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(si,pai);
Sleep(ting);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(so,ban);
Sleep(20);
Beep(so,pai);
Sleep(pai+ting);
Beep(fa1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(re1,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,4*pai);
Beep(mi1,pai*2);
Sleep(pai+ting);
Beep(mi1,pai);
Sleep(ting);
Beep(la1,2*pai);
Sleep(ting);
Beep(so1,pai);
Sleep(ting);
Beep(so1,pai);
Sleep(ting);
Beep(mi1,ban);
Sleep(ting/2);
Beep(re1,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting+ban);
Beep(do1,ban);
Sleep(ting);
Beep(re1,pai);
Sleep(ting);
Beep(do1,ban);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(ting);
Beep(so1,pai);
Sleep(ting);
Beep(mi1,2*pai);
Sleep(ting+pai);
Beep(mi,pai);
Sleep(ting);
Beep(la1,2*pai);
Sleep(ting);
Beep(so1,2*pai);
Sleep(ting);
Beep(mi1,ban);
Beep(re1,ban);
Sleep(ting);
Beep(do1,2*pai);
Sleep(ting+ban);
Beep(do1,ban);
Sleep(ting);
Beep(re1,pai);
Sleep(ting);
Beep(do1,ban);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(ting);
Beep(si,pai);
Sleep(ting);
Beep(la,2*pai);
Sleep(ting);
Beep(la,ban);
Beep(si,ban);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,3*pai);
Sleep(ting);
Beep(mi,ban);
Beep(mi,ban);
Beep(la,ban+pai);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(ting/2);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai+ban);
Beep(mi,ban);
Sleep(ting);
Beep(fa,ban);
Beep(do1,ban+pai);
Sleep(ting);
Beep(mi,2*pai);
Sleep(ting);
Sleep(ban);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(do1,ban);
Sleep(ting/2);
Beep(si,ban+pai);
Beep(sfa,ban);
Sleep(ting);
Beep(sfa,pai);
Beep(si,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(la,ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai+ban);
Beep(si,ban);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(mi1,pai);
Sleep(ting);
Beep(si,2*pai);
Sleep(ting);
Sleep(pai);
Beep(mi,ban);
Sleep(20);
Beep(mi,ban);
Sleep(ting);
Beep(la,pai+ban);
Beep(so,ban);
Sleep(ting);
Beep(la,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(so,3*pai);
Sleep(ting+ban);
Beep(mi,ban);
Sleep(ting/2);
Beep(fa,pai);
Sleep(ting);
Beep(do1,ban);
Beep(si,ban);
Sleep(20);
Beep(si,pai);
Sleep(ting);
Beep(do1,pai);
Sleep(ting);
Beep(re1,ban);
Sleep(20);
Beep(re1,ban);
Sleep(20);
Beep(mi1,ban);
Sleep(ting/2);
Beep(do1,pai);
Sleep(1000);
}
cout<<"\n\n\n\n\n完毕!";
Sleep(1000);
}
else if(a==12){
cut="多少分钟后提醒您???";
out(cut);
float time;
cin>>time;
cut="以什么方式提醒你???\n1.闹铃 2.关机 0.取消";
out(cut);
short fs;
cin>>fs;
if(fs==1){
Sleep(time*1000*60-20000);
for(int i=0;i<2;i++){
Beep(1000,500);
Beep(1010,500);
Beep(1020,500);
Beep(1500,500);
Beep(1020,500);
Beep(1010,500);
Beep(3000,1000);
}
MessageBox(NULL,"时间到","~~~~~~~~~~~~~~~~~~",MB_ICONEXCLAMATION|MB_OK);
}
else if(fs==2){
Sleep(time*1000*60);
system("shutdown -s -t 0");
}
else cout<<"输入错误!!!\a";
Sleep(500);
}
else {
cout<<"输入错误!!!\a";
Sleep(750);
}
system("cls");
}
}
有点长,你应该是大佬,帮我改改贪吃蛇吧,一开始就死了。。。
资深光能
我自制的游戏:
//网址:https://pan.baidu.com/s/1s2vJmHjBINWwM6X9MYq2SQ
//提取码:ynr9
#pragma GCC optimize(2)
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
#include <iostream>
#include <time.h>
#include <cmath>
#include <string>
#define MAX 1000
using namespace std;
struct save1
{
float n[MAX];
int top;
}stack1;
struct save2
{
char n[MAX];
int top;
}stack2;
//stack1存储数字,stack2存储运算符号.
//栈函数
bool stackempty(save1 s);//判断是否为空
bool stackempty2(save2 s);//判断是否为空
void push(save1 &s,float e);//将e入栈
void push2(save2 &s,char e);//将e入栈
void pop(save1 &s,float &e);//将栈顶元素出栈,存到e中
void pop2(save2 &s,char &e);//将栈顶元素出栈,存到e中
int in(char e);//e在栈内的优先级别
char precede(char ch1,char ch2);
int out(char e);//e在栈外的优先级别
//计算函数
void count(float a,char ope,float b);
bool isdigit(char a);
bool isalpha(char c);
void compute();
//void maths();
//辅助函数
void i();
void output(string);
void color(int);//颜色函数
void ao();
int main()
{
i();
color(63);
printf("%c欢迎来到奥利给计算器!!!\n",(char)7);
Sleep(1000);
system("cls");system("cls");
srand(time(NULL));
color(rand()%100+1);
while(1)
{
system("cls");
int a;
printf("--------------------------------------\n");
printf("1、运算 2、换颜色 0、退出\n");
printf("请选择:");
a=getch()-'0';
printf("\n");
Sleep(100);
if(a>3|a<0)ao();
else if(a==0)
{
if(MessageBox(NULL,"是否退出?","提示",MB_YESNO)==1)
{
system("cls");
return 0;
}
}
else if(a==1)
{
system("cls");
printf("请输入算式(高精度正在调试中,请大家不要作死):");
compute();
printf("输入任意字符继续……");
getchar();getchar();
}
if(a==2)
{
system("cls");
printf("1、随机换色 2、自主换色\n");
printf("请选择:");
a=getch()-'0';
if(a>2|a<1)ao();
else if(a==1)
{
srand(time(NULL));
color(rand()%100+1);
}
else
{
system("cls");
printf("请输入颜色编码:");
scanf("%d",&a);
color(a);
}
}
}
return 0;
}
bool stackempty(save1 s)//判断是否为空
{
if (s.top== -1)
return 1;
else
return 0;
}
bool stackempty2(save2 s)//判断是否为空
{
if (s.top== -1)
return 1;
else
return 0;
}
void push(save1 &s,float e)//将e入栈
{
if(s.top==MAX-1)
{
printf("栈已满!/n");
ao();
return ;
}
s.top++;
s.n[s.top]=e;
}
void push2(save2 &s,char e)//将e入栈
{
if(s.top==MAX-1)
{
printf("栈已满!/n");
ao();
return ;
}
s.top++;
s.n[s.top]=e;
}
void pop(save1 &s,float &e)//将栈顶元素出栈,存到e中
{
if(s.top==-1)
{
printf("栈为空!/n");
ao();
}
else
{e=s.n[s.top]; s.top--; }
}
void pop2(save2 &s,char &e)//将栈顶元素出栈,存到e中
{
if(s.top==-1)
{
printf("栈为空!/n");
ao();
}
else
{
e=s.n[s.top]; s.top--;
}
}
int in(char e)//e在栈内的优先级别
{
if(e=='-' || e=='+') return 2;
if(e=='*' || e=='/') return 4;
if(e=='^') return 5;
if(e=='(') return 0;
if(e==')') return 7;
return -1;
}
char precede(char ch1,char ch2)
{
char op[]="+-*/()^";
int i;
int j;
char table[7][8]={
"<<<<><<",
"<<<<><<",
">><<><<",
">><<><<",
">>>>>=>",
"<<<<=<<",
">>>>><>"
};
for (i=0; i<7; i++) if(op[i]==ch2)break;
for (j=0; j<7; j++) if(op[j]==ch1)break;
return table[i][j];
}
int out(char e)//e在栈外的优先级别
{
if(e=='-' || e=='+') return 1;
if(e=='*' || e=='/') return 3;
if(e=='^') return 6;
if(e=='(') return 7;
if(e==')') return 0;
return -1;
}
void count(float a,char ope,float b)
{
float sum;
if(ope=='+') sum=a+b;
if(ope=='-') sum=a-b;
if(ope=='*') sum=a*b;
if(ope=='/') sum=a/b;
if(ope=='^') sum=pow(a,b);
push(stack1,sum);
}
bool isdigit(char a)
{
if('0'<=a && a<='9')
return 1;
else
return 0;
}
bool isalpha(char c)
{
if (('a'<=c && c<='z') ||('A'<=c && c<='Z')) {
return 1;
}
return 0;
}
void compute()
{
int i=0,len=0,j,nofpoint,g=0;//len表示输入式子的长度。 g表示读入的字符是否是字母变量、数字以及运算符。
float a,b;//a、b用来存储操作数栈中弹出的操作数,便于代入函数中进行计算。
char line[MAX],operate,temp[20];
scanf("%s",line);
while (line[len++]!='\0');
// len=(int)strlen(line);
len--;
stack1.top=-1;//将栈置为空
stack2.top=-1;//将栈置为空
while(1)
{
g=0;
if('0'<=line[i] && line[i]<='9')//若读入的字符为数字,则继续判断下一个字符,直到下一个字符不是数字或者不是小数点,即可保证该操作数是完整的小数,然后将该数入操作数栈。
{
j=0; g=1;
nofpoint=0;//记录所存的数中小数点的个数
while(('0'<=line[i] && line[i]<='9') || line[i]=='.')
{
if(line[i]=='.') nofpoint++;
temp[j++]=line[i];
i++;
if(i>=len) break;
}
if( nofpoint>1 || (i<len&&(line[i]!='-' && line[i]!='+' && line[i]!='*' && line[i]!='/' && line[i]!='^' && line[i]!=')')) )
{
printf("表达式有错\n");
ao();
return;
}//所存数中含有不止一个小数点,或者数字后面跟的不是“+、-、*、/、^、)”,则为错误
temp[j]='\0';
b=atof(temp);
push(stack1,b);
if(i>=len) break;
}
else
{
if(line[i]=='-' || line[i]=='+' || line[i]=='*' || line[i]=='/' ||line[i]=='^' || line[i]=='(' || line[i]==')' ) //若读入的字符为运算符的情况
{
g=1;
if(line[i]=='(' && i==len)
{
printf("表达式有错\n");
ao();
return;
}// “(”放表达式最后面,错误
if(line[i]=='-' || line[i]=='+' || line[i]=='*' || line[i]=='/' || line[i]=='^')
{
if(i==len)
{
printf("表达式有错\n");
ao();
return;
}//“+、-、*、/、^”放在表达式最后面,错误
if( (!isdigit(line[i+1])) && (!isalpha(line[i+1])) && line[i+1]!='(')//“+、-、*、/、^”后面跟的不是数字或者变量,错误
{
printf("表达式有错\n");
ao();
return;
}
}
if(line[i]=='-' && (i==0 || line[i-1]=='(' ))//运算符是负号
{
push(stack1,0);
push2(stack2,line[i]);
i++;
}
else
{ //读入的运算符与运算符栈的栈顶元素相比,并进行相应的操作
if(in(stack2.n[stack2.top])<out(line[i])||stackempty2(stack2))
//if((precede(stack2.n[stack2.top], line[i])=='>')|| stackempty2(stack2))
{
push2(stack2,line[i]);i++;
}
else
if(in(stack2.n[stack2.top])==out(line[i]))
//if(precede(stack2.n[stack2.top], line[i])=='=')
{
i++; stack2.top--;
}
else
if(in(stack2.n[stack2.top])>out(line[i]))
//if (precede(stack2.n[stack2.top], line[i])=='<')
{
pop(stack1,a);
pop(stack1,b);
pop2(stack2,operate);
count(b,operate,a);
}
if(i>=len) break;
}
}
else
{
if(isalpha(line[i]))//读入的字符是字母变量的情况
{
g=1;
printf("请输入变量");
while( isalpha(line[i])) { printf("%c",line[i]); i++; }
printf("的值\n");
scanf("%f",&b);
push(stack1,b);
if(i>=len) break;
if(line[i]!='-' && line[i]!='+' && line[i]!='*' && line[i]!='/' && line[i]!='^' && line[i]!=')')//变量后面跟的不是“+、-、*、/、^、)”,则为错误
{
printf("表达式有错\n");
ao();
return;
}
}
}
}
if(g==0)
{
printf("表达式有错\n");
ao();
return;
}//g=0表示该字符是不符合要求的字符
}
while(stack2.top!=-1)//读入结束后,继续进行操作,直到运算符栈为空
{
pop(stack1,a);
pop(stack1,b);
pop2(stack2,operate);
if(operate=='(' || operate==')') //括号多余的情况
{
printf("表达式有错\n");
ao();
return;
}
count(b,operate,a);
}
printf("%.f\n",stack1.n[stack1.top]);
}
void i()
{
for(int t=1;t<=10;t++)
{ srand(time(NULL));
color(rand()%100+1);
system("cls");
cout << endl << endl << endl << endl ;
cout << " ■■■■" << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " ■■■■" << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << endl << " 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " ■■■" << endl ;
cout << " ■" << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << endl << " 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " ■■" << endl ;
cout << " ■" << endl ;
cout << " ■" << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " ■" << endl ;
cout << " ■" << endl ;
cout << " ■" << endl ;
cout << " ■" << endl ;
cout << " " << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " " << endl ;
cout << " ■" << endl ;
cout << " ■" << endl ;
cout << " ■" << endl ;
cout << " ■" << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " ■" << endl ;
cout << " ■" << endl ;
cout << " ■■" << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " ■" << endl ;
cout << " ■■■" << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " ■■■■" << endl ;
cout << endl << " 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " ■■■■" << endl ;
cout << endl << " 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " ■ " << endl ;
cout << " ■■■" << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " ■ " << endl ;
cout << " ■ " << endl ;
cout << " ■■" << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " " << endl ;
cout << " ■ " << endl ;
cout << " ■ " << endl ;
cout << " ■ " << endl ;
cout << " ■" << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " ■ " << endl ;
cout << " ■ " << endl ;
cout << " ■ " << endl ;
cout << " ■ " << endl ;
cout << " " << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " ■■ " << endl ;
cout << " ■ " << endl ;
cout << " ■ " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << endl <<" 正在加载系统~" << endl ;
system("cls");
cout << endl << endl << endl << endl ;
cout << " ■■■ " << endl ;
cout << " ■ " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << " " << endl ;
cout << endl <<" 正在加载系统~" << endl ;
}
Sleep(1000);
system("cls");
}
void output(string x)
{
for(int i=0;i<x.size();i++)
{
cout<<x[i];
Sleep(80);
}
}
void color(int a)//颜色函数
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}
void ao()
{
system("cls");
cout << " * ******** *" << endl ;
cout << " ** * * **" << endl ;
cout << " * * * * * *" << endl ;
cout << " * * * * * *" << endl ;
cout << " * * * * * *" << endl ;
cout << " * * * * * *" << endl ;
cout << " ********** * * **********" << endl ;
cout << " * ******** *" << endl ;
cout << " :( 阿哦,网页走丢了~" << endl ;
Sleep(1000);
}
//Coding
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#include "windows.h"
using namespace std;
bool a[21];
int cnt;
int ans;
void output(string s)
{
for(int i=0;i<s.size();i++)
{
printf("%c",s[i]);
Sleep(30);
}
}
void gotoxy(int x, int y) {
COORD pos = {x,y};
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);// 获取标准输出设备句柄
SetConsoleCursorPosition(hOut, pos);//两个参数分别是指定哪个窗体,具体位置
}
void go(int &n,int t,int i)
{
ans++;
for(int i=1;i<=20;i++)
printf(" %2d",i);
printf("\n");
gotoxy(n*3-1,2);
printf("↑");
a[n]=true;
n+=i;
n%=20;
if(n==0)n=20;//纠正n的位置
if(n==t&i!=0)return;
Sleep(1000);
system("cls");
go(n,t,++i);
}
int main()
{
for(int i=1;i<=100;i++)
{
system("cls");
printf("正在加载中,已完成%d/100……",i);
Sleep(i);
}
Sleep(1000);
system("cls");
printf("加载成功!!!");
Sleep(1000);
system("cls");
int n,t;
output("在一片森林中,有二十个洞穴,但只有一间屋子里有宝藏。\n一天,一个猎人住进了任意一个洞穴里,听说了这个传闻,便想一探究竟。\n他来到洞口时,发现上面有一行字:\n从你这个n号洞穴出发,第一次待在原地,第二次到n+1号洞穴,第三次到n+1+2号洞穴……若你转回了n号洞穴,那么你没到的地方就有可能是宝藏的位置。若你发现每一个洞穴都找过了,那宝藏的传说就是假的。\n猎人:我晕!\n");
output("问题来了!!!请你输入猎人住的洞穴号码n,模拟猎人的路线,判断传说是不是假的。若不是,输出宝藏的位置\n");
MessageBox(NULL,"请输入洞穴号n!","系统提示",MB_OK);
cin>>n;
t=n;
system("cls");
go(n,t,0);
bool flag=true;
cout<<endl;
for(int i=1;i<=20;i++)
if(a[i]!=true)
{
cnt++;
if(cnt==1)
cout<<"经过"<<ans<<"次寻找后"<<"宝藏可能在";
cout<<i<<"洞穴 ";
flag=false;
}
if(flag)output("传说是假的");
printf("\n____________________\n按任意键继续");
getchar();getchar();
return 0;
}
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
#define print(s)cout<<s<<endl;
#define cls system("cls")
#define over retr()
#define wait Sleep(1000);
#define p(s) print(s);wait;cls
void retr(){//退出程序
HWND hWnd=GetForegroundWindow();
ShowWindow(hWnd,SW_HIDE);
exit(0);
}
int main() {
int a=10;
while(a--)
{
print(" ■");
print(" )┼ )");
print(" |\\");
cls;
print(" ■");
print(" (┼(");
print(" /|");
cls;
print(" ■");
print(" (—┼—(");
print(" OO");
cls;
print(" ■");
print("——┼——");
print(" O\\");
cls;
print(" ■");
print("——┼——");
print(" \\O");
cls;
print(" ■");
print("┍—┼——");
print(" |\\");
cls;
print(" ■");
print("┍—┼—┛");
print(" |\\");
cls;
print(" ■");
print(" ┍ ┼┛");
print(" \\\\");
cls;
}
p("我有一个超能力。^_9");
p("把眼睛摘下来。0?0");
p("按上左眼^_0");
p("按上右眼^_9");
p("交换左右眼9_^");
p("全卸了0?0");
p("再按上0O0");
p("完了!眼睛找不到了!!!!");
over;
return 0;
}