一个闯关游戏(153 行)(Dev c++)
绝对是自创的,不存在搬运,抄袭。
话不多说,直接上代码:
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
int main(){
cout<<"丨作者:老李丨"<<endl;
cout<<"丨爱好:c++/python 丨"<<endl;
cout<<"-----------------"<<endl;
string as,cs;
cout<<"请输入用户名"<<endl;
cin>>as;
cout<<"请输入密码"<<endl;
cin>>cs;
if (as=="ruizhi")
if (cs=="123456") cout<<"正确,欢迎回来," <<as<<endl;
else cout<<"用户名错误"<<endl;
else cout<<"密码错误"<<endl;
while (1)
{
cout<<" 这是一个闯关游戏,按 G 开始 "<<endl;
getch();
int a,b,v,d;
string c,k,u,h,q;
cout<<" (1) (2) (3)
(4) (5) (6) (7) (8) (9)"<<endl;
cin>>a;
if (a==1)
{
cout<<"1+1=?"<<endl;
cin>>b;
if (b==2)
{
cout<<"对了,可以打下一关"<<endl;
}
else