#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
void hide_cursor()//隐藏光标
{
HANDLE h_GAME =GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cursor_info;
GetConsoleCursorInfo(h_GAME,&cursor_info);
cursor_info.bVisible=false;
SetConsoleCursorInfo(h_GAME,&cursor_info);
}
int main()
{
hide_cursor();
int num=0,xytx[5];
system("color 0f");
cout<<"抽几名“幸运”的同学?";
cin>>num;
srand(unsigned(time(0)));
for(int i=1;i<=num;i++)
{
system("cls");
for(int j=1;j<=30;j++)
{
cout<<rand()%40+1;
Sleep(1);
system("cls");
}
do{
xytx[i]=rand()%40+1;
}
while(xytx[i]==8||xytx[i]==37);
cout<<xytx[i];
Sleep(2000);
}
system("cls");
cout<<"恭喜以下同学获得爬黑板的机会:\n";
for(int i=1;i<=num;i++)
{
cout<<xytx[i]<<"号同学 ";
}
system("pause");
}
抽学号的小程序
最新推荐文章于 2024-10-20 22:42:15 发布