闲来无事,发个抽奖机:
#include<iostream>
#include<cstdlib>
#include<ctime>
#include<windows.h>
using namespace std;
int main(){
system("mode con cols=25 lines=15");CONSOLE_CURSOR_INFO cursor_info={1,0};
int a,b,c;
while(1){
srand((unsigned)time(NULL));
a=rand()%3;
b=rand()%3;
c=rand()%3;
if(a==b&&a==c){
cout<<" ▃▃▃▃▃▃▃▃\n";
cout<<" ┃ ┃\n";
cout<<" ┃ 抽奖机 ┃\n";
cout<<" ┃ ┃\n";
cout<<"  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄\n";
cout<<"▃▃▃▃▃▃▃▃▃▃▃\n";
cout<<"┃ ▁▁ ▁▁ ▁▁ ┃\n";
cout<<"┃┃ "<<a<<" ┃ ┃ "<<b<<" ┃ ┃ "<<c<<" ┃ ┃"<<endl;
cout<<"┃ ▔▔ ▔▔ ▔▔ ┃"<<endl;
cout<<"┃ ▃▃▃▃▃▃▃▃▃┃\n";
cout<<"┃ ┃ 中奖了 ┃ ┃\n";
cout<<"┃ ▔▔▔▔▔▔▔▔▔┃\n";
cout<<"▔▔▔▔▔▔▔▔▔▔▔ \n";
}
else{
cout<<" ▃▃▃▃▃▃▃▃\n";
cout<<" ┃ ┃\n";
cout<<" ┃ 抽奖机 ┃\n";
cout<<" ┃ ┃\n";
cout<<"  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄\n";
cout<<"▃▃▃▃▃▃▃▃▃▃▃\n";
cout<<"┃ ▁▁ ▁▁ ▁▁ ┃\n";
cout<<"┃┃ "<<a<<" ┃ ┃ "<<b<<" ┃ ┃ "<<c<<" ┃ ┃"<<endl;
cout<<"┃ ▔▔ ▔▔ ▔▔ ┃"<<endl;
cout<<"┃ ▃▃▃▃▃▃▃▃▃┃\n";
cout<<"┃ ┃ 没中奖 ┃ ┃\n";
cout<<"┃ ▔▔▔▔▔▔▔▔▔┃\n";
cout<<"▔▔▔▔▔▔▔▔▔▔▔ \n";
}
Sleep(200);
system("cls");
}
return 0;
}