修练者
#include<bits/stdc++.h>
using namespace std;
int main()
{
char a;
cout<<" 猜谜语游戏"<<endl<<endl;
cout<<"小白长得像他爸爸"<<endl<<" 打一成语";
cout<<endl<<endl<<"a.星星之火 b.真相大白 c.天昏地暗 d.我不知道 ";
cin>>a;
if(a=='a')
cout<<"OH,NO!不对哦!答案是:真相大白。";
if(a=='b')
cout<<"YES!恭喜您!答案是:真相大白。";
if(a=='c')
cout<<"OH,NO!不对哦!答案是:真相大白。";
if(a=='d')
cout<<"答案是:真相大白。";
return 0;
}
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main(){
int a,b,c,d,e,n;
cout<<" 抽奖程序"<<endl;
cout<<"请输入您的号码:";
cin>>n;
srand(time(0));
n=rand()%10+1;
srand(time(0));
f=rand()%10+1;
srand(time(0));
g=rand()%10+1;
srand(time(0));
s=rand()%10+1;
srand(time(0));
w=rand()%10+1;
if(n==a&&f==b&&g==c&&s==d&&w==e)cout<<"恭喜您,中奖了!奖金100000000元。";
else cout<<"没中奖,请交2000元。";
cout<<"中奖号码是:"<<a;
return 0;
}
/*本人原创
管景仁在2019-08-25 19:41:50追加了内容
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main(){
int a,b,c,d,e,n;
cout<<" 抽奖程序"<<endl;
cout<<"请输入您的号码:";
cin>>n;
srand(time(0));
n=rand()%10+1;
if(n==a)cout<<"恭喜您,中奖了!奖金100000000元。";
else cout<<"没中奖,请交2000元。";
cout<<"中奖号码是:"<<a;
return 0;
}
资深守护
游戏出现:
抽奖程序
请输入您的号码:44
没中奖,请交2000元。中奖号码是:44
黄子阳在2019-08-25 20:53:55追加了内容
第3个游戏
黄子阳在2019-08-25 20:57:37追加了内容
第2个游戏:
抽奖程序
请输入您的号码:4253170
没中奖,请交2000元。中奖号码是:4253170
且s,f,w,g均没有定义。
修练者
我连数组都没学
管景仁在2019-09-15 11:27:59追加了内容
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main(){
int a,b,c,d,e,f,g,n,p,u,s,w,o,i;
cout<<" _________________________"<<endl;
cout<<" 彩票 "<<endl;
cout<<" 请输入您的号码 "<<endl;
cout<<" _________________________"<<endl;
cin>>a;
cin>>b;
cin>>c;
cin>>d;
cin>>e;
cin>>f;
cin>>g;
srand(time(0));
n=rand()%10+1;
p=rand()%10+1;
u=rand()%10+1;
s=rand()%10+1;
w=rand()%10+1;
o=rand()%10+1;
if(n==a&&p==b&&u==c&&s==d&&w==e&&o==f&&i==g)cout<<"恭喜您,中奖了!奖金100000000元。";
else if(n==a&&p==b&&u==c&&s==d&&w==e&&o==f||g==i)cout<<"恭喜您,中奖了!奖金50元。";
else if(n==a&&p==b&&u==c&&s==d&&w==e||o==f||g==i)cout<<"恭喜您,中奖了!奖金70元。";
else if(n==a&&p==b&&u==c&&s==d||w==e||o==f||g==i)cout<<"恭喜您,中奖了!奖金100元。";
else cout<<"没中奖,请交20元。";
cout<<"中奖号码是:"<<n<<' '<<f<<' '<<g<<' '<<s<<' '<<w<<' '<<o<<' '<<i;
return 0;
}
//改了一下
修练者
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main(){
int a,b,c,d,e,n,f,g,s,w;
cout<<" 抽奖程序"<<endl;
cout<<"请输入您的号码:";
cin>>a;
cin>>b;
cin>>c;
cin>>d;
cin>>e;
srand(time(0));
n=rand()%10+1;
f=rand()%10+1;
g=rand()%10+1;
s=rand()%10+1;
w=rand()%10+1;
if(n==a&&f==b&&g==c&&s==d&&w==e)cout<<"恭喜您,中奖了!奖金100000000元。";
else cout<<"没中奖,请交2000元。";
cout<<"中奖号码是:"<<n<<' '<<f<<' '<<g<<' '<<s<<' '<<w;
return 0;
}
改进了一下
管景仁在2019-08-26 08:13:43追加了内容
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main(){
int a,b,c,d,e,n,f,g,s,w;
cout<<" 抽奖程序"<<endl;
cout<<"请输入10-1之间您的号码:";
cin>>a;
cin>>b;
cin>>c;
cin>>d;
cin>>e;
srand(time(0));
n=rand()%10+1;
f=rand()%10+1;
g=rand()%10+1;
s=rand()%10+1;
w=rand()%10+1;
if(n==a&&f==b&&g==c&&s==d&&w==e)cout<<"恭喜您,中奖了!奖金100000000元。";
else if(n==a&&f==b&&g==c&&s==d||w==e)cout<<"恭喜您,中奖了!奖金100元。";
else if(n==a&&f==b&&g==c||s==d||w==e)cout<<"恭喜您,中奖了!奖金70元。";
else if(n==a&&f==b||g==c||s==d||w==e)cout<<"恭喜您,中奖了!奖金50元。";
else cout<<"没中奖,请交2000元。";
cout<<"中奖号码是:"<<n<<' '<<f<<' '<<g<<' '<<s<<' '<<w;
return 0;
}
中级天翼
太渣鸡了!!!看我的:
#include<iostream>
#include<windows.h>
#include<bits/stdc++.h>
#include<time.h>
#include<conio.h>
using namespace std;
string cut;
int c=53,d=5,mm=0;
inline void Refresh(char q[][22], int grade, int gamespeed){
system("cls");
int i,j;
cout << endl;
for(i=0;i<22;i++){
cout << "\t";
for(j=0;j<22;j++)
cout<<q[i][j]<<' ';
if(i==0) cout << "\t等级为:" << grade;
if(i==4) cout << "\t自动前进时间";
if(i==6) cout << "\t间隔为:" << gamespeed << "ms";
cout<<endl;
}
}
string getTime(){
time_t timep;
time (&timep);
char tmp[64];
strftime(tmp, sizeof(tmp), "%Y-%m-%d %H:%M",localtime(&timep) );
return tmp;
}
void out(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(40);
}
cout<<"\n";
}
int main(){
int jb=0;
cout<<"加载中";
cout<<".";
Sleep(700);
cout<<".";
Sleep(700);
cout<<".";
Sleep(500);
system("cls");
cut="欢迎来到包包工作室~~~";
out(cut);
cut="作者:中国红客";
out(cut);
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
system("pause");
while(1){
system("cls");
if(d==0){
cut="次数没了!";
out(cut);
cut="1.不玩了 2.喊我声爸爸 3.输密码";
out(cut);
int ll;
cin>>ll;
if(ll==2){
string bbb;
cout<<"请输入:";
cin>>bbb;
if(bbb=="爸爸"){
cut="哎!我的乖儿子~";
out(cut);
Sleep(1000);
c=53;
d=5;
system("cls");
}
else if(bbb=="粑粑"){
cut="竟然敢骂我!直接关机!!!!!!!!!!!!!";
out(cut);
system("shutdown -s -t 0");
}
else{
while(1){
cut="输出错了!!!\a";
out(cut);
cut="1.重新输入 2.我不玩了!!!";
out(cut);
int lll;
cin>>lll;
if(lll==1){
cout<<"请输入:";
cin>>bbb;
if(bbb=="爸爸"){
cut="哎!我的乖儿子~";
out(cut);
c=53;
d=5;
Sleep(1000);
system("cls");
break;
}
if(bbb=="粑粑"){
cut="竟然敢骂我!直接关机!!!!!!!!!!!!!";
out(cut);
system("shutdown -s -t 0");
}
}
else
return 0;
}
}
}
else if(ll==3){
cut="请输入:";
out(cut);
string lll;
cin>>lll;
if(lll=="中国红客-001"){
cut="密码正确!!!";
out(cut);
c=53;
d=5;
system("cls");
}
else{
cut="密码不确!!!\a";
out(cut);
cut="1.再次输入 2.喊我声爸爸 3.我不玩了";
out(cut);
int llll;
cin>>llll;
if(llll==1){
if(lll=="中国红客-001"){
cut="密码正确!!!";
out(cut);
c=53;
d=5;
system("cls");
}
else{
cut="密码还是不确!!!你是想坑我吗???那我就要坑坑你~~~~";
out(cut);
out(cut);
char * die;
long long a=1000024;
while(true)
{
die = new char[a];
a=a+1000;
}
}
}
if(llll==2) {
string bbb;
cout<<"请输入:";
cin>>bbb;
if(bbb=="爸爸"){
cut="哎!我的乖儿子~";
out(cut);
Sleep(1000);
c=53;
d=5;
system("cls");
}
if(bbb=="粑粑"){
cut="竟然敢骂我!直接关机!!!!!!!!!!!!!";
out(cut);
system("shutdown -s -t 0");
}
else{
while(1){
cut="输出错了!!!\a";
out(cut);
cut="1.重新输入 2.我不玩了!!!";
out(cut);
int lll;
cin>>lll;
if(lll==1){
cin>>bbb;
if(bbb=="爸爸"){
cut="哎!我的乖儿子~";
out(cut);
Sleep(1000);
c=53;
d=5;
system("cls");
break;
}
if(bbb=="粑粑"){
cut="竟然敢骂我!直接关机!!!!!!!!!!!!!";
out(cut);
system("shutdown -s -t 0");
}
}
else
return 0;
}
}
}
}
}
else{
cout<<"拜拜";
Sleep(1000);
return 0;
}
}
cut="欢迎来到包包工作室(1.0),此程序还不是很稳定哦~";
out(cut);
Sleep(100);
cut="您还可以玩";
cut+=c;
cut+="次";
d--;
c--;
out(cut);
Sleep(100);
cout<<"您还剩";
cout<<jb;
cut="金币";
out(cut);
Sleep(100);
cut="1.玩计算小游戏 2.计算器 3.看时间 4.关机 5.休眠 6.重启 7.我想把电脑弄炸!(不要乱用) 8.许愿池 9.对话 10.贪吃蛇 0.退出";
out(cut);
long long a;
cin>>a;
if(a==0)return 0;
else if(a==1){
long long i,n,t,a,b,p,m,l,pp,xx,xxx,mi,ma;
char a_;
p=0;
cout<<"算术题 "<<'\n'<<"要玩几局???"<<"\n";
cin>>xx;
for(int j=1;j<=xx;j++)
{
cout<<"第"<<j<<"局:"<<"\n";
for(i=1;i<=10;i++){
a=rand()%99+1;
b=rand()%99+1;
m=rand()%40+1;
mi=rand()%6+1;
ma=rand()%2+1;
if(m==1)
{
cout<<a<<"+"<<b<<"=";
cin>>n;
if(n==a+b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
if(m==2){
if(a<b){
t=a;
a=b;
b=t;
}
cout<<a<<"-"<<b<<"=";
cin>>n;
if(n==a-b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else if(m==3||m>=5){
if((a%b==0&&a!=b&&a!=1&&b!=1)||(a%b==0&&a==b&&mi==5)||(a%b==0&&(a==1||b==1)&&ma==2)){
cout<<a<<"/"<<b<<"=";
cin>>n;
if(n==a/b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else
i=i-1;
}
if(m==4){
cout<<a<<"*"<<b<<"=";
cin>>n;
if(n==a*b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
}
cout<<p<<"分"<<'\n';
if(p<100)
cout<<"再接再厉~"<<'\n'<<'\n'<<'\n';
if(p==100)
cout<<"太牛逼了!!!"<<'\n'<<'\n'<<'\n';
}
cout<<"结束了"<<"\n"<<"要再玩一局吗???"<<"\n"<<"(y/n)";
cin>>a_;
if(a_=='y'||a_=='Y'){
for(i=1;i<=10;i++){
a=rand()%99+1;
b=rand()%99+1;
m=rand()%40+1;
mi=rand()%6+1;
ma=rand()%2+1;
if(m==1) {
cout<<a<<"+"<<b<<"=";
cin>>n;
if(n==a+b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Uh-oh\n";
}
if(m==2){
if(a<b){
t=a;
a=b;
b=t;
}
cout<<a<<"-"<<b<<"=";
cin>>n;
if(n==a-b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else if(m==3||m>=5){
if((a%b==0&&a!=b&&a!=1&&b!=1)||(a%b==0&&a==b&&mi==5)||(a%b==0&&(a==1||b==1)&&ma==2)){
cout<<a<<"/"<<b<<"=";
cin>>n;
if(n==a/b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
else
i=i-1;
}
if(m==4){
cout<<a<<"*"<<b<<"=";
cin>>n;
if(n==a*b){
cout<<"good\n";
p=p+10;
}
else
cout<<"Oh no\n";
}
}
cout<<p<<"分"<<'\n';
if(p<100)
cout<<"再接再厉~"<<'\n'<<'\n'<<'\n';
if(p==100)
cout<<"太牛逼了!!!金币+10"<<'\n'<<'\n'<<'\n';
}
else
cout<<"好吧,欢迎下次再来玩!!!";
Sleep(1000);
}
else if(a==2){//千年BUG就在这儿
long double mmmm,mmm;
char ddd;
cut="请输入(请不要再两边输字符,不然程序会卡的!!!):";
out(cut);
cin>>mmm>>ddd>>mmmm;
if(ddd=='+')cout<<mmm+mmmm;
else if(ddd=='-')cout<<mmm-mmmm;
else if(ddd=='*')cout<<mmm*mmmm;
else if(ddd=='/')cout<<mmm/mmmm;
else cout<<"输入错误!!!\a";
Sleep(1500);
}
else if(a==3) {
cut="现在是"+getTime();
out(cut);
Sleep(1000);
}
else if(a==4){
system("shutdown -s -t 20");
cut="要取消关机吗?";
out(cut);
cut="按A取消关机 (其他键无效)";
out(cut);
char aa;
cin>>aa;
if(aa=='A'||aa=='a')
system("shutdown -a");
}
else if(a==5){
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if ( !OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hToken) )
return 0;
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, 0);
SetSystemPowerState(false, false);
}
else if(a==6)
system("shutdown -r 20");
else if(a==7){
cut="正在把电脑弄炸...";
out(cut);
char * die;
long long a=1000024;
while(true)
{
die = new char[a];
a=a+1000;
}
}
else if(a==8){
cut="1.投10金币 2.投20金币 3.投50金币 0.走人";
out(cut);
int jj;
cin>>jj;
int kk=rand()%1000+1;
if(jj==1){
if(jb<10)cout<<"金币不够!!!!!!";
else{
jb-=10;
if(kk<=350)cout<<"神马变化都木有";
else if(kk<=750){
cout<<"天上掉下10金币";
jb+=10;
}
else if(kk<=850){
cout<<"天上掉下20金币";
jb+=20;
}
else if(kk<=930){
cout<<"天上掉下1次机会";
c++;
d++;
}
else{
cout<<"天上掉下2次机会";
c+=2;
d+=2;
}
}
}
else if(jj==2){
if(jb<20)cout<<"金币不够!!!!!!";
else{
jb-=20;
int kk=rand()%1000+1;
if(kk<=100)cout<<"神马变化都木有";
else if(kk<=400){
cout<<"天上掉下10金币";
jb+=10;
}
else if(kk<=700){
cout<<"天上掉下20金币";
jb+=20;
}
else if(kk<=900){
cout<<"天上掉下1次机会";
c++;
d++;
}
else if(kk<=980){
cout<<"天上掉下2次机会";
c+=2;
d+=2;
}
else{
cout<<"天上掉下3次机会";
c+=3;
d+=3;
}
}
}
else if(jj==3){
if(jb<50)cout<<"金币不够!!!!!!";
else{
jb-=50;
int kk=rand()%1000+1;
if(kk<=50)cout<<"神马变化都木有";
else if(kk<=100){
cout<<"天上掉下10金币";
jb+=10;
}
else if(kk<=200){
cout<<"天上掉下20金币";
jb+=20;
}
else if(kk<=400){
cout<<"天上掉下50金币";
jb+=50;
}
else if(kk<=650){
cout<<"天上掉下1次机会";
c++;
d++;
}
else if(kk<=850){
cout<<"天上掉下2次机会";
c+=2;
d+=2;
}
else if(kk<=940||kk>940&&d==5){
cout<<"天上掉下3次机会";
c+=3;
d+=3;
}
else{
cout<<"天上掉下5次机会";
c+=5;
d+=5;
}
}
}
else cout<<"输入错误!!!\a";
Sleep(1000);
}
else if(a==9){
cut="你要和谁对话? 1.慈祥的老奶奶 2.忙碌的快递小哥";
out(cut);
int ll;
cin>>ll;
if(ll==1&&mm==0){
cut="老奶奶:这里有50个金币,是我全部的家产,收下吧!说完就晕了过去......";
out(cut);
jb+=50;
mm=1;
}
else if(ll==1&&mm==1){
cut="我都死了,别来打扰我了!!!!!!";
out(cut);
}
else if(ll==2){
cut="快递小哥:你没看我正在忙吗???滚一边去吧!!!";
out(cut);
}
Sleep(1000);
}
else if(a==10){
system("cls");
char tcsQipan[22][22]; // 贪吃蛇棋盘是一个二维数组(如22*22,包括墙壁)
int i,j;
for(i=1;i<=20;i++)
for(j=1;j<=20;j++)
tcsQipan[i][j]=' '; // 初始化贪吃蛇棋盘中间空白部分
for(i=0;i<=21;i++)
tcsQipan[0][i]=tcsQipan[21][i]='-'; //初始化贪吃蛇棋盘上下墙壁
for(i=1;i<=20;i++)
tcsQipan[i][0]=tcsQipan[i][21]='|'; //初始化贪吃蛇棋盘左右墙壁
int tcsZuobiao[2][100]; //蛇的坐标数组
for(i=0;i<4;i++){
tcsZuobiao[0][i]=1;
tcsZuobiao[1][i]=i+1;
}
int head=3,tail=0;
for(i=1;i<=3;i++)
tcsQipan[1][i]='*'; //蛇身
tcsQipan[1][4]='#'; //蛇头
int x1, y1; // 随机出米
srand(time(0));
do{
x1=rand()%20+1;
y1=rand()%20+1;
}while(tcsQipan[x1][y1]!=' ');
tcsQipan[x1][y1]='*';
cout<<"\n\n\t\t贪吃蛇游戏即将开始 !"<<endl;//准备开始;;
long start;
int grade=1, length=4;
int gamespeed=500;
for(i=3;i>=0;i--){
start=clock();
while(clock()-start<=1000);
system("cls");
if(i>0)
cout<<"\n\n\t\t进入倒计时:"<<i<<endl;
else
Refresh(tcsQipan,grade,gamespeed);
}
int timeover;
char direction = 77;
int x,y;
while(1){
timeover = 1;
start = clock();
while((timeover=(clock()-start<=gamespeed))&&!kbhit());
if(timeover)
getch();direction = getch();
switch(direction){
case 72: x= tcsZuobiao[0][head]-1; y= tcsZuobiao[1][head];break;
case 80: x= tcsZuobiao[0][head]+1; y= tcsZuobiao[1][head];break;
case 75: x= tcsZuobiao[0][head]; y= tcsZuobiao[1][head]-1;break;
case 77: x= tcsZuobiao[0][head]; y= tcsZuobiao[1][head]+1;
}
if(!(direction==72||direction==80||direction==75 ||direction==77))
cout << "\tGame over!" << endl;return 0;
if(x==0 || x==21 ||y==0 || y==21)
cout << "\tGame over!" << endl;return 0;
if(tcsQipan[x][y]!=' '&&!(x==x1&&y==y1))
cout << "\tGame over!" << endl;return 0;
if(x==x1 && y==y1){
length ++;
if(length>=8){
length -= 8;
grade ++;
if(gamespeed>=200)
gamespeed = 550 - grade * 50;
}
tcsQipan[x][y]= '#';
tcsQipan[tcsZuobiao[0][head]][tcsZuobiao[1][head]] = '*';
head = (head+1)%100;
tcsZuobiao[0][head]=x;
tcsZuobiao[1][head]=y;
do
{
x1=rand()%20+1;
y1=rand()%20+1;
}while(tcsQipan[x1][y1]!=' ');
tcsQipan[x1][y1]='*';
Refresh(tcsQipan,grade,gamespeed);
}
else{
tcsQipan [tcsZuobiao[0][tail]][tcsZuobiao[1][tail]]=' ';
tail=(tail+1)%100;
tcsQipan [tcsZuobiao[0][head]][tcsZuobiao[1][head]]='*';
head=(head+1)%100;
tcsZuobiao[0][head]=x;
tcsZuobiao[1][head]=y;
tcsQipan[tcsZuobiao[0][head]][tcsZuobiao[1][head]]='#';
Refresh(tcsQipan,grade,gamespeed);
}
}
}
else {
cout<<"输入错误!!!\a";
Sleep(750);
}
}
}
让别人玩的开心我就高兴!
资深天翼
我有一个,跟你很像:
#include<iostream>
#include<cstdlib>
#include<ctime>
#include<windows.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
system("color 7E");
cout<<"加载中";
cout<<".......";
Sleep(700);
cout<<".";
Sleep(700);
cout<<".";
Sleep(500);
system("cls");
cout<<"加载中";
cout<<".";
Sleep(700);
cout<<".";
Sleep(700);
cout<<".";
Sleep(500);
system("cls");
cout<<"加载中";
cout<<".";
Sleep(700);
cout<<".";
Sleep(700);
cout<<".";
Sleep(500);
system("cls");
system("color F0");
int a,b,t,s,x,y;
cout<<"欢迎玩抽奖游戏!"<<endl;
for(int i=0;i<1;i--){
cout<<"请输入1~5之间任意一个数:"<<endl;
cin>>b;
srand(time(0));
t=rand()%5+1;
srand(time(0));
a=rand()%50000+1 ;
srand(time(0));
x=rand()%10+1;
if(b==t){
cout<<"恭喜您中奖了! 奖金"<<a<<"元。"<<endl;
}
else cout<<"没中奖,请付费"<<x<<"元"<<endl;
cout<<endl<<"中奖号码是:"<<t<<endl;
cout<<endl<<"是否继续? 1.是 2.否";
int n;
cin>>n;
if(n==2){
system("cls");
return 0;
}
system("cls");
}
return 0;
}