用户:EquinoxIM_退查看:0 回复:0 评论:0 创建时间:2021-11-18T21:02:42
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
/*正面-篮球
反面-打游戏
立起来-学习 */
int main(){
srand((unsigned) time(NULL));
int n=rand()%100+1;
int cnt=0;
while (1) {
if (n<=48) {
cout<<"basketball"<<endl;
} else if (n<=96) {
cout<<"play"<<endl;
} else {
cout<<"study"<<endl;
break;
}
cnt++;
n=rand()%100+1;
}
cout<<"一共"<<cnt+1<<"次"<<endl;
return 0;
}