中级光能
我昨晚打了一个游戏代码,根据@李易泽的一个代码的思路改编加升华而成(注:我没抄他代码,只是玩过他的游戏),日后我将更新更多的小游戏,请大家帮我找出游戏的漏洞或想要实现的游戏思路,我会尽量帮助大家,谢谢大家捧场!
游戏代码:
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
using namespace std;
void sc(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(50);
}
}
void gc(int n);
void cs();
void cs(){
system("cls");
srand((unsigned)time(NULL)); /*定义随机种子保证每次产生的随机数都不一样*/
int n = rand() % (100- 0 ) + 1; /*n为X~Y之间的随机数*/
sc(" 系统检测到您有 亿 些零花钱");
cout<<endl;
sc(" 请问是否充值: 是(y) 否(n)");
char a;
cin>>a;
if(a=='y'){
sc(" 正从您的账户中扣除 10元 ");
cout<<endl;
sc(" 扣除成功。");
Sleep(1000);
system("cls");
sc("哈哈哈,我就是开个玩笑,告诉你吧,数的最后一位是 ");
cout<<n%10;
gc(n);
}
else{
gc(n);
}
}
void gc(int n){
system("cls");
sc("请打出那个数");
cout<<endl;
int t;
cin>>t;
if(t==n){
sc("恭喜你,答对了");
cout<<endl;
sc("请问你还要玩吗? ");
cout<<endl;
sc(" 要(y) 不要(n)");
char h;
cin>>h;
if(h=='y'){
system("cls");
cs();
}
else {
system("cls");
for(int i=1;i<=5;i++) cout<<endl;
sc("能给我的游戏评个分吗?(1~10)");
cout<<endl<<endl;
int t;
cin>>t;
if(t<=4){
sc("那好吧,我会继续努力的,记得在问答提出建议,谢谢");
}
else{
sc("谢啦,期待我游戏的更新吧");
}
return;
}
}
if(t>n){
sc("猜大啦,请再猜一次吧");
gc(n);
}
if(t<n){
sc("猜小啦,请再猜一次吧");
gc(n);
}
}
void first(){
for(int i=1;i<=5;i++){
cout<<endl;
}
system("color 06");
cout<<" ";
sc("欢迎来到小游戏“猜数”");cout<<endl;
sc(" 开始(s) 退出(k)");
cout<<endl<<endl;
sc(" 本游戏全部内容请用小写英文输入法,谢谢");
char n;
cin>>n;
if(n=='s'){
system("cls");
cs();
}
else if(n=='k'){
system("cls");
for(int i=1;i<=5;i++) cout<<endl;
sc("能给我的游戏评个分吗?(1~10)");
cout<<endl<<endl;
int t;
cin>>t;
if(t<=4){
sc("那好吧,我会继续努力的,记得在问答提出建议,谢谢");
}
else{
sc("谢啦,期待我游戏的更新吧");
}
return;
}
else{
system("cls");
sc("输入错误,请重新输入");
system("cls");
first();
}
}
int main(){
//freopen("xxx.in","r",stdin);
//freopen("xxx.out","w",stdout);
first();
//fclose(stdin);
//fclose(stdout);
return 0;
}
郑金顺在2021-05-21 18:26:18追加了内容
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
using namespace std;
void sc(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(50);
}
}
void gc(int n);
void cs();
void cs(){
//system("cls");
//srand((unsigned)time(NULL)); /*定义随机种子保证每次产生的随机数都不一样*/
//int n = rand() %100; /*n为X~Y之间的随机数*/
int n=100;
sc(" 系统检测到您有 亿 些零花钱");
cout<<endl;
sc(" 请问是否充值: 是(y) 否(n)");
char a;
cin>>a;
if(a=='y'){
sc(" 正从您的账户中扣除 10元 ");
cout<<endl;
sc(" 扣除成功。");
Sleep(1000);
system("cls");
sc("哈哈哈,我就是开个玩笑,告诉你吧,数的最后一位是 ");
cout<<n%10;
gc(n);
}
else{
gc(n);
}
}
void gc(int n){
system("cls");
sc("请打出那个数");
cout<<endl;
int t;
cin>>t;
if(t==n){
sc("恭喜你,答对了");
cout<<endl;
sc("请问你还要玩吗? ");
cout<<endl;
sc(" 要(y) 不要(n)");
char h;
cin>>h;
if(h=='y'){
system("cls");
cs();
}
else {
system("cls");
for(int i=1;i<=5;i++) cout<<endl;
sc("能给我的游戏评个分吗?(1~10)");
cout<<endl<<endl;
int t;
cin>>t;
if(t<=4){
sc("那好吧,我会继续努力的,记得在问答提出建议,谢谢");
}
else{
sc("谢啦,期待我游戏的更新吧");
}
return;
}
}
if(t>n){
sc("猜大啦,请再猜一次吧");
gc(n);
}
if(t<n){
sc("猜小啦,请再猜一次吧");
gc(n);
}
}
void first(){
for(int i=1;i<=5;i++){
cout<<endl;
}
system("color 06");
cout<<" ";
sc("欢迎来到小游戏“猜整数”0~100");cout<<endl;
sc(" 开始(s) 退出(k)");
cout<<endl<<endl;
sc(" 本游戏请勿输入小数,不然会吃醋 全部内容请用小写英文输入法,谢谢");
char n;
cin>>n;
if(n=='s'){
system("cls");
cs();
}
else if(n=='k'){
system("cls");
for(int i=1;i<=5;i++) cout<<endl;
sc("能给我的游戏评个分吗?(1~10)");
cout<<endl<<endl;
int t;
cin>>t;
if(t<=4){
sc("那好吧,我会继续努力的,记得在问答提出建议,谢谢");
}
else{
sc("谢啦,期待我游戏的更新吧");
}
return;
}
else{
system("cls");
sc("输入错误,请重新输入");
system("cls");
first();
}
}
int main(){
//freopen("xxx.in","r",stdin);
//freopen("xxx.out","w",stdout);
first();
//fclose(stdin);
//fclose(stdout);
return 0;
}
修补漏洞后:
郑金顺在2021-05-21 18:26:28追加了内容
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
using namespace std;
void sc(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(50);
}
}
void gc(int n);
void cs();
void cs(){
//system("cls");
//srand((unsigned)time(NULL)); /*定义随机种子保证每次产生的随机数都不一样*/
//int n = rand() %100; /*n为X~Y之间的随机数*/
int n=100;
sc(" 系统检测到您有 亿 些零花钱");
cout<<endl;
sc(" 请问是否充值: 是(y) 否(n)");
char a;
cin>>a;
if(a=='y'){
sc(" 正从您的账户中扣除 10元 ");
cout<<endl;
sc(" 扣除成功。");
Sleep(1000);
system("cls");
sc("哈哈哈,我就是开个玩笑,告诉你吧,数的最后一位是 ");
cout<<n%10;
gc(n);
}
else{
gc(n);
}
}
void gc(int n){
system("cls");
sc("请打出那个数");
cout<<endl;
int t;
cin>>t;
if(t==n){
sc("恭喜你,答对了");
cout<<endl;
sc("请问你还要玩吗? ");
cout<<endl;
sc(" 要(y) 不要(n)");
char h;
cin>>h;
if(h=='y'){
system("cls");
cs();
}
else {
system("cls");
for(int i=1;i<=5;i++) cout<<endl;
sc("能给我的游戏评个分吗?(1~10)");
cout<<endl<<endl;
int t;
cin>>t;
if(t<=4){
sc("那好吧,我会继续努力的,记得在问答提出建议,谢谢");
}
else{
sc("谢啦,期待我游戏的更新吧");
}
return;
}
}
if(t>n){
sc("猜大啦,请再猜一次吧");
gc(n);
}
if(t<n){
sc("猜小啦,请再猜一次吧");
gc(n);
}
}
void first(){
for(int i=1;i<=5;i++){
cout<<endl;
}
system("color 06");
cout<<" ";
sc("欢迎来到小游戏“猜整数”0~100");cout<<endl;
sc(" 开始(s) 退出(k)");
cout<<endl<<endl;
sc(" 本游戏请勿输入小数,不然会吃醋 全部内容请用小写英文输入法,谢谢");
char n;
cin>>n;
if(n=='s'){
system("cls");
cs();
}
else if(n=='k'){
system("cls");
for(int i=1;i<=5;i++) cout<<endl;
sc("能给我的游戏评个分吗?(1~10)");
cout<<endl<<endl;
int t;
cin>>t;
if(t<=4){
sc("那好吧,我会继续努力的,记得在问答提出建议,谢谢");
}
else{
sc("谢啦,期待我游戏的更新吧");
}
return;
}
else{
system("cls");
sc("输入错误,请重新输入");
system("cls");
first();
}
}
int main(){
//freopen("xxx.in","r",stdin);
//freopen("xxx.out","w",stdout);
first();
//fclose(stdin);
//fclose(stdout);
return 0;
}
修补漏洞后:
郑金顺在2021-05-23 12:20:33追加了内容
感谢wpmx提供代码
郑金顺在2021-05-23 12:24:59追加了内容
感谢wpmx提供代码
郑金顺在2021-05-24 17:55:26追加了内容
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
using namespace std;
void sc(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(50);
}
}
void gc(int n);
void cs();
void cs(){
//system("cls");
//srand((unsigned)time(NULL)); /*定义随机种子保证每次产生的随机数都不一样*/
//int n = rand() %100; /*n为X~Y之间的随机数*/
int n=100;
sc(" 系统检测到您有 亿 些零花钱");
cout<<endl;
sc(" 请问是否充值: 是(y) 否(n)");
char a;
cin>>a;
if(a=='y'){
sc(" 正从您的账户中扣除 10元 ");
cout<<endl;
sc(" 扣除成功。");
Sleep(1000);
system("cls");
sc("哈哈哈,我就是开个玩笑,告诉你吧,数的最后一位是 ");
cout<<n%10;
gc(n);
}
else{
gc(n);
}
}
void gc(int n){
system("cls");
sc("请输入一个0~100的整数,谢谢");
cout<<endl;
int t;
cin>>t;
if(t==n){
sc("恭喜你,答对了");
cout<<endl;
sc("请问你还要玩吗? ");
cout<<endl;
sc(" 要(y) 不要(n)");
char h;
cin>>h;
if(h=='y'){
system("cls");
cs();
}
else {
system("cls");
for(int i=1;i<=5;i++) cout<<endl;
sc("能给我的游戏评个分吗?(1~10)");
cout<<endl<<endl;
int t;
cin>>t;
if(t<=4){
sc("那好吧,我会继续努力的,记得在问答提出建议,谢谢");
}
else{
sc("谢啦,期待我游戏的更新吧");
}
return;
}
}
if(t>n){
sc("猜大啦,请再猜一次吧");
gc(n);
}
if(t<n){
sc("猜小啦,请再猜一次吧");
gc(n);
}
}
void first(){
for(int i=1;i<=5;i++){
cout<<endl;
}
system("color 06");
cout<<" ";
sc("欢迎来到小游戏“猜整数”0~100");cout<<endl;
sc(" 开始(s) 退出(k)");
cout<<endl<<endl;
sc(" 本游戏请勿输入小数,不然会出错");
cout<<endl;
sc("全部内容请用小写英文输入法,谢谢");
char n;
cin>>n;
if(n=='s'){
system("cls");
cs();
}
else if(n=='k'){
system("cls");
for(int i=1;i<=5;i++) cout<<endl;
sc("能给我的游戏评个分吗?(1~10)");
cout<<endl<<endl;
int t;
cin>>t;
if(t<=4){
sc("那好吧,我会继续努力的,记得在问答提出建议,谢谢");
}
else{
sc("谢啦,期待我游戏的更新吧");
}
return;
}
else{
system("cls");
sc("输入错误,请重新输入");
system("cls");
first();
}
}
int main(){
//freopen("xxx.in","r",stdin);
//freopen("xxx.out","w",stdout);
first();
//fclose(stdin);
//fclose(stdout);
return 0;
}
郑金顺在2021-05-24 17:55:33追加了内容
#include<bits/stdc++.h>
#include<time.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)
using namespace std;
void sc(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(50);
}
}
void gc(int n);
void cs();
void cs(){
//system("cls");
//srand((unsigned)time(NULL)); /*定义随机种子保证每次产生的随机数都不一样*/
//int n = rand() %100; /*n为X~Y之间的随机数*/
int n=100;
sc(" 系统检测到您有 亿 些零花钱");
cout<<endl;
sc(" 请问是否充值: 是(y) 否(n)");
char a;
cin>>a;
if(a=='y'){
sc(" 正从您的账户中扣除 10元 ");
cout<<endl;
sc(" 扣除成功。");
Sleep(1000);
system("cls");
sc("哈哈哈,我就是开个玩笑,告诉你吧,数的最后一位是 ");
cout<<n%10;
gc(n);
}
else{
gc(n);
}
}
void gc(int n){
system("cls");
sc("请输入一个0~100的整数,谢谢");
cout<<endl;
int t;
cin>>t;
if(t==n){
sc("恭喜你,答对了");
cout<<endl;
sc("请问你还要玩吗? ");
cout<<endl;
sc(" 要(y) 不要(n)");
char h;
cin>>h;
if(h=='y'){
system("cls");
cs();
}
else {
system("cls");
for(int i=1;i<=5;i++) cout<<endl;
sc("能给我的游戏评个分吗?(1~10)");
cout<<endl<<endl;
int t;
cin>>t;
if(t<=4){
sc("那好吧,我会继续努力的,记得在问答提出建议,谢谢");
}
else{
sc("谢啦,期待我游戏的更新吧");
}
return;
}
}
if(t>n){
sc("猜大啦,请再猜一次吧");
gc(n);
}
if(t<n){
sc("猜小啦,请再猜一次吧");
gc(n);
}
}
void first(){
for(int i=1;i<=5;i++){
cout<<endl;
}
system("color 06");
cout<<" ";
sc("欢迎来到小游戏“猜整数”0~100");cout<<endl;
sc(" 开始(s) 退出(k)");
cout<<endl<<endl;
sc(" 本游戏请勿输入小数,不然会出错");
cout<<endl;
sc("全部内容请用小写英文输入法,谢谢");
char n;
cin>>n;
if(n=='s'){
system("cls");
cs();
}
else if(n=='k'){
system("cls");
for(int i=1;i<=5;i++) cout<<endl;
sc("能给我的游戏评个分吗?(1~10)");
cout<<endl<<endl;
int t;
cin>>t;
if(t<=4){
sc("那好吧,我会继续努力的,记得在问答提出建议,谢谢");
}
else{
sc("谢啦,期待我游戏的更新吧");
}
return;
}
else{
system("cls");
sc("输入错误,请重新输入");
system("cls");
first();
}
}
int main(){
//freopen("xxx.in","r",stdin);
//freopen("xxx.out","w",stdout);
first();
//fclose(stdin);
//fclose(stdout);
return 0;
}
中级守护
????????
管我什事???????
你这是神马游戏的代码???????
李易泽在2021-05-21 18:16:27追加了内容
你这代码真好!!!!
输入“69”:::“猜小了!”;
输入“70”:::“猜大了!”;
输入小数出bug!!!