今天,我给大家做了一个简单的小游戏,大家快来看看吧!
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,c;
c=0;
char b;
cout<<"请输入一个你的幸运数字:";
cin>>a;
cout<<"请输入一个A~D中的一个:";
cin>>b;
if(b=='A')
{
for(int i=1;i<=a;i++)
{
for(int j=1;j<=a;j++)
{
cout<<j<<" ";
}
cout<<endl;
}
}
if(b=='B')
{
for(int i=1;i<=a;i++)
{
for(int j=1;j<=a;j++)
{
cout<<i<<" ";
}
cout<<endl;
}
}
if(b=='C')
{
for(int i=1;i<=a;i++)
{
for(int j=1;j<=a;j++)
{
c++;
cout<<c<<" ";
}
cout<<endl;
}
}
if(b=='D')
{
for(int i=1;i<=a;i++)
{
for(int j=1;j<=a;j++)
{
c++;
if(c<=26) cout<<char(c+64)<<" ";
else
{
c=1;
cout<<"A ";
}
}
cout<<endl;
}
}
return 0;
}
😁😁😁祝大家好运!!!