• 个人简介

    #include<bits/stdc++.h> using namespace std;

    int if__pan_duan = -1 ; int mima = 1 , mima_2 , yvyan = 1 , yvyana = 1 , yvyanb = 1 , yvyanc;

    long long a_1 , b_1 ;

    long long a_2; double b_2;

    unsigned long long a_3; double b_3;

    long long a_4 , b_4; double c_4 , d_4;

    double F_5 , C_5 ; int if__pan_duan_5 ;

    char b_7;

    int a_8;

    char a_9 ; long long b_9 , c_9 ; int z_9;

    int n_10, f_10, k_10; int result_10;

    int choice_11, num_11;

    double height_12; int times_12; double totalDistance_12 = 0; double bounceHeight_12; char unit_12[3];

    char tubiao[20][20] , weizhi[20][20] , qingkuang; int leishu_16 = 0 , zuobiaoi , zuobiaoj , bianliang = 0 , wancheng = 0 , a = 114514 , jkl = 1 , asdfjkl; long long suijia , suijib;

    //----------------------------------------------------------------------------------------------------------------------------------------------------------------

    int digit(int n, int f, int k); void decimalToBinary(int num); void binaryToDecimal(int num);

    void jia_fa(); void jian_fa(); void cheng_fa(); void chu_fa();

    void wen_du(); void wen__du();

    void zi_bian(); void bian_zi();

    void zi_you();

    void ti_qv();

    void zhuan_huan();

    void tan_qi();

    void decimalToHexadecimal(int decimal); void hexadecimalToDecimal(char* hexadecimal); void shi_shiliou();

    void caishuzi();

    void abc(); void abcc();

    int saoleii(); int saoleij(); void dian();

    int main() {

    //----------------------------------------------------------------------------------------------------------------------------------------------------------------

    while (if__pan_duan != 0)
    {
    
    if(yvyan == 1)
    {
    	cout << "很高兴问您服务……" << endl << "请输入数字编号来选择您需要的服务" ;
    	cout << "服务项目: " << "1 中文、英文快速切换  " << "---" << "  100 选择语言  " << "---" << "  2 加法运算  " << "---" << "  3 减法运算  " << "---" << "  4 乘法运算  " << "---" << "  5 除法运算  " << "---" ;
    	cout << "  6 华氏度转摄氏度  " << "---" << "  7 摄氏度转华氏度  " << "---" << "  8 字符转编号  "<< "---" <<"  9 编号转字符  "<< "---" << "  10 自由计算器  ";
    	cout << "---" << "  11 提取数字  " << "---" << "  12 二进制、十进制 转换  " << "---" ;
    	cout << "  13 球弹跳高度的计算  " << "---" << "  14 十进制、十六进制转换  " << "---" << "  15 猜数字  " << "---" << "  16 扫雷  " << "|  按“0”键退出" << endl << "请输入(回车确定): ";
    	cin >> if__pan_duan ;
    }
    else
    {
    	cout << "It's a pleasure to serve you..." << endl << "Please enter a numerical code to select the service you need." ;
    	cout << "Service Options: " << "1 Quick switch between Chinese and English  " << "  2 Addition Operation  " << "---" << "  3 Subtraction Operation  " << "---" << "  4 Multiplication Operation  " << "---" << "  5 Division Operation  " << "---" ;
    	cout << "  6 Fahrenheit to Celsius Conversion  " << "---" << "  7 Celsius to Fahrenheit Conversion  " << "---" << "  8 Character to Numeric Code Conversion  "<< "---" <<"  9 Numeric Code to Character Conversion  "<< "---" << "  10 Free Calculator  ";
    	cout << "---" << "  11 Extracting Numbers  " << "---" << "  12 Binary and Decimal Conversion  " << "---" ;
    	cout << "  13 Calculation of Ball Bounce Height  " << "---" << "  14 Decimal to Hexadecimal Conversion  " << "---" << "  15 Guess the number  " << "---" << "  16 Minesweeper  " << "|  Press the “0”key to exit." << endl << "Please enter (press Enter to confirm): ";
    	cin >> if__pan_duan ;
    	
    }
    
    
    
    
    	cout << endl << "--------------------------------------------------------------------------------" << endl << endl ;
    	
    	
    	if(if__pan_duan == 100)
    	{
    		if(yvyan == 1) cout<<"请选择语言(1 简体中文 -- 2 English): ";
    		else
    		if(yvyan == 2) cout<<"Please select a language (1 简体中文 -- 2 English) : ";
    		cin>>yvyan;
    		if(yvyan != 1 && yvyan != 2)
    		{
    			if(yvyana == 1)
    			{
    				cout<<"!!错误 !!"<<endl;
    				yvyan = 1;
    			}
    			else
    			if(yvyana == 2)
    			{
    				cout<<"!! Error !!"<<endl;
    				yvyan = 2;
    			}
    		}
    		yvyana = yvyan;
    		
    		
    	}
    	
    	
    	else
    	if(if__pan_duan == 1)
    	{
    		if(yvyan == 1)
    		{
    			yvyan = 2;
    			yvyana = yvyan; 
    		}
    		
    		else
    		if(yvyan == 2)
    		{
    			yvyan = 1;
    			yvyana = yvyan;
    			
    		}
    	}
    	
    	else
    	if (if__pan_duan == 2)
    	{
    		jia_fa(); 
    	}
    	
    	else
    	if(if__pan_duan == 3)
    	{
    		jian_fa();
    	}
    	
    	else
    	if(if__pan_duan == 4)
    	{
    		cheng_fa();
    	}
    	
    	else
    	if(if__pan_duan == 5)
    	{
    		chu_fa();
    	}
    	
    	else
    	if(if__pan_duan == 6)
    	{
    		wen_du();
    	}
    	
    	else
    	if(if__pan_duan == 7)
    	{
    		wen__du();
    	}
    	
    	else
    	if(if__pan_duan == 8)
    	{
    		zi_bian();
    	}
    	
    	else
    	if(if__pan_duan == 9)
    	{
    		bian_zi();
    	}
    	
    	else
    	if(if__pan_duan == 10)
    	{
    		zi_you(); 
    	}
    	
    	else
    	if(if__pan_duan == 11)
    	{
    		ti_qv();
    	}
    	
    	else
    	if(if__pan_duan == 12)
    	{
    		zhuan_huan();
    	}
    	
    	else
    	if(if__pan_duan == 13)
    	{
    		tan_qi();
    	}
    	
    	else
    	if(if__pan_duan == 14)
    	{
    		shi_shiliou();
    	}
    	
    	else
    	if(if__pan_duan == 15)
    	{
    		caishuzi();
    	}
    	
    	else
    	if(if__pan_duan == 16)
    	{
    		
    		leishu_16 = 0;
    		zuobiaoi = 0;
    		zuobiaoj = 0;
    		bianliang = 0;
    		wancheng = 0;
    		a = 114514;
    		jkl = 1;
    		
    		suijia = 0;
    		suijib = 0;
    		asdfjkl = 0;
    		
    		
    		saoleij();
    		
    	}
    	
    	else
    	if(if__pan_duan == 17)
    	{
    

    // else // if(if__pan_duan == 114514) // { // // int i = 0; // do // { // cin>>if__pan_duan; // if(if__pan_duan == mima) // { // abc(); // } // else // { // cout<<"错误"; // } // i++; // }while( i != 6 || mima_2 == 1 ); }

    	else
    	{
    		
    		if(if__pan_duan != 0) {
    			if(yvyan == 1) cout<< endl << "!!错误 !!" ;
    			else
    			if(yvyan == 2) cout<< endl << "!! Error !!" ;
    		}
    	}
    	
    	
    	
    	cout<< endl << endl << endl << "--------------------------------------------------------------------------------" << endl ;
    	cout<< "--------------------------------------------------------------------------------" << endl << endl << endl ;
    }
    return 0;
    

    } //void abc() //{ // main(); // abcc(); // //} //void abcc() //{ // mima_2 = 1; //}

    void jia_fa() { if(yvyan == 1) { cout<<"请输入第一个数(不可以有小数): "; cin>> a_1 ; cout<< endl; cout<<"请输入第二个数(不可以有小数): "; cin>> b_1 ; cout<< endl; cout<< a_1 <<"+"<< b_1 <<"="; cout<< a_1 + b_1 << endl ; } else { cout<<"Please enter the first number (no decimals allowed): "; cin>> a_1 ; cout<< endl; cout<<"Please enter the second number (no decimals allowed): "; cin>> b_1 ; cout<< endl; cout<< a_1 <<"+"<< b_1 <<"="; cout<< a_1 + b_1 << endl ; } }

    //----------

    void jian_fa() { if(yvyan == 1) { cout<<"请输入第一个数(不可以有小数): "; cin>> a_2 ; cout<< endl; cout<<"请输入第二个数(可以有小数,最好没有): "; cin>> b_2 ; cout<< endl; cout<< a_2 <<"-"<< b_2 <<"="; cout<< a_2 - b_2 << endl ; } else { cout<<"Please enter the first number (no decimals allowed): "; cin>> a_2 ; cout<< endl; cout<<"Please enter the second number (decimals are allowed, but preferably not): "; cin>> b_2 ; cout<< endl; cout<< a_2 <<"-"<< b_2 <<"="; cout<< a_2 - b_2 << endl ; } }

    //----------

    void cheng_fa() { if(yvyan == 1) { cout<<"请输入第一个数(不可以是负数也不能有小数): "; cin>> a_3 ; cout<< endl; cout<<"请输入第二个数(可以有小数,最好没有): "; cin>> b_3 ; cout<< endl; cout<< a_3 <<"×"<< b_3 <<"="; cout<< a_3 * b_3 << endl; } else { cout<<"Please enter the first number (cannot be negative or have decimals): "; cin>> a_3 ; cout<< endl; cout<<"Please enter the second number (decimals are allowed, but preferably not): "; cin>> b_3 ; cout<< endl; cout<< a_3 <<"×"<< b_3 <<"="; cout<< a_3 * b_3 << endl; } }

    //----------

    void chu_fa() { if(yvyan == 1) { cout<<"请输入被除数: "; cin>> a_4 ; cout<< endl; cout<<"请输入除数(不能输 0 ): "; } else { cout<<"Please enter the dividend: "; cin>> a_4 ; cout<< endl; cout<<"Please enter the divisor (cannot be 0): "; } cin>> b_4 ; cout<< endl;

    c_4 = a_4;
    d_4 = b_4;
    
    cout<< a_4 <<"÷"<< b_4 <<"="; 
    cout<< a_4 / b_4;
    cout<<"······";
    cout<< a_4 % b_4;
    
    cout<< endl;
    c_4 = c_4/d_4;
    cout<< a_4 <<"÷"<< b_4 <<"≈";
    
    c_4 = c_4*10000;
    n_10 = (int)c_4;
    
    
    f_10 = 1;
    
    k_10 = 1;
    result_10 = digit(n_10, f_10, k_10);
    
    if(result_10 > 5)
    {
    	c_4 = (int)c_4;
    	c_4 += 1;
    	c_4 = c_4 / 10000;
    }
    else
    {
    	c_4 = c_4 / 10000;
    }
    
    printf ("%.4lf",c_4 );
    cout<<endl;
    

    }

    //---------- //----------

    void wen_du() { if(yvyan == 1) { cout<< "行输入华氏度: " ; cin>> F_5; C_5 = 5 * ( F_5-32 ) / 9; printf ("%.5lf华氏度≈%.5lf摄氏度", F_5 , C_5 ); } else { cout<< "Please enter Fahrenheit temperature: " ; cin>> F_5; C_5 = 5 * ( F_5-32 ) / 9; printf ("%.5lfFahrenheit≈%.5lfCelsius", F_5 , C_5 ); } cout<<endl; }

    //----------

    void wen__du() { if(yvyan == 1) { cout<< "请输入摄氏度: " ; cin>> C_5; F_5 = C_5 * 9 / 5 + 32; printf ("%.5lf摄氏度≈%.5lf华氏度", C_5 , F_5 ); cout<<endl; } else { cout<< "Please enter Celsius temperature: " ; cin>> C_5; F_5 = C_5 * 9 / 5 + 32; printf ("%.5lfCelsius≈%.5lfFahrenheit", C_5 , F_5 ); cout<<endl; } }

    //---------- //----------

    void zi_bian() { if(yvyan == 1) { cout<<"请输入字符(只能是英文字符): "; cin>> b_7; printf ("字符%c的编号是: ", b_7 ); cout<< (int) b_7; cout<<endl; } else { cout<<"Please enter a character (can only be English character): "; cin>> b_7; printf ("The code for character%cis: ", b_7 ); cout<< (int) b_7; cout<<endl; } }

    //----------

    void bian_zi() { if(yvyan == 1) { cout<<"编号转字符: "; cin>> a_8; cout<< endl; cout<<"编号转字符 (结果): "; cout<< (char) a_8; } else { cout<<"Code to character conversion: "; cin>> a_8; cout<< endl; cout<<"Code to character conversion (result) : "; cout<< (char) a_8; } }

    //---------- //----------

    void zi_you() { if(yvyan == 1) cout<< "请输入算式: "; else cout<< "Please enter the equation: "; cin>> b_9 >> a_9 >> c_9 ; cout<< endl ; z_9 = (int) a_9; if (z_9 == 43) { cout<< b_9 << "+" << c_9 << "= " << b_9 + c_9 ; }

    else
    if (z_9 == 45)
    
    {
    	cout<< b_9 << "-" << c_9 << "= " << b_9 - c_9 ;
    }
    
    else
    if (z_9 == 42)
    
    {
    	cout<< b_9 << "×" << c_9 << "= " << b_9 * c_9 ;
    }
    
    else
    if (z_9 == 47)
    
    {
    	cout<< b_9 << "÷" << c_9 << "= " << b_9 / c_9 ;
    }
    
    else
    {
    	if(yvyan == 1) cout<<"!!错误 !!";
    	else cout<<"!! Error !!";
    }
    

    }

    //--------- //---------

    void ti_qv() { do {

    	if(yvyan == 1)
    	{
    		printf("请输入要被提取的数: "); 
    		scanf("%d",&n_10);
    		printf("\n");
    		
    		printf("请输入是从哪一边开始数(1 从右边开始数 - 2从左边开始数): ");
    		scanf("%d",&f_10);
    		printf("\n");
    		
    		printf("请输入从右边/左边要提取那个数是第几位: ");
    		scanf("%d",&k_10);
    		printf("\n");
    		result_10 = digit(n_10, f_10, k_10);
    		if(result_10 == -1)
    		{
    			printf("\n!!!错误,请重新输入 !!!\n\n\n");
    		}
    		else
    		{
    			printf("结果: ");
    			printf("%d\n", result_10);
    		}
    	}
    	else
    	{
    		printf("Please enter the number to be extracted: "); 
    		scanf("%d",&n_10);
    		printf("\n");
    		
    		printf("Please enter from which side to start counting (1 for counting from the right - 2 for counting from the left): ");
    		scanf("%d",&f_10);
    		printf("\n");
    		
    		printf("Please enter the position of the digit to be extracted from the right/left: ");
    		scanf("%d",&k_10);
    		printf("\n");
    		result_10 = digit(n_10, f_10, k_10);
    		if(result_10 == -1)
    		{
    			printf("\n!!! Error, please re-enter !!!\n\n\n");
    		}
    		else
    		{
    		printf("Result: ");
    		printf("%d\n", result_10);
    		}
    	}
    	
    }while( result_10 == -1 );
    

    }

    //----------

    int digit(int n, int f, int k) { // 定义一个变量count,记录当前数字的位数 int count = 0; while (n > 0) { count++; // 数字位数加1 if ((f == 1 && count == k) || (f == 2 && count == n)) { return n % 10; // 返回第k个数字 } n /= 10; // 将数字向右移动一位 } return -1; // 如果k超出了n的位数范围,返回-1表示错误 }

    //---------- //----------

    void zhuan_huan() { if(yvyan == 1) { printf("1. 十进制数转换为二进制数\n"); printf("2. 二进制数转换为十进制数\n"); printf("请输入: "); // scanf("%d", &choice_11);

    	switch (choice_11) {
    	    case 1:
    			printf("请输入一个十进制数: ");
    			scanf("%d", &num_11);
    			decimalToBinary(num_11);
    	 		break;
    		case 2:
    			printf("请输入一个二进制数: ");
    			scanf("%d", &num_11);
    			binaryToDecimal(num_11);
    			break;
    		default:
    			printf("无效的选项!\n");
    			break;
    	}
    }
    else
    {
    	printf("1. Convert decimal number to binary number\n");
    	printf("2. Convert binary number to decimal number\n");
    	printf("Please enter: ");
    	//
    	scanf("%d", &choice_11);
    
    	switch (choice_11) {
    	    case 1:
    			printf("Please enter a decimal number: ");
    			scanf("%d", &num_11);
    			decimalToBinary(num_11);
    	 		break;
    		case 2:
    			printf("Please enter a binary number: ");
    			scanf("%d", &num_11);
    			binaryToDecimal(num_11);
    			break;
    		default:
    			printf("Invalid option!\n");
    			break;
    	}
    	
    }
    

    }

    //----------

    void decimalToBinary(int num) { int binary[32]; int i = 0;

    while (num > 0) {
        binary[i] = num % 2;
        num = num / 2;
        i++;
    }
    
    printf("The binary number is: ");
    
    if (i == 0) {
        printf("0");
    }
    
    for (int j = i - 1; j >= 0; j--) {
        printf("%d", binary[j]);
    }
    
    printf("\n");
    

    }

    //----------

    void binaryToDecimal(int num) { int decimal = 0; int base = 1;

    while (num > 0) {
        int lastDigit = num % 10;
        decimal += lastDigit * base;
        num = num / 10;
        base = base * 2;
    }
    
    printf("The decimal number is: %d\n", decimal);
    

    }

    //---------- //----------

    void tan_qi() { if(yvyan == 1) { // 读取初始高度和反弹次数 printf("请输入单位(m/cm):"); scanf("%s", unit_12); printf("请输入球的初始高度:"); scanf("%lf", &height_12); printf("请输入反弹次数:"); scanf("%d", &times_12);

    	// 根据单位转换为米
    	if (unit_12[0] == 'c' && unit_12[1] == 'm') {
    	height_12 /= 100;  // 厘米转换为米
    	}
    
    	// 计算经过的总距离
    	for (int i = 0; i < times_12; i++) {
    		totalDistance_12 += height_12;
    		height_12 /= 2;
    		totalDistance_12 += height_12;
    	}
    
    	// 最后一次落地不需要加上反弹的高度
    	totalDistance_12 -= height_12;
    
    	// 计算最后一次反弹的高度
    	bounceHeight_12 = height_12 / 2;
    
    	// 输出结果,根据选择的单位进行输出
    	if (unit_12[0] == 'c' && unit_12[1] == 'm') {
    		printf("\n注意:没有计算空气阻力,结果会有一些偏差\n");
    		//
    		printf("到球第%d次落地时,一共经过的厘米数为:%.3lf\n", times_12, totalDistance_12 * 100);
    		printf("第%d次弹起的高度为:%.3lf厘米\n", times_12, bounceHeight_12 * 100 * 2 );
    		printf("单位:厘米\n");
    	} else {
    		printf("\n注意:没有计算空气阻力,结果会有一些偏差\n"); 
    		printf("到球第%d次落地时,一共经过的米数为:%.3lf\n", times_12, totalDistance_12);
    		printf("第%d次弹起的高度为:%.3lf米\n", times_12, bounceHeight_12 * 100 * 2 );
    		printf("单位:米\n");
    	}
    }
    else
    {
    	// 读取初始高度和反弹次数
    	printf("Please enter the unit (m/cm):");
    	scanf("%s", unit_12);
    	printf("Please enter the initial height of the ball:");
    	scanf("%lf", &height_12);
    	printf("Please enter the number of bounces:");
    	scanf("%d", &times_12);
    
    	// 根据单位转换为米
    	if (unit_12[0] == 'c' && unit_12[1] == 'm') {
    	height_12 /= 100;  // 厘米转换为米
    	}
    
    	// 计算经过的总距离
    	for (int i = 0; i < times_12; i++) {
    		totalDistance_12 += height_12;
    		height_12 /= 2;
    		totalDistance_12 += height_12;
    	}
    
    	// 最后一次落地不需要加上反弹的高度
    	totalDistance_12 -= height_12;
    
    	// 计算最后一次反弹的高度
    	bounceHeight_12 = height_12 / 2;
    
    	// 输出结果,根据选择的单位进行输出
    	if (unit_12[0] == 'c' && unit_12[1] == 'm') {
    		printf("\nNote: Air resistance is not taken into account, so there may be some deviation in the result.\n");
    		//
    		printf("The total distance covered by the ball until the%dth bounce is:%.3lf\n", times_12, totalDistance_12 * 100);
    		printf("The height of the ball on the%dth bounce is:%.3lfcentimeters\n", times_12, bounceHeight_12 * 100 * 2 );
    		printf("Unit:centimeters\n");
    	} else {
    		printf("\nNote: Air resistance is not taken into account, so there may be some deviation in the result.\n"); 
    		printf("The total distance covered by the ball until the %.3lfth bounce is:\n", times_12, totalDistance_12);
    		printf("The height of the ball on the %dth bounce is:%.3lf米\n", times_12, bounceHeight_12 * 100 * 2 );
    		printf("Unit:meters\n");
    	}
    }
    

    }

    //---------- //----------

    // 将十进制数转换为十六进制数 void decimalToHexadecimal(int decimal) { char hexadecimal[100]; sprintf(hexadecimal, "%X", decimal); if(yvyan == 1) printf("转换结果为十六进制数:%s\n", hexadecimal); else printf("The conversion result is in hexadecimal:%s\n", hexadecimal); }

    //----------

    // 将十六进制数转换为十进制数 void hexadecimalToDecimal(char* hexadecimal) { int decimal = strtol(hexadecimal, NULL, 16); printf("The conversion result is in decimal:%d\n", decimal); }

    //----------

    void shi_shiliou() { int choice; int decimal; char hexadecimal[100];

    if(yvyan == 1)
    {
    	printf("请选择操作:\n");
    	printf("1. 十进制转十六进制\n");
    	printf("2. 十六进制转十进制\n请输入: ");
    	scanf("%d", &choice);
    
    	if (choice == 1) {
        	printf("请输入一个十进制数:");
        	scanf("%d", &decimal);
        	decimalToHexadecimal(decimal);
    	} else if (choice == 2) {
        	printf("请输入一个十六进制数:");
        	scanf("%s", hexadecimal);
        	hexadecimalToDecimal(hexadecimal);
    	} else {
        	printf("无效的选择!\n");
    	}
    }
    else
    {
    	printf("Please select an operation:\n");
    	printf("1. Decimal to hexadecimal conversion\n");
    	printf("2. Hexadecimal to decimal conversion\nPlease enter: ");
    	scanf("%d", &choice);
    
    	if (choice == 1) {
        	printf("Please enter a decimal number:");
        	scanf("%d", &decimal);
        	decimalToHexadecimal(decimal);
    	} else if (choice == 2) {
        	printf("Please enter a hexadecimal number:");
        	scanf("%s", hexadecimal);
        	hexadecimalToDecimal(hexadecimal);
    	} else {
        	printf("Invalid choice!\n");
    	}
    }
    

    }

    //---------- //----------

    void caishuzi() { int randomNumber, guess, attempts = 5; int isCorrect = 0;

    // 使用时间作为种子,以便每次运行生成不同的随机数
    srand(time(0));
    
    // 生成一个1到100之间的随机数
    randomNumber = rand() % 100 + 1;
    
    if(yvyan == 1) {
    	printf("欢迎参加数字猜谜游戏!\n");
    	printf("请在1到100之间猜一个数字。\n");
    }
    else
    {
    	printf("Welcome to the number guessing game!\n");
    	printf("Please guess a number between 1 and 100.\n");
    }
    
    while (attempts > 0 && !isCorrect) {
    	if(yvyan == 1) {
        	printf("\n剩余次数:%d\n", attempts);
        	printf("请输入你的猜测:");
        }
        else
        {
        	printf("\nRemaining attempts:%d\n", attempts);
        	printf("Please enter your guess:");
    	}
        scanf("%d", &guess);
    	
        if (guess == randomNumber) {
            isCorrect = 1;
        } else if (guess < randomNumber) {
        	
        	if(yvyan == 1) printf("猜小了,请再试一次!\n");
        	else printf("Too low, please try again!\n");
        	
        } else {
        	
            if(yvyan == 1) printf("猜大了,请再试一次!\n");
            else printf("Too high, please try again!\n");
            
        }
    
        attempts--;
    }
    
    // 判断玩家是否猜对
    if (isCorrect) {
    	
        if(yvyan == 1) printf("\n恭喜你,猜对了!数字是 %d。\n", randomNumber);
        else printf("\nCongratulations, you guessed it right! The number is %d.\n", randomNumber);
        
    } else {
    	
        if(yvyan == 1) printf("\n很遗憾,你没有猜对。正确的数字是 %d。\n", randomNumber);
        else printf("\nUnfortunately, you did not guess correctly. The correct number is %d.\n", randomNumber);
        
    }
    

    }

    //---------- //----------

    int saoleii() {

    if(yvyan == 1) cout<<"请输入您大约需要的地雷数量(回车确定、第1行第1列除(1,1)位其他位置肯定没地雷 | 输入-1退出):";
    else cout<<"Please enter the approximate number of mines you need (Press Enter to confirm, except for position (1,1) in the first row and first column, there are definitely no mines in other positions | Enter -1 to exit.): ";
    
    cin>>leishu_16;
    asdfjkl = 0;
    if(leishu_16 != -1)
    {
    
    	//生成初始地图(10行,17列)并给weizhi[-][-]、tubiao[-][-]附值
    	cout<<"            11111111"<<endl;
    	cout<<"   12345678901234567"<<endl;
    	cout<<"   ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓"<<endl;
    	for(int i = 0 ; i < 10 ; i++)
    	{
    		if(i < 9) cout<<i + 1<<" →";
    		else cout<<"10→";
    		for(int j = 0 ; j != 17 ; j++)
    		{
    			dian();
    			weizhi[i][j] = '0';
    			tubiao[i][j] = '0';
    		}
    		cout<<endl;
    	}
    
    	//生成地雷
    	for(int i = 0 ; i < leishu_16 && leishu_16 < 144 ; i++)
    	{
    		suijia = rand()%10+1;
    		suijib = rand()%17+1;
    		if(suijia < 11 && suijia > 0  &&  suijib < 17 && suijib > 0  &&  suijia!=0&&suijib!=0)
    		{
    			if(tubiao[suijia][suijib] != '*') tubiao[suijia][suijib] = '*';
    			else i--;
    		}
    	}
    	if(a == 114514) tubiao[0][0] = '*';
    	
    	for(int i = 0 ; i != 10 ; i++)
    	{
    		for(int j = 0 ; j != 17 ; j++)
    		{
    			if(tubiao[i][j] != '*')
    			{
    				bianliang = 0;
    				 
    				if(tubiao[i-1][j-1] == '*') bianliang++;
    				if(tubiao[i-1][j] == '*') bianliang++;
    				if(tubiao[i-1][j+1] == '*') bianliang++;
    				
    				if(tubiao[i][j-1] == '*') bianliang++;
    				if(tubiao[i][j+1] == '*') bianliang++;
    				
    				if(tubiao[i+1][j-1] == '*') bianliang++;
    				if(tubiao[i+1][j] == '*') bianliang++;
    				if(tubiao[i+1][j+1] == '*') bianliang++;
    				
    				if(bianliang == 1) tubiao[i][j] = '0';
    				if(bianliang == 1) tubiao[i][j] = '1';
    				if(bianliang == 2) tubiao[i][j] = '2';
    				if(bianliang == 3) tubiao[i][j] = '3';
    				if(bianliang == 4) tubiao[i][j] = '4';
    				if(bianliang == 5) tubiao[i][j] = '5';
    				if(bianliang == 6) tubiao[i][j] = '6';
    				if(bianliang == 7) tubiao[i][j] = '7';
    				if(bianliang == 8) tubiao[i][j] = '8';
    			}
    			
    		}
    	}
    	
    	
    	do 
    	{
    	
    	for(int ijk = 0 ; wancheng != 1 ; ijk++)
    	{
    			
    		//玩儿游戏
    		cin>>qingkuang>>zuobiaoi>>zuobiaoj;
    		zuobiaoi -= 1;
    		zuobiaoj -= 1;
    		
    		//tubiao[0][0] = '*';
    		
    		//判断
    		//标记+ 掀开/
    		if(qingkuang == '+')
    		{
    			weizhi[zuobiaoi][zuobiaoj] = '+';
    			bianliang = 0;
    			for(int i = 0 ; i < 10 ; i++)
    			{
    				for(int j = 0 ; j < 17 ; j++)
    				{
    					if(tubiao[i][j] == '*')
    					{
    						if(weizhi[i][j] == '+') bianliang++;
    					}
    				}
    			}
    			if(bianliang > leishu_16)
    			{
    				if(yvyan == 1) cout<<"你胜利了!";
    				else cout<<"You have won!";
    				leishu_16 = -1; 
    				return 0;
    			}
    			break;
    			
    		}
    		if(qingkuang == '/')
    		{
    			if(tubiao[zuobiaoi][zuobiaoj] == '*'){
    				
    				if(yvyan == 1) cout<<"你失败了";
    				else cout<<"You have failed";
    				
    				cout<<endl;
    				for(int i = 0 ; i < 10 ; i++)
    				{
    					for(int j = 0 ; j < 17 ; j++)
    					{
    						cout<<tubiao[i][j];
    					}
    					cout<<endl;
    				}
    				jkl = 0;
    				return 0;
    			}
    			else
    			{
    				weizhi[zuobiaoi][zuobiaoj] = '/';
    				for(int i = 0 ; i < 143 - (leishu_16 + asdfjkl) ; i++)
    				{
    					zuobiaoi = rand()%10+1;
    					zuobiaoj = rand()%17+1;
    					if(tubiao[zuobiaoi][zuobiaoj] != '*')
    					{
    						weizhi[zuobiaoi][zuobiaoj] = '/';
    						asdfjkl++;
    					}
    

    // else i--; }

    			}
    			
    			break;
    			
    		}
    	}
    	
    	
    	
    	
    
    	//刷新地图
    	cout<<"            11111111"<<endl;
    	cout<<"   12345678901234567"<<endl;
    	cout<<"   ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓"<<endl;
    	for(int i = 0 ; i != 10 ; i++)
    	{
    		if(i < 9) cout<<i + 1<<" →";
    		else cout<<"10→";
    		for(int j = 0 ; j != 17; j++)
    		{
    			if(weizhi[i][j] == '0')
    			{
    				dian();
    			}
    			else
    			if(weizhi[i][j] == '+')
    			{
    				cout<<'+';
    			}
    			else
    			if(weizhi[i][j] == '/')
    			{
    				cout<<tubiao[i][j];
    			}
    		}
    		cout<<endl;
    	}
    	}while(jkl == 1);
    	
    }
    

    }

    //----------

    void dian() { cout<<"·"; }

    //----------

    int saoleij() { for( int i = 0 ; i == 0 && leishu_16 != -1 ; ) { leishu_16 = 0; zuobiaoi = 0; zuobiaoj = 0; bianliang = 0; wancheng = 0; a = 114514; jkl = 1;

    	suijia = 0;
    	suijib = 0;
    	asdfjkl = 0;
    	saoleii();
    }
    
    return 0;
    

    }

  • 通过的题目

  • 最近活动

    This person is lazy and didn't join any contests or homework.
  • 最近编写的题解

    This person is lazy and didn't write any solutions.
  • Stat

  • Rating

题目标签

系统测试
1