//HOMETAG
#include<bits/stdc++.h>
namespace EasilyPrtSc{
//this namespace is for you to be more easily print the things on the screen.
//copyright (c) dgklr , 2019.
//The program cannot ensure anything goes wrong.
//if you have some ideas, you can connect with us:
// dgklr:guo_dgklr@qq.com
#include <windows.h>
#include <ctime>
#include <conio.h>
//------------------------includes-----------------------------------------
using namespace std;
//------------------------namespace----------------------------------------
#define chek(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#define col(co) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),co)
#define pause system("pause > nul")
#undef repeat
#define repeat(a,b,c,g) for (int a=b,abck=(g>=0?1:-1);abck*(a)<=abck*(c);a+=g)
#define br BACKGROUND_RED
#define bg BACKGROUND_GREEN
#define bb BACKGROUND_BLUE
#define bi BACKGROUND_INTENSITY
#define fr FOREGROUND_RED
#define fg FOREGROUND_GREEN
#define fb FOREGROUND_BLUE
#define fi FOREGROUND_INTENSITY
#define backcolor color^fi^bi
#undef select
//------------------------definding things---------------------------------DEFTAG
int M,N;
// M,N values the lengths.
// Please don't change it without using void init(int , int , int).
static bool initialization = 0;
// initalization values the screen has initialized.
// ** Don't Change it! **
int opt[110][110],optcol[110][110];
// opt values the thing we want to print.
// optcol values the color.
int tmp[110][110],tmpcol[110][110];
//tmp means the thing still on the screen.
//tmp the same as optcol.
int nx,ny;
//it is also a very import thing.
//It means where you print.
int color;
//It means the color you chioce.
void gotoxy(int y, int x) {
COORD pos = {x,y};
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOut, pos);
}
//function of gotoxy.
void HideCursor()
{
CONSOLE_CURSOR_INFO cursor_info = {1, 0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
void CreateScreenSize(int y,int x)
{
SMALL_RECT winPon={0,0,x-1,y-1};
HANDLE con=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleWindowInfo(con,true,&winPon);
}
void flashScreen()
{
repeat(i,1,N,1)
repeat(j,1,M,1)
{
if (opt[i][j] != tmp[i][j] || optcol[i][j] != tmpcol[i][j])
gotoxy(i-1,j-1),
col(optcol[i][j]),
putchar(opt[i][j]),
tmp[i][j] = opt[i][j],
tmpcol[i][j] = optcol[i][j];
}
}
void CompulsionflashScreen()
{
repeat(i,1,N,1)
repeat(j,1,M,1)
{
gotoxy(i-1,j-1),
col(optcol[i][j]),
putchar(opt[i][j]),
tmp[i][j] = opt[i][j],
tmpcol[i][j] = optcol[i][j];
}
}
//these function you can also use it from outside.
//-------------------------------------------------------------------------INITTAG
void init(int lx,int ly,int syscol)
{
//You must start this program before use the namespace.
//otherwise, the program will output error.
//write on the screen.
color = syscol;
col(syscol);
cout << ' ';//what the fuck?
system("cls");
//Clear the screen.
initialization = 1;
//It means the program has started this program.
// memset things.
N = lx;
M = ly; nx = 0;
ny = 0; repeat(i,1,N,1)
repeat(j,1,M,1)
tmpcol[i][j] = optcol[i][j] = color; repeat(i,1,N,1)
repeat(j,1,M,1)
tmp[i][j] = opt[i][j] = ' ';
CreateScreenSize(N,M);
//Create the screen.
} //This function is for the string to output.
void output(string x)
{
if (!initialization) {
cerr << "You have not do the init program!"<<endl;
return;
}
int l = x.size();
repeat(i,0,l-1,1)
{
if (x[i] == '\n')
{
nx++,ny=0;
continue;
}
//col(color),gotoxy(nx,ny),putchar(x[i]);
opt[nx][ny]=x[i];
optcol[nx][ny]=color;
ny++;
if (ny >= M)
ny=0,nx++;
}
flashScreen();
} //This function is for the char* to output.
void output(char x[])
{
string xt = x;
output(xt);
} //This function is for string to output.
//It means that:
// A-----B
// | |
// | |
// | |
// . .
// . .
// . .
//A(begx,starty);
//B(begx,endy).
void output(string x,int begx,int starty,int endy)
{
if (!initialization) {
cerr << "You have not do the init program!"<<endl;
return;
}
int l = x.size();
nx = begx;
ny = starty;
repeat(i,0,l-1,1)
{
if (x[i] == '\n')
{
repeat(i,ny,endy,1)
opt[nx][i] = ' ',optcol[nx][i] = color;
nx++,ny=starty;
continue;
}
//col(color),gotoxy(nx,ny),putchar(x[i]);
opt[nx][ny]=x[i];
optcol[nx][ny]=color;
ny++;
if (ny >= min(endy+1,M))
ny=starty,nx++;
}
repeat(i,ny,endy,1)
opt[nx][i] = ' ',optcol[nx][i] = color;
nx++,ny=starty;
flashScreen();
} //This function is for char* to output.
//It means that:
// A-----B
// | |
// | |
// | |
// . .
// . .
// . .
//A(begx,starty);
//B(begx,endy).
void output(char x[],int begx,int starty,int endy)
{
string xt = x;
output(xt,begx,starty,endy);
} //------------------------Msg Box------------------------------------------MSGTAG
class msgbox{
private:
int begx,endx;
int begy,endy;
string title;
//Attention! please put the size of title much smaller than the size.
string note;
// int color;
int tp[110][110];
int tpcol[110][110];
public:
void create(int x,int y,int xx,int yy,string title_tmp)
{
begx = x;
begy = y;
endx = xx;
endy = yy;
title = title_tmp;
int len = title.size(); if (len + 4 >= (endy - begy)) len = (endy - begy - 4);
//if you don't see the warning.... repeat(i,1,N,1)
repeat(j,1,M,1)
tp[i][j]=tmp[i][j],
tpcol[i][j]=tmpcol[i][j]; repeat(i,begy+2,begy+2+len-1,1)
opt[begx][i] = title[i-begy-2],
optcol[begx][i] = backcolor;
opt[begx][begy] = '*';
optcol[begx][begy] = backcolor;
opt[begx][begy+1] = '*';
optcol[begx][begy+1] = backcolor; repeat(i,begy+2+len,endy,1)
opt[begx][i] = '*',
optcol[begx][i] = backcolor; repeat(i,begx+1,endx,1)
opt[i][endy] = opt[i][begy] = '*',
optcol[i][endy] = optcol[i][begy] = backcolor; repeat(i,begy,endy,1)
opt[endx][i] = '*',
optcol[endx][i] = backcolor;
flashScreen();
}
void create(int x,int y,int xx,int yy,char title_tmp[])
{
string p=title_tmp;
create(x,y,xx,yy,p);
} template <class T>
void setnote(T x)
{
repeat(i,begx+1,endx-1,1)
repeat(j,begy+1,endy-1,1)
opt[i][j] = ' ';
repeat(i,begx+1,endx-1,1)
repeat(j,begy+1,endy-1,1)
optcol[i][j] = color;
stringstream ss;
ss << x;
output(ss.str(),begx+1,begy+1,endy-1);
getch();
repeat(i,1,N,1)
repeat(j,1,M,1)
opt[i][j] = tp[i][j], optcol[i][j] = tpcol[i][j];
flashScreen();
}
};/*Class: msgbox*/ //-------------------------Label-------------------------------------------LABELTAG
class label{
private:
int begx,endx;
int begy,endy;
string title;
//Attention! please put the size of title much smaller than the size.
string note;
// int color;
int tp[110][110];
int tpcol[110][110];
public:
void create(int x,int y,int xx,int yy,string title_tmp)
{
begx = x;
begy = y;
endx = xx;
endy = yy;
title = title_tmp; int len = title.size(); if (len + 4 >= (endy - begy)) len = (endy - begy - 4);
//if you don't see the warning.... repeat(i,1,N,1)
repeat(j,1,M,1)
tp[i][j]=tmp[i][j],
tpcol[i][j]=tmpcol[i][j]; repeat(i,begy+2,begy+2+len-1,1)
opt[begx][i] = title[i-begy-2],
optcol[begx][i] = backcolor;
opt[begx][begy] = '*';
optcol[begx][begy] = backcolor;
opt[begx][begy+1] = '*';
optcol[begx][begy+1] = backcolor; repeat(i,begy+2+len,endy,1)
opt[begx][i] = '*',
optcol[begx][i] = backcolor; repeat(i,begx+1,endx,1)
opt[i][endy] = opt[i][begy] = '*',
optcol[i][endy] = optcol[i][begy] = backcolor; repeat(i,begy,endy,1)
opt[endx][i] = '*',
optcol[endx][i] = backcolor;
flashScreen();
}
void create(int x,int y,int xx,int yy,char title_tmp[])
{
string p=title_tmp;
create(x,y,xx,yy,p);
}
template <class T>
void setnote(T x)
{
stringstream ss;
ss << x;
repeat(i,begx+1,endx-1,1)
repeat(j,begy+1,endy-1,1)
opt[i][j] = ' ';
output(ss.str(),begx+1,begy+1,endy-1);
flashScreen();
}
};/*Class: label*/ //---------------------select----------------------------------------------SELTAG
class selectbox{
private:
int tp[110][110];
int tpcol[110][110];
string choice[110];
int begx,endx;
int begy,endy;
string title;
int output_select(string x,int begx,int endx,int starty,int endy)
{
if (!initialization) {
cerr << "You have not do the init program!"<<endl;
return -1;
}
int l = x.size();
nx = begx;
ny = starty;
repeat(i,0,l-1,1)
{
if (nx == endx+1)
{
flashScreen();
return 1;
}
if (x[i] == '\n')
{
nx++,ny=starty;
continue;
}
//col(color),gotoxy(nx,ny),putchar(x[i]);
opt[nx][ny]=x[i];
optcol[nx][ny]=color;
ny++;
if (ny >= min(endy+1,M))
ny=starty,nx++;
}
flashScreen();
return 0;
}
public:
void create(int x,int y,int xx,int yy,string title_tmp)
{
begx = x;
begy = y;
endx = xx;
endy = yy;
title = title_tmp; int len = title.size(); if (len + 4 >= (endy - begy)) len = (endy - begy - 4);
//if you don't see the warning.... repeat(i,1,N,1)
repeat(j,1,M,1)
tp[i][j]=tmp[i][j],
tpcol[i][j]=tmpcol[i][j]; repeat(i,begy+2,begy+2+len-1,1)
opt[begx][i] = title[i-begy-2],
optcol[begx][i] = backcolor;
opt[begx][begy] = '*';
optcol[begx][begy] = backcolor;
opt[begx][begy+1] = '*';
optcol[begx][begy+1] = backcolor; repeat(i,begy+2+len,endy,1)
opt[begx][i] = '*',
optcol[begx][i] = backcolor; repeat(i,begx+1,endx,1)
opt[i][endy] = opt[i][begy] = '*',
optcol[i][endy] = optcol[i][begy] = backcolor; repeat(i,begy,endy,1)
opt[endx][i] = '*',
optcol[endx][i] = backcolor;
flashScreen();
}
void create(int x,int y,int xx,int yy,char title_tmp[])
{
string p=title_tmp;
create(x,y,xx,yy,p);
}
private:
int private_output_select(string xt[],int hl,int n)
{
int tmpcolor = color;
nx = begx;
int flag = -1;
repeat(i,1,n,1)
{
nx++;
if (i == hl)
{
color = 255-color;
}
if (i == hl+1)
flag = 0;
string x = xt[i];
int l = x.size();
// nx = begx+1;
ny = begy+1;
repeat(j,0,l-1,1)
{
if (nx >= endx)
{
color = tmpcolor;
if (flag == -1)
return -1;
else
goto end;
}
if (x[i] == '\n')
{
nx++,ny=begy+1;
continue;
}
//col(color),gotoxy(nx,ny),putchar(x[i]);
opt[nx][ny]=x[j];
optcol[nx][ny]=color;
ny++;
if (ny >= min(endy,M))
ny=begy+1,nx++;
}
if (i == hl)
color = tmpcolor;
}
end:
color = tmpcolor;
flashScreen();
return 0;
}
void show(string x[],int hl,int n)
{
repeat(beg,1,n,1)
{
repeat(i,begx+1,endx-1,1)
repeat(j,begy+1,endy-1,1)
opt[i][j] = ' ';
repeat(i,begx+1,endx-1,1)
repeat(j,begy+1,endy-1,1)
optcol[i][j] = color;
string k[110];
repeat(i,beg,n,1)
k[i-beg+1] = x[i];
if (private_output_select(k,hl-beg+1,n-beg+1)!=-1)
return; }
}
public:
//Please start it begin with '1';
int setnote(string x[],int n)
{
repeat(i,begx+1,endx-1,1)
repeat(j,begy+1,endy-1,1)
opt[i][j] = ' ';
char t=0;
int hl = 1;
while (t != 13)
{
show(x,hl,n);
t = getch();
if ((t == 'w' || t == 'W') && hl > 1) hl--;
if ((t == 's' || t == 'S') && hl < n) hl++;
}
repeat(i,1,N,1)
repeat(j,1,M,1)
opt[i][j] = tp[i][j], optcol[i][j] = tpcol[i][j];
flashScreen();
return hl;
}
};
//------------------------inputbox------------------------------------------INPUTTAG
class inputbox{
private:
int begx,endx;
int begy,endy;
string title;
//Attention! please put the size of title much smaller than the size.
string note;
// int color;
int tp[110][110];
int tpcol[110][110];
public:
void create(int x,int y,int yy,string title_tmp)
{
begx = x;
begy = y;
endx = x+2;
endy = yy;
title = title_tmp;
int len = title.size(); if (len + 4 >= (endy - begy)) len = (endy - begy - 4);
//if you don't see the warning.... repeat(i,1,N,1)
repeat(j,1,M,1)
tp[i][j]=tmp[i][j],
tpcol[i][j]=tmpcol[i][j]; repeat(i,begy+2,begy+2+len-1,1)
opt[begx][i] = title[i-begy-2],
optcol[begx][i] = backcolor;
opt[begx][begy] = '*';
optcol[begx][begy] = backcolor;
opt[begx][begy+1] = '*';
optcol[begx][begy+1] = backcolor; repeat(i,begy+2+len,endy,1)
opt[begx][i] = '*',
optcol[begx][i] = backcolor; repeat(i,begx+1,endx,1)
opt[i][endy] = opt[i][begy] = '*',
optcol[i][endy] = optcol[i][begy] = backcolor; repeat(i,begy,endy,1)
opt[endx][i] = '*',
optcol[endx][i] = backcolor;
flashScreen();
}
void create(int x,int y,int yy,char title_tmp[])
{
string p=title_tmp;
create(x,y,yy,p);
}
template <class T>
void setnote(string x,T &E)
{
x += '*';
repeat(i,begx+1,endx-1,1)
repeat(j,begy+1,endy-1,1)
opt[i][j] = ' ';
output(x,begx+1,begy+1,endy-1);
optcol[begx+1][begy+x.size()] = backcolor;
flashScreen();
col(color),cin >> E;
repeat(i,begy+x.size()+1,M,1)
tmpcol[begx+1][i] = -1;
repeat(i,1,N,1)
repeat(j,1,M,1)
opt[i][j] = tp[i][j], optcol[i][j] = tpcol[i][j];// tmpcol[i][j]=-1;
// CompulsionflashScreen();
flashScreen(); }
template <class T>
void setnote(char x[],T &E)
{
string xt = x;
setnote(xt,E);
}
};/*Class: msgbox*/ //------------------------stream------------------------------------------STREAMTAG
class streambox{
private:
int begx,endx;
int begy,endy;
string title;
int nowx;
//Attention! please put the size of title much smaller than the size.
string note;
// int color;
int tp[110][110];
int tpcol[110][110];
public:
void create(int x,int y,int xx,int yy,string title_tmp)
{ nowx = 0;// To start with 0 begx = x;
begy = y;
endx = xx;
endy = yy;
title = title_tmp; int len = title.size(); if (len + 4 >= (endy - begy)) len = (endy - begy - 4);
//if you don't see the warning.... repeat(i,1,N,1)
repeat(j,1,M,1)
tp[i][j]=tmp[i][j],
tpcol[i][j]=tmpcol[i][j]; repeat(i,begy+2,begy+2+len-1,1)
opt[begx][i] = title[i-begy-2],
optcol[begx][i] = backcolor;
opt[begx][begy] = '*';
optcol[begx][begy] = backcolor;
opt[begx][begy+1] = '*';
optcol[begx][begy+1] = backcolor; repeat(i,begy+2+len,endy,1)
opt[begx][i] = '*',
optcol[begx][i] = backcolor; repeat(i,begx+1,endx,1)
opt[i][endy] = opt[i][begy] = '*',
optcol[i][endy] = optcol[i][begy] = backcolor; repeat(i,begy,endy,1)
opt[endx][i] = '*',
optcol[endx][i] = backcolor;
flashScreen();
}
void create(int x,int y,int xx,int yy,char title_tmp[])
{
string p=title_tmp;
create(x,y,xx,yy,p);
}
template <class T>
void setnote(T x)
{
repeat(i,begx+1,endx-1,1)
repeat(j,begy+1,endy-1,1)
opt[i][j]=' ',optcol[i][j] = color;
stringstream ss;
ss << x; note += ss.str();
int l = note.size();
int tpnx = begx+1;
int tpny = begy+1;
repeat(i,nowx,l-1,1)
{
if (note[i] == '\n')
{
tpnx++,tpny=begy+1;
continue;
}
tpny++;
if (tpny >= min(endy,M-1))
tpny=begy+1,tpnx++;
}
int tadd = tpnx - endx + 2;
if (tadd <= 0) goto xt;
tpnx = begx+1;
tpny = begy+1;
repeat(i,nowx,l-1,1)
{
if (tpnx == tadd+begx)
{
nowx = i;
break;
}
if (note[i] == '\n')
{
tpnx++,tpny=begy+1;
continue;
}
tpny++;
if (tpny >= min(endy,M-1))
tpny=begy+1,tpnx++;
}
xt:
string tmp(note,nowx,note.size());
output(tmp,begx+1,begy+1,endy-1);
}
};/*Class: streambox*/
template <typename T>
streambox& operator << (streambox nx, T x){
nx.setnote(x);
return nx;
}
};

Test Game:


using namespace EasilyPrtSc; string choice[]={"","1. Buy things.","2. Fight.","3. Sleep (add 50 hp).","4. \?\?\?(a special thing)","5. fight with G(difficult)","exit"};
string shop[]={"","1. sharp knife.(ATK add 15)$ 50","2. king's sword(ATK add 400),$ 1000",
"3. Valgulious(ATK add 1000,HP add 700) $ 2000, and answer one question",
"4. Insania(ATK add 2000,HP add 1000) $ 3000, and answer one question",
"5. Seniorious(ATK add 10000, HP add 2000) $5000, and answer one question"}; int type;
int money = 0;
int life = 100;
int ATK = 0;
string name; string p[] = {"","farmer","trader","fighter"};
label tp2;
label tp1;
streambox tp4;
void printtag()
{
stringstream ss;
ss << "Username: " << name << '\n' << "industry: " << p[type] << '\n'
<< "$ Money: " << money << '\n' << "HP: " << life << endl
<< "ATK: " << ATK << endl;
tp2.setnote(ss.str());
} int main()
{
srand(time(NULL));
//It is a test game.
{
stringstream ss;
init(30,50,3);
//Create Screen
tp2.create(1,1,15,30,"Your profiles:");
tp1.create(16,1,30,30,"Task&Tips"); tp4.create(1,31,30,50,"stream");
tp4.setnote("Open the game\n");
inputbox a;
a.create(10,3,27,"Hello!"); a.setnote("what\'s your name?",name); string tt = "Username: ";
tp2.setnote(tt+name); tp4.setnote("registered\nUsername: ");
tp4.setnote(name);
tp4.setnote('\n');
//label tp3;
pause; selectbox tp3;
tp3.create(3,3,27,27,"Choice your industry");
type = tp3.setnote(p,3);
if (type == 1)
ATK = 100,
money = 100;
else if (type == 2)
ATK = 50,
money = 200;
else ATK = 300;
ss << "Username: " << name << '\n' << "industry: " << p[type] << '\n'
<< "$ Money: " << money << '\n' << "HP: " << life << endl
<< "ATK: " << ATK << endl;
tp2.setnote(ss.str()); tp4.setnote("industry: ");
tp4.setnote(p[type]);
tp4.setnote('\n');
ss.str(""); ss << "Please read this tag as slow as you can.\n";
tp1.setnote(ss.str());
pause; ss << "Your target is to kill Gravity." << endl;
tp1.setnote(ss.str());
pause; ss << "Gravity is the biggest boss, but it recently killed by class 9 people." << endl;
tp1.setnote(ss.str());
pause; ss << "Before to deal with Gravity, you should add your ATK and HP." << endl;
tp1.setnote(ss.str());
pause; ss << "Good Luck!\n" ;
tp1.setnote(ss.str());
pause; tp1.setnote("");
pause;
} //tp2|tp4
//---|
//tp1| //switch box tp3;
while (life > 0){
selectbox tt;
tt.create(10,5,25,35,"Choices");
int tp = tt.setnote(choice,5);
tp4.setnote("Choice: ");
tp4.setnote(choice[tp]);
tp4.setnote("\n");
if (tp == 3)
{
tp4.setnote("HP += 50\n");
printtag();
life += 50;
Sleep(5000);
}
if (tp == 1)
{
tt.create(10,5,25,35,"Shop");
int o = tt.setnote(shop,5);
tp4.setnote("Try to buy ");
tp4.setnote(shop[o]);
tp4.setnote("...");
if (o == 1)
{
if (money < 50)
tp4.setnote("Failed. No money left.\n");
else
tp4.setnote("Successful. ATK add 15.\n"),ATK+=15,money-=50;
}
if (o == 2)
{
if (money < 1000)
tp4.setnote("Failed. No money left.\n");
else
tp4.setnote("Successful. ATK add 400.\n"),ATK+=400,money-=1000;
}
if (o == 3)
{
if (money < 2000)
tp4.setnote("Failed. No money left.\n");
else
{
inputbox a;
a.create(15,3,47,"Question");
string k;
a.setnote("Who use this sword?(First name)",k);
if (k == "Ithea")
tp4.setnote("Successful. ATK add 1000,HP add 700.\n"),ATK+=1000,life+=700,money-=2000;
else
{
tp4.setnote("Failed. Wrong answer.\n");
msgbox tty;
tty.create(10,10,20,20,"Sorry");
tty.setnote("Sorry! Wrong Answer.");
}
}
}
if (o == 4)
{
if (money < 3000)
tp4.setnote("Failed. No money left.\n");
else
{
inputbox a;
a.create(15,3,47,"Question");
string k;
a.setnote("Who use this sword?(First name)",k);
if (k == "Nephren")
tp4.setnote("Successful.ATK add 2000,HP add 1000.\n"),ATK+=2000,life+=1000,money-=1000;
else
{
tp4.setnote("Failed. Wrong answer.\n");
msgbox tty;
tty.create(10,10,20,20,"Sorry");
tty.setnote("Sorry! Wrong Answer.");
}
}
}
if (o == 5)
{
if (money < 5000)
tp4.setnote("Failed. No money left.\n");
else
{
inputbox a;
a.create(15,3,47,"Question");
string k;
a.setnote("Who use this sword?(First name)",k);
if (k == "Chtholly")
tp4.setnote("Successful.ATK add 10000, HP add 2000.\n"),ATK+=10000,life+=2000,money-=5000;
else
{
tp4.setnote("Failed. Wrong answer.\n");
msgbox tty;
tty.create(10,10,20,20,"Sorry");
tty.setnote("Sorry! Wrong Answer.");
}
}
}
}
if (tp == 2)
{
int ATKp = rand()%20 - 10 + min((int)(ATK*0.7),200);
int HPp = rand()%20 - 10 + min((int)(life*0.5),400);
int MON = (ATKp + HPp) / 5;
stringstream ss;
while (1){
printtag();
ss.str("");
ss << "The enemy's Profile:\nATK: "<<ATKp <<endl<< "HP: "<<HPp
<< endl << "Money: " << MON << endl;
tp1.setnote(ss.str());
tt.create(3,3,15,35,"Choice");
string tp_2[] = {"","Fight","Run away"};
int res = tt.setnote(tp_2,2);
tp4.setnote(tp_2[res]);
tp4.setnote("\n");
if (res == 2)
{
break;
}
if (res == 1)
{
life -= max(0,ATKp - ATK/5);
HPp -= max(0,ATK - ATKp/5);
}
if (life <= 0)
{
msgbox tpp;
stringstream sss;
sss << "Game over.\nFinal ATK: " << ATK << endl
<< "Final Money: " << money << endl
<< "Level:" << ATK/100 + money/50;
tp4.setnote(sss.str());
tpp.create(10,10,35,25,"Sorry");
tpp.setnote(sss.str());
return 0;
}
if (HPp <= 0)
{
msgbox tpp;
tp4.setnote("Killed.\n");
tp4.setnote("money add ");
tp4.setnote(MON);
tp4.setnote("\n");
money += MON;
tpp.create(10,10,25,35,"Success");
tpp.setnote("You successfully Killed the enemy.");
break;
}
} }
if (tp == 4)
{
int tag = rand()%100;
if (tag < 30) life += 100;
else if (tag < 50) ATK += 10;
else life -= 100;
printtag();
}
if (tp == 5)
{
int ATKp = 40000;
int HPp = 70000;
stringstream ss;
while (1){
printtag();
ss.str("");
ss << "The enemy's Profile:\nATK: "<<ATKp <<endl<< "HP: "<<HPp
<< endl;
tp1.setnote(ss.str());
tt.create(3,3,15,35,"Choice");
string tp_2[] = {"","Fight","Run away"};
int res = tt.setnote(tp_2,2);
tp4.setnote(tp_2[res]);
tp4.setnote("\n");
if (res == 2)
{
break;
}
if (res == 1)
{
life -= max(0,ATKp - ATK/5);
HPp -= max(0,ATK - ATKp/5);
}
if (life <= 0)
{
msgbox tpp;
stringstream sss;
sss << "Game over.\nFinal ATK: " << ATK << endl
<< "Final Money: " << money << endl
<< "Level:" << ATK/100 + money/50;
tp4.setnote(sss.str());
tpp.create(10,10,25,35,"Sorry");
tpp.setnote(sss.str());
return 0;
}
if (HPp <= 0)
{
msgbox tpp;
tpp.create(10,10,25,35,"Success");
tpp.setnote("You Win.");
return 0;
}
} }
printtag();
} }

EasyPrtSc sec[1.2] 发布!的更多相关文章

  1. [转]ThinkCMF框架任意内容包含漏洞分析复现

    0x00 简介 ThinkCMF是一款基于PHP+MYSQL开发的中文内容管理框架,底层采用ThinkPHP3.2.3构建.ThinkCMF提出灵活的应用机制,框架自身提供基础的管理功能,而开发者可以 ...

  2. benchmark pm2的cluster模式发布web app的性能与相关问题解决方法

    pm2以cluster集群方式发布app,可以高效地利用多核cpu,有效提升吞吐量.在上周对公司的redmine服务器进行性能调优后,深感ruby on rails的性能低下,这次测试nodejs的s ...

  3. Maven发布web项目到tomcat

    在java开发中经常要引入很多第三方jar包:然而无论是java web开发还是其他java项目的开发经常会由于缺少依赖包引来一些不必要的异常.常常也是因为这样的原因导致许多简单的缺包和版本问题耗费大 ...

  4. Redis 学习之持久化机制、发布订阅、虚拟内存

    一.持久化机制 Redis是一个支持持久化的内存数据库,redis会经常将内存中的数据同步到硬盘上来保证数据持久化,从而避免服务器宕机数据丢失问题,或者减少服务器内存消耗提高性能. 持久化方式: 1. ...

  5. 最简单的基于librtmp的示例:发布(FLV通过RTMP发布)

    ===================================================== 最简单的基于libRTMP的示例系列文章列表: 最简单的基于librtmp的示例:接收(RT ...

  6. Akka-Cluster(2)- distributed pub/sub mechanism 分布式发布/订阅机制

    上期我们介绍了cluster singleton,它的作用是保证在一个集群环境里永远会有唯一一个singleton实例存在.具体使用方式是在集群所有节点部署ClusterSingletonManage ...

  7. kafka 基础知识梳理-kafka是一种高吞吐量的分布式发布订阅消息系统

    一.kafka 简介 今社会各种应用系统诸如商业.社交.搜索.浏览等像信息工厂一样不断的生产出各种信息,在大数据时代,我们面临如下几个挑战: 如何收集这些巨大的信息 如何分析它 如何及时做到如上两点 ...

  8. 免证书发布ipa文件真机测试

    首先设备得越狱 众所周知,在Xcode上开发的程序只能在模拟器中运行,如果要放到真机上则要花费99美金购买开发者证书iDP.这严重阻碍了我等草根开发者探索的脚步.写个小程序,同学间分享一下这个小小的愿 ...

  9. Python 3.8.0 正式版发布,新特性初体验

    北京时间 10 月 15 日,Python 官方发布了 3.8.0 正式版,该版本较 3.7 版本再次带来了多个非常实用的新特性. 赋值表达式 PEP 572: Assignment Expressi ...

随机推荐

  1. 300英雄的危机(heroes)

    题面 正解与图书馆馆长的考验一致,都是分层图SPFA: #include <iostream> #include <cstdio> #include <cstring&g ...

  2. copy小练习

    # 1. # 有如下 # v1 = {'郭宝元', '李杰', '太白', '梦鸽'} # v2 = {'李杰', '景女神} # 请得到 v1 和 v2 的交集并输出 # 请得到 v1 和 v2 的 ...

  3. [Next] 四.在next中引入redux

    添加 redux 写过 react 稍微复杂一些应用的话,应该都对 redux(mobx)有一定的了解.这次将 redux 引入到项目中 因为之前写项目的习惯,更喜欢使用 redux-thunk 改写 ...

  4. ITCAST-C# 委托

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _12委 ...

  5. centos安装配置php

    PHP的安装同样需要经过环境检查.编译和安装3个步骤. 1.首先用百度搜索 “PHP:Downloads”, 点击第一个网页: 选择5.5.37版本,选择 .tar.gz 格式的文件: 来到镜像列表网 ...

  6. 教你用python爬取网站美女图(附代码及教程)

    我前几篇文章都是说一些python爬虫库的用法,还没有说怎样利用好这些知识玩一些好玩的东西.那我今天带大家玩好玩又刺激的,嘻嘻!对了,requests库和正则表达式很重要的,一定要学会!一定要学会!! ...

  7. Nginx配置,请求到tomcat中

    一.web服务器分为两类 1.web服务器 1)Apache服务器 2)Nginx 3)IIS 2.web 应用服务器 1)tomcat 2)resin 3)jetty 区分:web服务器不能解析js ...

  8. linux创建定时任务发送钉钉通知

    一.现在钉钉里面添加机器人 添加成功后,复制出Webhook链接. 注意,自定义关键字时你的发送信息中一定要完整包含关键字 二.找到自己的服务器 1. sudo su 切换到root用户 2.cron ...

  9. Spark查询yarn任务日志

    查看日志:yarn logs -applicationId application_xxx 导入到外部文件 yarn logs -applicationId application_xxx >& ...

  10. c++ 数组 结构体

    接下来的一点时间我将会记录下我看的c++的一些心得体会,人贵在坚持,希望我可以一直坚持下去!!Go Fighting!   一.c++复合数据类型: 数组类型的一些注意事项: sizeof的用法: 当 ...