跳到正文

闲话

可以玩耍的自制小游戏

Mist_and_ash约 3 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年2月24日
篇幅
约 3 分钟
获赞
2

版本

  1. v1当前

自己手制的,本来也是上课摸fish时候用的,提供给大家:可以拿来摸fish【坏笑】

  • 有 150\frac{1}{50} 的人会被抓
  • 但老师可能不会在意
  • 除非ta有缤
  1. 质数爆炸

    code:

C++
#include <bits/stdc++.h>
#include <stdio.h>
#include <unistd.h>
using namespace std;
bool zs(int a){
	int cnt=0;
	for(int i=2;i<a;i++){
		if(a%i==0){
			cnt++;
		}
	}
	if(cnt==0){
		return 1;
	}
	else{
		return 0;
	}
}
int main(){
	int x=2;
	cout<<"0 1 ";
	while(1){
		if(zs(x)==1){
			cout<<"'BOOM'"<<" ";
			x++;
			sleep(1);
		}
		else{
			cout<<x<<" ";
			x++;
			sleep(0.7);
		}
	}
}

静静的看着质数变为BOOM真的很爽

  1. (都干过的)猜随机数

    code:

C++
#include<bits/stdc++.h>
using namespace std;
int main(){
	srand(time(NULL));
	int t=rand()%1000+1;
	while(1){
	cout<<endl;
	cout<<"1~1000 random numbers:"<<endl<<"your guess:";
	int a;
	cin>>a;
	if(t==a){
		cout<<"ok"<<endl;
		break;
	}
	else{
		if(t<a){
			cout<<"your guess is bigger"<<endl;
		}
		if(t>a){
			cout<<"your guess is smaller"<<endl;
		}
	}
}
}
//哈哈哈

不太好玩(了)

  1. 比赛冠军

    code:

C++
#include<bits/stdc++.h>
using namespace std;
struct node{
    string name;//名字
    int mlz;//颜值
};
int main(){
	while(1){
		cout<<endl<<endl;
		cout<<"比赛开始!"<<endl;
	    int n;
    	cin>>n;
	    node a[n+5];
	    srand(time(NULL));
	    for(int i=0;i<n;i++){
	        cin>>a[i].name;
	        a[i].mlz=rand()%100+1;
			cout<<"对应颜值:"<<a[i].mlz<<endl;
    	}

	    node mx={"",0};
	    for(int i=0;i<n;i++){
    	    if(a[i].mlz>mx.mlz){
        	    mx.mlz=a[i].mlz;
            	mx.name=a[i].name;
	        }
	    }
	    cout<<"冠军:"<<mx.name;
	}
}

这个我喜欢~

——THE END——

原文