自创扫雷2.0(并不是原版)(不喜勿喷)
2026-08-18 20:46:21
发布于:湖北
上期内容
码接上回
点赞依旧只有4个










但我自己喂鸡汤
把我劝服了再次更新
所以广大网友们给我亿点点点赞吧
(祝所有点赞+评论的人开盲盒开出1999,888,399,遇不到199,99,66!!!!!!!!!!!!)
这次我加入了双人模式
Windows系统版
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
string dd={"1.如果扫雷开出空格,那么游戏继续"};
string ee={"2.如果扫雷开出宝,那么如果你以后开出地雷,就可以抵消一次伤害,游戏可以继续"};
string ff={"3.如果扫雷开出雷,那么如果你之前开出宝,就可以抵消这一次伤害,游戏可以继续,否则游戏结束"};
string gg={"4.如果扫雷开出积分,那么可以增加积分,游戏可以继续"};
string a[9][9];
string o[9][9];
int mm[9][9]={{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0}};
char m;
int score=0,score1=0,score2=0;
void w(){
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
o[i][j]="■";
}
}
}
void c(){
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
a[i][j]="■";
}
}
}//初始化
void b(){
cout<<" 1 2 3 4 5 6 7 8 9\n";
for(int i=0;i<9;i++){
cout<<i+1;
for(int j=0;j<9;j++){
cout<<o[i][j]<<" ";
}cout<<endl;
}
cout<<"得分:"<<score<<endl;
}//输出
void B(){
cout<<" 1 2 3 4 5 6 7 8 9\n";
for(int i=0;i<9;i++){
cout<<i+1;
for(int j=0;j<9;j++){
cout<<o[i][j]<<" ";
}cout<<endl;
}
}
int main(){
srand((unsigned)time(NULL));
while(true){
c();
w();
int d,f,g=0,h,l,t,y,r,e,s,q=81,z,u,U,Q=81,Y,Z,H,S,L,R,T,G=0,G1=0;
cout<<"1.单人模式\n2.双人模式\n3.查看规则\n4.退出游戏\n";
cin>>d;
if(d!=1&&d!=2&&d!=3&&d!=4){
system("cls");
cout<<"选择无效!\n";
Sleep(1000);
system("cls");
continue;
}
if(d==1){
string e;
cout<<"请输入姓名:";
cin>>e;
cout<<e<<"登录成功!";
Sleep(2000);
system("cls");
cout<<e<<"欢迎来到扫雷游戏";
Sleep(2000);
system("cls");
for(int i=0;i<3;i++){
cout<<"加载游戏中";
Sleep(500);
for(int j=0;j<3;j++){
cout<<".";
Sleep(500);
}
system("cls");
}
cout<<"加载成功!\n";
Sleep(2000);
system("cls");
cout<<"请输入地雷个数(1<=地雷个数<=80):";
cin>>u;
if(u>=q){
system("cls");
cout<<"选择无效!\n";
Sleep(3000);
system("cls");
continue;
}
q-=u;
for(int i=1;i<=u;i++){
y=rand()%9;
z=rand()%9;
if(a[y][z]=="雷"){
i--;
}else{
a[y][z]="雷";
}
}//生成地雷
cout<<"请输入宝藏个数(10<=宝藏个数<=80):";
cin>>h;
if(h>=q){
system("cls");
cout<<"选择无效!\n";
Sleep(1000);
system("cls");
continue;
}
q-=h;
for(int i=1;i<=h;i++){
y=rand()%9;
z=rand()%9;
if(a[y][z]=="雷"||a[y][z]=="宝"){
i--;
}else{
a[y][z]="宝";
}
}//生成宝藏的个数
cout<<"请输入分数格子的个数(10<=分数格子的个数<=80):";
cin>>s;
if(s>=q){
system("cls");
cout<<"选择无效!\n";
Sleep(1000);
system("cls");
continue;
}
q-=s;
for(int i=1;i<=s;i++){
y=rand()%9;
z=rand()%9;
if(a[y][z]=="雷"||a[y][z]=="宝"||(a[y][z]>="1"&&a[y][z]<="3")){
i--;
}else{
int nn=rand()%3+1;
a[y][z]=char(nn+48);
mm[y][z]=nn;
}
}//生成分数格子数
cout<<"请输入至少选择多少空格才能胜利:";
cin>>l;
if(l>q){
system("cls");
cout<<"选择无效!\n";
Sleep(1000);
system("cls");
continue;
}
for(int i=0;i<l;i++){
system("cls");
b();
cout<<"请输入行数:";
cin>>r;
cout<<"请输入列数:";
cin>>t;
Sleep(1000);
system("cls");
if(o[r-1][t-1]==" "||o[r-1][t-1]=="雷"||o[r-1][t-1]=="宝"||o[r-1][t-1]>=" 1"&&o[r-1][t-1]<=" 3"||r>=10||t>=10){
cout<<"选择无效!\n";
cout<<"请重新输入!!!";
i--;
Sleep(3000);
system("cls");
continue;
}
if(a[r-1][t-1]=="雷"&&g==0){
o[r-1][t-1]="雷";
b();
Sleep(3000);
system("cls");
cout<<e<<"你失败了\n";
cout<<"得分:"<<score;
return 0;
}else if(a[r-1][t-1]=="雷"&&g!=0){
g--;
o[r-1][t-1]="雷";
b();
}else if(a[r-1][t-1]=="宝"){
g++;
o[r-1][t-1]="宝";
b();
}else if(a[r-1][t-1]>="1"&&a[r-1][t-1]<="3"){
o[r-1][t-1]=" "+a[r-1][t-1];
score+=mm[r-1][t-1];
b();
}else if(a[r-1][t-1]=="■"){
o[r-1][t-1]=" ";
b();
}
}cout<<e<<"你胜利了\n";
cout<<"得分:"<<score;
}else if(d==2){
int ooo=81;
string pp,PP;
cout<<"请输入一号玩家的姓名:";
cin>>pp;
cout<<"\n请输入二号玩家的姓名:" ;
cin>>PP;
Sleep(2000);
system("cls");
cout<<pp<<"和"<<PP<<"欢迎来到扫雷游戏";
Sleep(2000);
system("cls");
for(int i=0;i<3;i++){
cout<<"加载游戏中";
Sleep(500);
for(int j=0;j<3;j++){
cout<<".";
Sleep(500);
}
system("cls");
}
cout<<"加载成功!\n";
Sleep(2000);
system("cls");
cout<<"请输入地雷个数(1<=地雷个数<=80):";
cin>>U;
if(U>=Q){
system("cls");
cout<<"选择无效!\n";
Sleep(3000);
system("cls");
continue;
}
Q-=U;
ooo-=U;
for(int i=1;i<=U;i++){
Y=rand()%9;
Z=rand()%9;
if(a[Y][Z]=="雷"){
i--;
}else{
a[Y][Z]="雷";
}
}//生成地雷
cout<<"请输入宝藏个数(10<=宝藏个数<=80):";
cin>>H;
if(H>=Q){
system("cls");
cout<<"选择无效!\n";
Sleep(1000);
system("cls");
continue;
}
Q-=H;
for(int i=1;i<=H;i++){
Y=rand()%9;
Z=rand()%9;
if(a[Y][Z]=="雷"||a[Y][Z]=="宝"){
i--;
}else{
a[Y][Z]="宝";
}
}//生成宝藏的个数
cout<<"请输入分数格子的个数(10<=分数格子的个数<=80):";
cin>>S;
if(S>=Q){
system("cls");
cout<<"选择无效!\n";
Sleep(1000);
system("cls");
continue;
}
Q-=S;
for(int i=1;i<=S;i++){
Y=rand()%9;
Z=rand()%9;
if(a[Y][Z]=="雷"||a[Y][Z]=="宝"||(a[Y][Z]>="1"&&a[Y][Z]<="3")){
i--;
}else{
int nn=rand()%3+1;
a[Y][Z]=char(nn+48);
mm[Y][Z]=nn;
}
}//生成分数格子数
int ou=0;
while(ooo!=0){
system("cls");
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
if(ou%2==0){
ou++;
cout<<"请"<<pp<<"输入行数:";
cin>>R;
cout<<"请"<<pp<<"输入列数:";
cin>>T;
if(o[R-1][T-1]==" "||o[R-1][T-1]=="雷"||o[R-1][T-1]=="宝"||o[R-1][T-1]>=" 1"&&o[R-1][T-1]<=" 3"||R>=10||T>=10){
cout<<"选择无效!\n";
cout<<"请重新输入!!!";
ooo++;
Sleep(3000);
system("cls");
continue;
}
if(a[R-1][T-1]=="雷"&&G==0){
o[R-1][T-1]="雷";
system("cls");
B();
Sleep(3000);
system("cls");
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
cout<<pp<<"你失败了"<<endl;
cout<<PP<<"你成功了"<<endl;
Sleep(5000);
break;
}else if(a[R-1][T-1]=="雷"&&G>0){
o[R-1][T-1]="雷";
G--;
system("cls");
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]=="宝"){
o[R-1][T-1]="宝";
G++;
system("cls");
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]>="1"&&a[R-1][T-1]<="3"){
o[R-1][T-1]=" "+a[R-1][T-1];
score1+=mm[R-1][T-1];
system("cls");
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]>="■"){
o[R-1][T-1]=" ";
system("cls");
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}
}
else{
ou++;
cout<<"请"<<PP<<"输入行数:";
cin>>R;
cout<<"请"<<PP<<"输入列数:";
cin>>T;
if(o[R-1][T-1]==" "||o[R-1][T-1]=="雷"||o[R-1][T-1]=="宝"||o[R-1][T-1]>=" 1"&&o[R-1][T-1]<=" 3"||R>=10||T>=10){
cout<<"选择无效!\n";
cout<<"请重新输入!!!";
ooo++;
Sleep(3000);
system("cls");
continue;
}
if(a[R-1][T-1]=="雷"&&G1==0){
o[R-1][T-1]="雷";
system("cls");
B();
Sleep(3000);
system("cls");
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
cout<<pp<<"你成功了"<<endl;
cout<<PP<<"你失败了"<<endl;
Sleep(5000);
break;
}else if(a[R-1][T-1]=="雷"&&G1>0){
o[R-1][T-1]="雷";
G1--;
system("cls");
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]=="宝"){
o[R-1][T-1]="宝";
G1++;
system("cls");
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]>="1"&&a[R-1][T-1]<="3"){
o[R-1][T-1]=" "+a[R-1][T-1];
score2+=mm[R-1][T-1];
system("cls");
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]>="■"){
o[R-1][T-1]=" ";
system("cls");
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}
}
ooo--;
}
}
else if(d==3){
system("cls");
int aa;
cout<<"1.直接输出(较快)\n2.分字输出(一个字一个字得输出)\n";
cin>>aa;
system("cls");
if(aa==1){
cout<<"单人模式:\n";
cout<<dd<<endl<<ee<<endl<<ff<<endl<<gg<<endl;
Sleep(10000);
}else if(aa==2){
cout<<"单人模式:\n";
for(int j=0;j<dd.size();j++){
cout<<dd[j];
Sleep(50);
}cout<<endl;
for(int j=0;j<ee.size();j++){
cout<<ee[j];
Sleep(50);
}cout<<endl;
for(int j=0;j<ff.size();j++){
cout<<ff[j];
Sleep(50);
}cout<<endl;
for(int j=0;j<gg.size();j++){
cout<<gg[j];
Sleep(50);
}cout<<endl;
}
Sleep(10000);
}else if(d==4){
system("cls");
cout<<"退出游戏成功";
return 0;
}
char yy;
system("cls");
cout<<"是否继续(Y/N)";
cin>>yy;
if(yy=='N'){
cout<<"游戏退出";
return 0;
}else{
system("cls");
score=0,score1=0,score2=0;
}
}
return 0;
}
华为 Linux版(这个用AI转的)
#include<bits/stdc++.h>
#ifdef _WIN32
#include <windows.h>
#define SLEEP_MS(x) Sleep(x)
#define CLS system("cls")
#else
#include<unistd.h>
#define SLEEP_MS(x) usleep((x)*1000)
#define CLS system("clear")
#endif
using namespace std;
string dd={"1.如果扫雷开出空格,那么游戏继续"};
string ee={"2.如果扫雷开出宝,那么如果你以后开出地雷,就可以抵消一次伤害,游戏可以继续"};
string ff={"3.如果扫雷开出雷,那么如果你之前开出宝,就可以抵消这一次伤害,游戏可以继续,否则游戏结束"};
string gg={"4.如果扫雷开出积分,那么可以增加积分,游戏可以继续"};
string a[9][9];
string o[9][9];
int mm[9][9]={{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0}};
char m;
int score=0,score1=0,score2=0;
void w(){
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
o[i][j]="■";
}
}
}
void c(){
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
a[i][j]="■";
}
}
}
void b(){
cout<<" 1 2 3 4 5 6 7 8 9\n";
for(int i=0;i<9;i++){
cout<<i+1;
for(int j=0;j<9;j++){
cout<<o[i][j]<<" ";
}cout<<endl;
}
cout<<"得分:"<<score<<endl;
}
void B(){
cout<<" 1 2 3 4 5 6 7 8 9\n";
for(int i=0;i<9;i++){
cout<<i+1;
for(int j=0;j<9;j++){
cout<<o[i][j]<<" ";
}cout<<endl;
}
}
int main(){
srand((unsigned)time(NULL));
while(true){
c();
w();
int d,f,g=0,h,l,t,y,r,e,s,q=81,z,u,U,Q=81,Y,Z,H,S,L,R,T,G=0,G1=0;
cout<<"1.单人模式\n2.双人模式\n3.查看规则\n4.退出游戏\n";
cin>>d;
if(d!=1&&d!=2&&d!=3&&d!=4){
CLS;
cout<<"选择无效!\n";
SLEEP_MS(1000);
CLS;
continue;
}
if(d==1){
string e;
cout<<"请输入姓名:";
cin>>e;
cout<<e<<"登录成功!";
SLEEP_MS(2000);
CLS;
cout<<e<<"欢迎来到扫雷游戏";
SLEEP_MS(2000);
CLS;
for(int i=0;i<3;i++){
cout<<"加载游戏中";
SLEEP_MS(500);
for(int j=0;j<3;j++){
cout<<".";
SLEEP_MS(500);
}
CLS;
}
cout<<"加载成功!\n";
SLEEP_MS(2000);
CLS;
cout<<"请输入地雷个数(1<=地雷个数<=80):";
cin>>u;
if(u>=q){
CLS;
cout<<"选择无效!\n";
SLEEP_MS(3000);
CLS;
continue;
}
q-=u;
for(int i=1;i<=u;i++){
y=rand()%9;
z=rand()%9;
if(a[y][z]=="雷"){
i--;
}else{
a[y][z]="雷";
}
}
cout<<"请输入宝藏个数(10<=宝藏个数<=80):";
cin>>h;
if(h>=q){
CLS;
cout<<"选择无效!\n";
SLEEP_MS(1000);
CLS;
continue;
}
q-=h;
for(int i=1;i<=h;i++){
y=rand()%9;
z=rand()%9;
if(a[y][z]=="雷"||a[y][z]=="宝"){
i--;
}else{
a[y][z]="宝";
}
}
cout<<"请输入分数格子的个数(10<=分数格子的个数<=80):";
cin>>s;
if(s>=q){
CLS;
cout<<"选择无效!\n";
SLEEP_MS(1000);
CLS;
continue;
}
q-=s;
for(int i=1;i<=s;i++){
y=rand()%9;
z=rand()%9;
if(a[y][z]=="雷"||a[y][z]=="宝"||(a[y][z]>="1"&&a[y][z]<="3")){
i--;
}else{
int nn=rand()%3+1;
a[y][z]=char(nn+48);
mm[y][z]=nn;
}
}
cout<<"请输入至少选择多少空格才能胜利:";
cin>>l;
if(l>q){
CLS;
cout<<"选择无效!\n";
SLEEP_MS(1000);
CLS;
continue;
}
for(int i=0;i<l;i++){
CLS;
b();
cout<<"请输入行数:";
cin>>r;
cout<<"请输入列数:";
cin>>t;
SLEEP_MS(1000);
CLS;
if(o[r-1][t-1]==" "||o[r-1][t-1]=="雷"||o[r-1][t-1]=="宝"||o[r-1][t-1]>=" 1"&&o[r-1][t-1]<=" 3"||r>=10||t>=10){
cout<<"选择无效!\n";
cout<<"请重新输入!!!";
i--;
SLEEP_MS(3000);
CLS;
continue;
}
if(a[r-1][t-1]=="雷"&&g==0){
o[r-1][t-1]="雷";
b();
SLEEP_MS(3000);
CLS;
cout<<e<<"你失败了\n";
cout<<"得分:"<<score;
return 0;
}else if(a[r-1][t-1]=="雷"&&g!=0){
g--;
o[r-1][t-1]="雷";
b();
}else if(a[r-1][t-1]=="宝"){
g++;
o[r-1][t-1]="宝";
b();
}else if(a[r-1][t-1]>="1"&&a[r-1][t-1]<="3"){
o[r-1][t-1]=" "+a[r-1][t-1];
score+=mm[r-1][t-1];
b();
}else if(a[r-1][t-1]=="■"){
o[r-1][t-1]=" ";
b();
}
}cout<<e<<"你胜利了\n";
cout<<"得分:"<<score;
}else if(d==2){
int ooo=81;
string pp,PP;
cout<<"请输入一号玩家的姓名:";
cin>>pp;
cout<<"\n请输入二号玩家的姓名:" ;
cin>>PP;
SLEEP_MS(2000);
CLS;
cout<<pp<<"和"<<PP<<"欢迎来到扫雷游戏";
SLEEP_MS(2000);
CLS;
for(int i=0;i<3;i++){
cout<<"加载游戏中";
SLEEP_MS(500);
for(int j=0;j<3;j++){
cout<<".";
SLEEP_MS(500);
}
CLS;
}
cout<<"加载成功!\n";
SLEEP_MS(2000);
CLS;
cout<<"请输入地雷个数(1<=地雷个数<=80):";
cin>>U;
if(U>=Q){
CLS;
cout<<"选择无效!\n";
SLEEP_MS(3000);
CLS;
continue;
}
Q-=U;
ooo-=U;
for(int i=1;i<=U;i++){
Y=rand()%9;
Z=rand()%9;
if(a[Y][Z]=="雷"){
i--;
}else{
a[Y][Z]="雷";
}
}//生成地雷
cout<<"请输入宝藏个数(10<=宝藏个数<=80):";
cin>>H;
if(H>=Q){
CLS;
cout<<"选择无效!\n";
SLEEP_MS(1000);
CLS;
continue;
}
Q-=H;
for(int i=1;i<=H;i++){
Y=rand()%9;
Z=rand()%9;
if(a[Y][Z]=="雷"||a[Y][Z]=="宝"){
i--;
}else{
a[Y][Z]="宝";
}
}//生成宝藏的个数
cout<<"请输入分数格子的个数(10<=分数格子的个数<=80):";
cin>>S;
if(S>=Q){
CLS;
cout<<"选择无效!\n";
SLEEP_MS(1000);
CLS;
continue;
}
Q-=S;
for(int i=1;i<=S;i++){
Y=rand()%9;
Z=rand()%9;
if(a[Y][Z]=="雷"||a[Y][Z]=="宝"||(a[Y][Z]>="1"&&a[Y][Z]<="3")){
i--;
}else{
int nn=rand()%3+1;
a[Y][Z]=char(nn+48);
mm[Y][Z]=nn;
}
}//生成分数格子数
int ou=0;
while(ooo!=0){
CLS;
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
if(ou%2==0){
ou++;
cout<<"请"<<pp<<"输入行数:";
cin>>R;
cout<<"请"<<pp<<"输入列数:";
cin>>T;
if(o[R-1][T-1]==" "||o[R-1][T-1]=="雷"||o[R-1][T-1]=="宝"||o[R-1][T-1]>=" 1"&&o[R-1][T-1]<=" 3"||R>=10||T>=10){
cout<<"选择无效!\n";
cout<<"请重新输入!!!";
ooo++;
SLEEP_MS(3000);
CLS;
continue;
}
if(a[R-1][T-1]=="雷"&&G==0){
o[R-1][T-1]="雷";
CLS;
B();
SLEEP_MS(3000);
CLS;
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
cout<<pp<<"你失败了"<<endl;
cout<<PP<<"你成功了"<<endl;
SLEEP_MS(5000);
break;
}else if(a[R-1][T-1]=="雷"&&G>0){
o[R-1][T-1]="雷";
G--;
CLS;
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]=="宝"){
o[R-1][T-1]="宝";
G++;
CLS;
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]>="1"&&a[R-1][T-1]<="3"){
o[R-1][T-1]=" "+a[R-1][T-1];
score1+=mm[R-1][T-1];
CLS;
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]=="■"){
o[R-1][T-1]=" ";
CLS;
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}
}
else{
ou++;
cout<<"请"<<PP<<"输入行数:";
cin>>R;
cout<<"请"<<PP<<"输入列数:";
cin>>T;
if(o[R-1][T-1]==" "||o[R-1][T-1]=="雷"||o[R-1][T-1]=="宝"||o[R-1][T-1]>=" 1"&&o[R-1][T-1]<=" 3"||R>=10||T>=10){
cout<<"选择无效!\n";
cout<<"请重新输入!!!";
ooo++;
SLEEP_MS(3000);
CLS;
continue;
}
if(a[R-1][T-1]=="雷"&&G1==0){
o[R-1][T-1]="雷";
CLS;
B();
SLEEP_MS(3000);
CLS;
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
cout<<pp<<"你成功了"<<endl;
cout<<PP<<"你失败了"<<endl;
SLEEP_MS(5000);
break;
}else if(a[R-1][T-1]=="雷"&&G1>0){
o[R-1][T-1]="雷";
G1--;
CLS;
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]=="宝"){
o[R-1][T-1]="宝";
G1++;
CLS;
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]>="1"&&a[R-1][T-1]<="3"){
o[R-1][T-1]=" "+a[R-1][T-1];
score2+=mm[R-1][T-1];
CLS;
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}else if(a[R-1][T-1]=="■"){
o[R-1][T-1]=" ";
CLS;
B();
cout<<pp<<"得分:"<<score1<<endl;
cout<<PP<<"得分:"<<score2<<endl;
}
}
ooo--;
}
}
else if(d==3){
CLS;
int aa;
cout<<"1.直接输出(较快)\n2.分字输出(一个字一个字得输出)\n";
cin>>aa;
CLS;
if(aa==1){
cout<<"单人模式:\n";
cout<<dd<<endl<<ee<<endl<<ff<<endl<<gg<<endl;
SLEEP_MS(10000);
}else if(aa==2){
cout<<"单人模式:\n";
for(int j=0;j<dd.size();j++){
cout<<dd[j];
SLEEP_MS(50);
}cout<<endl;
for(int j=0;j<ee.size();j++){
cout<<ee[j];
SLEEP_MS(50);
}cout<<endl;
for(int j=0;j<ff.size();j++){
cout<<ff[j];
SLEEP_MS(50);
}cout<<endl;
for(int j=0;j<gg.size();j++){
cout<<gg[j];
SLEEP_MS(50);
}cout<<endl;
}
SLEEP_MS(10000);
}else if(d==4){
CLS;
cout<<"退出游戏成功";
return 0;
}
char yy;
CLS;
cout<<"是否继续(Y/N)";
cin>>yy;
if(yy=='N'){
cout<<"游戏退出";
return 0;
}else{
CLS;
score=0,score1=0,score2=0;
}
}
return 0;
}









下期内容:8月20号出预告
全部评论 9
- 置顶
d
昨天 来自 上海
0 怎么报错了
昨天 来自 浙江
0你的电脑是什么牌子?
昨天 来自 湖北
0我用dev-c++,联想电脑
昨天 来自 浙江
0不应该呀
昨天 来自 湖北
0
string dd={"1.如果扫雷开出空格,那么游戏继续"}; string ee={"2.如果扫雷开出宝,那么如果你以后开出地雷,就可以抵消一次伤害,游戏可以继续"}; string ff={"2.如果扫雷开出雷,那么如果你之前开出宝,就可以抵消这一次伤害,游戏可以继续,否则游戏结束"}; string gg={"2.如果扫雷开出积分,那么可以增加积分,游戏可以继续"};《1,2,2,2》
昨天 来自 浙江
0彳亍
昨天 来自 湖北
0
d
昨天 来自 浙江
0d
昨天 来自 浙江
0dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
昨天 来自 湖北
0








昨天 来自 湖北
0









昨天 来自 湖北
0d
昨天 来自 湖北
0








































有帮助,赞一个