自己手制的,本来也是上课摸fish时候用的,提供给大家:可以拿来摸fish【坏笑】
- 有 的人会被抓
- 但老师可能不会在意
- 除非ta有缤
-
质数爆炸
code:
#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真的很爽
-
(都干过的)猜随机数
code:
#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;
}
}
}
}
//哈哈哈不太好玩(了)
-
比赛冠军
code:
#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——