我是一个萌新,这是我的第一段代码,请记得点赞复制(不喜欢不要喷)。
#include<bits/stdc++.h>
#include<windows.h>
/*
头文件其实还可以如下:
#include<iostream>
#include<time.h>
#include<windows.h>
*/
using namespace std;
int score;
void zhuce(){//注册函数
string s1,s2;
cout<<"请输入用户名:";
cin>>s1;
cout<<endl;
cout<<"请输入密码:";
cin>>s2;
}
void denglu(){//登录函数
string s1,s2;
cin>>s1;
cin>>s2;
cout<<"欢迎"<<s1<<endl;
cout<<"密码是"<<"*******";
}
int main(){//主函数
int ans;
srand(time(NULL));//播随机种子
MessageBox(0,"欢迎来到世界上最坑人的小测试","提示",MB_OKCANCEL);
cout<<"请登录:"<<endl;
cout<<"1.登录 2.注册";
cin>>ans;
if(ans==1){
denglu();
}else if(ans==2){
zhuce();
system("cls");
Sleep(1000);
denglu();
}
Sleep(1000);
system("cls");
cout<<"正在匹配教练..."<<endl;
//进度条
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
cout<<"■";
Sleep(500);
system("cls");
/*
选教练
*/
int c=rand()%5;
string abc;
if(c==1){
cout<<"教练是猪霸天!!!";
abc="猪霸天";
}else if(c==2){
cout<<"教练是蔡徐坤!!!";
abc="蔡徐坤";
}else if(c==3){
cout<<"教练是刘华强!!!";
abc="刘华强";
}else if(c==4){
cout<<"教练是蓝色妖姬!!!";
abc="蓝色妖姬";
}else if(c==2){
cout<<"教练是超人强!!!";
abc="超人强";
}
//题目
Sleep(2000);
system("cls");
cout<<"考试开始!不许作弊"<<endl;
Sleep(1000);
system("cls");
system("color 1F");
system("cls");
Beep(800,600);
string ans1;
MessageBoxA(0,"进入了Lv.1级挑战","警告",MB_OKCANCEL);
cout<<"◎(摄像头)"<<endl;
cout<<"*************************************************************"<<endl;
cout<<" 第一题 (填空题) "<<endl;
cout<<" 1.Halloween是什么意思? "<<endl;
cout<<"*************************************************************"<<endl;
cin>>ans1;
if(ans1=="万圣节"){
Beep(100,10000);
MessageBox(0,"答对了!!!!!!","提示",MB_OKCANCEL);
system("cls");
score+=20;
}else{
MessageBoxA(0,"答错了!!","抱歉",MB_OKCANCEL);
int sum=0;
cout<<"你把"<<abc<<"教练惹毛了!它将你打到了外太空,但你在外太空也听到了它的大骂:"<<endl;
cout<<"(自动屏蔽不雅话语)@#/.&%"<<endl;
Sleep(1000);
system("cls");
cout<<"分数是"<<score<<"分";
Sleep(1000);
system("cls");
while(sum<=100){
system("color 1F");
system("color 2F");
system("color 3F");
system("color 4F");
system("color 5F");
system("color AF");
system("color BF");
system("color CF");
system("color DF");
system("color EF");
system("color FF");
sum++;
}
return 0;
}
string ans2;
system("cls");
cout<<"◎(摄像头)"<<endl;
cout<<"*************************************************************"<<endl;
cout<<" 第二题 (填空题) "<<endl;
cout<<" 2.garage是什么意思? "<<endl;
cout<<"*************************************************************"<<endl;
cin>>ans2;
if(ans2=="车库"){
Beep(100,10000);
MessageBox(0,"答对了!!!!!!","提示",MB_OKCANCEL);
score+=20;
}else{
MessageBoxA(0,"答错了!!","抱歉",MB_OKCANCEL);
int sum=0;
cout<<"一只俄罗斯在买天然气,你不买,他给了你一张去天国的单程票,现在正在路上呢。"<<endl;
Sleep(1000);
cout<<"分数是"<<score<<"分";
Sleep(1000);
system("cls");
while(sum<=100){
system("color 1F");
system("color 2F");
system("color 3F");
system("color 4F");
system("color 5F");
system("color AF");
system("color BF");
system("color CF");
system("color DF");
system("color EF");
system("color FF");
sum++;
}
return 0;
}
MessageBoxA(0,"恭喜你,进入了2级挑战","警告",MB_OKCANCEL);
string d;
system("cls");
cout<<"◎(摄像头)"<<endl;
cout<<"*************************************************************"<<endl;
cout<<" 第三题 (选择题) "<<endl;
cout<<" 3.π的第31位是几? "<<endl;
cout<<" A.5 B.8 C.4 D.1 "<<endl;
cout<<"*************************************************************"<<endl;
cin>>d;
if(d=="A"){
Beep(100,10000);
MessageBox(0,"答对了!!!!!!","提示",MB_OKCANCEL);
score+=20;
}else{
MessageBoxA(0,"答错了!!","抱歉",MB_OKCANCEL);
int sum=0;
cout<<"你遇到了"<<abc<<"教练。它看到你这么笨,甩给你3000套卷子巩固知识,从此过上了吃饭,睡觉,刷题,被教练骂的日子"<<endl;
cout<<"(自动屏蔽不雅话语)@#/.&%"<<endl;
Sleep(1000);
cout<<"分数是"<<score<<"分";
Sleep(1000);
system("cls");
while(sum<=100){
system("color 1F");
system("color 2F");
system("color 3F");
system("color 4F");
system("color 5F");
system("color AF");
system("color BF");
system("color CF");
system("color DF");
system("color EF");
system("color FF");
sum++;
}
return 0;
}
system("cls");
cout<<"◎(摄像头)"<<endl;
cout<<"*************************************************************"<<endl;
cout<<" 第四题 (选择题) "<<endl;
cout<<" 4.埃及人最喜欢的昆虫是? "<<endl;
cout<<" A.蝴蝶 B.毛毛虫 C.屎壳郎 D.蚕 "<<endl;
cout<<"*************************************************************"<<endl;
string f;
cin>>f;
if(f=="C"){
Beep(100,10000);
MessageBox(0,"答对了!!!!!!","提示",MB_OKCANCEL);
score+=20;
}else{
MessageBoxA(0,"答错了!!","抱歉",MB_OKCANCEL);
int sum=0;
cout<<"你想暗杀"<<abc<<"教练。它知道后,甩给你3000个大嘴巴子。你KO了"<<endl;
cout<<"(自动屏蔽可怕声音)@#/.&%"<<endl;
Sleep(1000);
cout<<"分数是"<<score<<"分";
Sleep(1000);
system("cls");
while(sum<=100){
system("color 1F");
system("color 2F");
system("color 3F");
system("color 4F");
system("color 5F");
system("color AF");
system("color BF");
system("color CF");
system("color DF");
system("color EF");
system("color FF");
sum++;
}
return 0;
}
system("cls");
MessageBoxA(0,"成功来到最后一题","一级警报!!!",MB_OKCANCEL);
cout<<"*************************************************************"<<endl;
cout<<" 第五题 (最后一题) "<<endl;
cout<<" 5.去自首的路上被抓了还算自首吗? "<<endl;
cout<<"*************************************************************"<<endl;
string bbb;
cin>>bbb;
if(bbb=="不算"){
Beep(100,10000);
MessageBox(0,"答对了!!!!!!","提示",MB_OKCANCEL);
score+=20;
system("cls");
cout<<"你成功的挑战了整个测试,获得了一百分!!!";
cout<<" 你的智商是250";
}else{
int sum=0;
MessageBoxA(0,"你死在了最后一题上","很遗憾",MB_OKCANCEL);
cout<<"教练感到惋惜,带上你一起自杀了"<<endl;
while(sum<=100){
system("color 1F");
system("color 2F");
system("color 3F");
system("color 4F");
system("color 5F");
system("color AF");
system("color BF");
system("color CF");
system("color DF");
system("color EF");
system("color FF");
sum++;
}
return 0;
}
//结束
system("cls");
Beep(100,10000);
cout<<"谢谢运行,记得点赞哦~"<<endl;
Sleep(1000);
system("cls");
return 0;
}
这是全部代码了。