哈利波特Version β 哈利波特自制版本0.1.1

18 篇文章 0 订阅
13 篇文章 0 订阅
//Self_Made "Harry Potter" Game in C++
//Version 0.1.1 beta
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
slowout(string s,int a){
	for(int i=0;i<a;i++){
		cout<<s[i];
		Sleep(100);
	}
	return 0;
}
void gotoxy(HANDLE hOut, int x, int y)//移动光标 
{
	COORD pos;
	pos.X = x; //横坐标
	pos.Y = y; //纵坐标
	SetConsoleCursorPosition(hOut, pos);
}
void middle(char str[],int y)
{
	HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO bInfo;
    GetConsoleScreenBufferInfo(hOutput, &bInfo);
    int dwSizeX=bInfo.dwSize.X,dwSizey=bInfo.dwSize.Y;//获取控制台屏幕缓冲区大小
    int len=strlen(str);//获取要输出的字符串的长度
	int x=dwSizeX/2-len/2;
	gotoxy(hOutput,x,y);//移动光标
	slowout(str,len);
} 
int main(){
	slowout("Welcome to this magic world",27);
	cout<<endl;
	Sleep(500);
	slowout("Please wait a minute",20);
	Sleep(2000);
	cout<<endl;
	system("pause");
	system("cls");
	for(int i=0;i<3;i++) {
		middle("<-------------->",7);
		system("cls");
	}
	cout<<endl;
	Sleep(250);
	system("cls");
	slowout("Choose your camp",16);
	cout<<endl;
	slowout("1.Voldemort",11);
	cout<<" ";
	slowout("2.Harry Potter",14);
	int camp;
	cout<<endl;
	cout<<" You will be in Voldemort camp if you print 1 "<<endl<<"you will be in Harry Potter's camp if you print 2"<<endl<<"print your choose on here-> ";
	cin>>camp;
	int x=MessageBox(GetForegroundWindow(),"你确定吗? 取消将退出游戏","温馨提示",1);
	if(x!=1){
		slowout("Goodbye",7);
		Sleep(1000);
		cout<<endl;
		system("pause");
		return 0;
	}
	else if(camp>1||camp<0){
		cout<<"选择阵营时出现输入错误 我们为您退出游戏 否则后面将会冒出巨大的bug哦~"<<endl;
		Sleep(1000);
		system("pause");
		return 0;
	}
	return 0;
}

好了 暂时还在做 能更新就更新哦~

以上就是本期所有内容了 谢谢

希望各位大佬们点个赞👍吧!!!求求啦~~~
关注+点赞超过100个立马更新哦!
版权声明:本文为CSDN博主「ian20120124_」的原创文章,如需转载,请通知CSDN博主「ian20120124_」。
 


  • 15
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值