它,依旧报错!
是“#include <random.h>”这一行报错了!
我琢磨了两天也没琢磨出来(QAQ. )
#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<cmath>
#include <stdlib.h>
#include <iostream>
#include <random.h>
using namespace std;
int main()
{
int a,b,ljkjd=1,kjkjd=1,infantry=5,tank=0,plane=0,month=1,jd=0;
int arr[3]={1,2,3};
cout<<" ■■■ ■ ■ ■"<<endl;
cout<<" ■■ ■■■■"<<endl;
cout<<" 二战 ■ ■"<<endl;
cout<<" ■ ■ ■ ■ ■"<<endl;
cout<<" ■■■■ ■ ■■ "<<endl;
cout<<" 1.0版本 "<<endl;
printf("按任意键开始\n");
getch();
system("cls");
//1941年介入战争
MessageBox(NULL,"步兵<坦克<飞机,步兵>飞机","注",MB_OK);
MessageBox(NULL,"准备?","苏军",MB_OK);
MessageBox(NULL,"开始!","苏军",MB_OK);
system("cls");
cout<<"1941年,德军正式向苏联宣战"<<endl;
getch();
while(1){
cout<<"第"<<month<<"个月"<<endl<<"你要:1.生产 2.出击 "<<endl;
cin>>a;
if(a==1){
while(1){
cout<<"你要生产(研制)什么?1.步兵(1陆军科技点1攻击) 2.坦克(2陆军科技点2攻击) 3.飞机(3空军科技点2攻击)";
cout<<endl<<"注:研制不会消耗科技点。";
cin>>a;
if(a==1&&ljkjd>=1){
cout<<"成功!步兵lv+1"<<endl;
printf("按任意键继续\n");
getch();
system("cls");month+=1;infantry+=1;break;
}
else{
cout<<"陆军科技点不足!"<<endl;
printf("按任意键继续\n");
getch();
system("cls");continue;
}
if(a==2&&ljkjd>=2){
cout<<"成功!坦克lv+1"<<endl;
printf("按任意键继续\n");
getch();
system("cls");month+=1;tank+=2;break;
}
else{
cout<<"陆军科技点不足!"<<endl;
printf("按任意键继续\n");
getch();
system("cls");continue;
}
if(a==3&&kjkjd>=3){
cout<<"成功!飞机lv+1"<<endl;
printf("按任意键继续\n");
getch();
system("cls");month+=1;plane+=2;break;
}
else{
cout<<"空军科技点不足!"<<endl;
printf("按任意键继续\n");
getch();
system("cls");continue;
}
}
}
if(a==2){
int size=sizeof(arr)/sizeof(arr[0]);
while(1){
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> dis(0, size - 1);
int randomIndex = dis(gen);
int enemy = arr[randomIndex];
if(infantry>enemy||tank>enemy||plane>enemy||infantry+tank>enemy){
cout<<"胜利! 获得:陆军科技点*3! 空军科技点*1!"<<endl;
ljkjd+=3;kjkjd+=1;month++;jd+=2;
printf("按任意键继续\n");
getch();
system("cls");break;arr[randomIndex]+=1;
}
else if(infantry=enemy||tank=enemy||plane=enemy||infantry+tank=enemy){
cout<<"平局!"<<endl;
printf("按任意键继续\n");
getch();
system("cls");break;month++;jd+=1;arr[randomIndex]+=1;
}
else{
cout<<"失败!"<<endl;
printf("按任意键继续\n");
getch();
system("cls");month++;
if(jd>1)
jd-=1;break;
jd=1;break;
}
}
}
if(jd==0&&month==12){
cout<<"德军直夺莫斯科"<<"--------结局1:灭亡--------";
printf("按任意键继续\n");
getch();
system("cls");
return 0;
}
if(jd==10){
cout<<"恭喜,首相,您带领苏维埃走向了胜利!"<<endl<<"共用时:"<<month<<" 个月";
cout<<"再见,首相 您该休息会儿了"<<endl<<" ★"<<endl<<"--------结局2:胜利!-------"<<endl<<"制作:徐梓煜";
return 0;
}
continue;
}
return 0;
}
*( \口/ )/(XP )