#include <iostream> #include <ctime> #include <cstdlib> using namespace std; int main(int argc, char** argv) { int a,n; cout<<"抽奖程序"<<endl<<"请输入一个1-5的数"<<endl; cin>>n; srand(time(0)); a=rand()%5+1; if(n==a){ cout<<"恭喜你中奖了"; }else{ cout<<"抱歉你没中奖"<<endl; cout<<"答案是:"<<a<<endl; } system("pause"); return 0; }
标签:std,抽奖,游戏,int,include,cout From: https://www.cnblogs.com/w6826301/p/17487004.html