Logo 刘卓成的博客

博客

狼人杀(更新)

2023-03-11 15:01:22 By 刘卓成

include

include

using namespace std; int ID; void brc(int n) { ID=n; switch(n) { case 1: cout << "你是" << ID << "号,"; cout << "你的身份是: 警长......" << endl; Sleep(2000); break; case 2: cout << "你是" << ID << "号,"; cout << "你的身份是: 狼人......" << endl; Sleep(2000); break; case 3: cout << "你是" << ID << "号,"; cout << "你的身份是: 平民......" << endl; Sleep(2000); break; case 4: cout << "你是" << ID << "号,"; cout << "你的身份是: 医生......" << endl; Sleep(2000); break; case 5: cout << "你是" << ID << "号,"; cout << "你的身份是: 小丑......" << endl; Sleep(2000); break; case 6: cout << "你是" << ID << "号,"; cout << "你的身份是: 狼人......" << endl; Sleep(2000); break; case 7: cout << "你是" << ID << "号,"; cout << "你的身份是: 平民......" << endl; Sleep(2000); break; } } int main() { cout << "欢迎来到狼人杀,下面为你抽取身份......" << endl; srand(time(NULL)); Sleep(3000); int n=1+rand()%(7-1+1); brc(n); cout << "游戏即将开始,倒计时五秒:" << endl; for(int i=5; i>=1; i--) { cout << i << endl; Sleep(1500); } bool f=true,k=true,l=true; if(ID=2||ID==6) cout << "天黑请闭眼,"; Sleep(300); cout << "狼人睁眼,"; Sleep(300); cout << "闭眼,"; Sleep(300); cout << "天亮了。"; }**

167

2023-02-25 15:05:47 By 刘卓成

include

using namespace std; int sgn(int n); int main(){ int n; cin>>n; cout<0) return n+1; if(n<0) return n-1; }

2653

2023-01-18 14:20:12 By 刘卓成

include

using namespace std; int main(){ double a[11]; int l=0; for(int i=1;i<=10;i++){ cin>>a[i]; } double max=-1; for(int i=1;i<=10;i++){ if(a[i]>=max){ max=a[i]; l++; } } cout<<l; return 0; }

2677

2023-01-18 14:01:40 By 刘卓成

include

using namespace std; int main(){ int n; cin>>n; cout<<n<<endl; int o=n; while(n<5000){ n*=2; cout<<n<<endl; } while(o<n){ cout<<n<<endl; n/=2; } cout<<n<<endl; return 0; }

2532

2023-01-18 12:54:09 By 刘卓成

include

using namespace std; int main(){ int n; cin>>n; int o=n; int w=0; while(n>0){ n/=10; w++; } while(o>0){ o/=2; int d=o; while(d>0){ d/=10; w++; } } cout<<w; return 0; }

2732

2023-01-18 12:34:04 By 刘卓成

include

using namespace std; int main(){ string str; cin>>str; int o=0; for(int i=0;i<=str.length()-1;i++){ o+=(int)(str[i]); } cout<<o; return 0; }

2516

2023-01-17 14:03:11 By 刘卓成

2516:

include

include

using namespace std; int main(){ int a,b,c,o=0; for(a=0;a<=6;a++){ for(b=0;b<=6;b++){ c=a+a+1+a+2+a+3+b+b+1+b+2+b+3; int f=sqrt(c); if(f*f==c){ o++; } } } cout<<o; return 0; }

共 17 篇博客