• 分享
  • 24计算机3班选择结构课堂程序提交处

  • @ 2025-3-28 9:00:49

123

58 条评论

  • @ 2025-6-3 8:07:05
    #include <iostream>
    #include <iomanip>
    #include <sstream>
    #include <string>
    #include <array>
    #include <cmath>
    #include <windows.h>
     
    using namespace std;
     
    #define myClassName "WindowCalculator"
    #define NUM (sizeof Buttons / sizeof Buttons[0])
    #define WarningBeep Beep(400,100)
    #define OutErrorText(s) SetWindowText(tHwnd[1], TEXT(s))
    #define OutResultText SetWindowText(tHwnd[2], tmp.c_str())
    #define ClearText SetWindowText(tHwnd[1],"");SetWindowText(tHwnd[2],"0")
    #define AboutMe ShellAbout(hwnd, "我的计算器",\
    	"我的Windows窗口计算器 by Hann Yang, 2021.2.21", NULL)
     
    struct button {
    	int x;	int y;  //坐标
    	int w;	int h;  //宽高
    	const char *szText;  //Caption
    }
    Buttons[] = {
    	30, 370,0,0,TEXT("0"),
    	30, 310,0,0,TEXT("1"),
    	90, 310,0,0,TEXT("2"),
    	150,310,0,0,TEXT("3"),
    	30, 250,0,0,TEXT("4"),
    	90, 250,0,0,TEXT("5"),
    	150,250,0,0,TEXT("6"),
    	30, 190,0,0,TEXT("7"),
    	90, 190,0,0,TEXT("8"),
    	150,190,0,0,TEXT("9"),
    	150,370,0,0,TEXT(" ."),
    	210,370,0,0,TEXT("+"),
    	210,310,0,0,TEXT("-"),
    	210,250,0,0,TEXT("×"),
    	210,190,0,0,TEXT("÷"),
    	210,130,0,0,TEXT("±"),
    	270,310,0,0,TEXT("="),
    	270,250,0,0,TEXT("1/x"),
    	270,190,0,0,TEXT("√x"),
    	270,130,0,0,TEXT("y2"),
    	150,130,0,0,TEXT("%"),
    	90, 130,0,0,TEXT("C"),
    	30, 130,0,0,TEXT("←")
    };
    		
    HFONT hFont[3];
    HWND tHwnd[3], bHwnd[NUM];
     
    string GetStaticText(short i=2)
    {
    	char buf[64] = {0};
    	GetWindowText(tHwnd[i], buf, 64);
    	return string(buf);
    }
     
    void myCreateFont()
    {
    	hFont[0] = (HFONT)GetStockObject(SYSTEM_FIXED_FONT);
    	/* windows系统基本字体:ANSI_FIXED_FONT DEFAULT_GUI_FONT ANSI_VAR_FONT
    		DEVICE_DEFAULT_FONT SYSTEM_FIXED_FONT SYSTEM_FONT OEM_FIXED_FONT */
    	hFont[1] = CreateFont(
                    -15, -8, /* 字符的逻辑单位高宽值(也被称为em高度)
                    		>0:字体映射器转换这个值以设备单位,并和已有字体的单元高度相匹配。
    						=0:字体映射器转换在选择匹配时用一个缺省的高度值。
    						<0:字体映射器转换这个值到设备单位,并将它的绝对值和已有字体的字符高度相匹配。 */ 
    				0,  /*指定移位向量和设备X轴之间的一个角度,以十分之一度为单位*/ 
    				0, /*指定每个字符的基线和设备X轴之间的角度*/
    				400, /*字体权值:400表示标准体,700表示黑(粗)体*/
                    FALSE, FALSE, FALSE, /*字体样式参数对应:斜体、下划线、删除线*/
                    DEFAULT_CHARSET,  /*默认字符集*/
                    OUT_DEFAULT_PRECIS, /*默认裁剪状态*/
    				CLIP_DEFAULT_PRECIS, /*默认输出精度*/
                    DEFAULT_QUALITY,  /*默认输出质量*/
                    DEFAULT_PITCH|FF_DONTCARE,  /*默认字体间距|不关心字体族*/
                    TEXT("微软雅黑") ); /*字体名称*/
    	hFont[2] = CreateFont(
                    30, 10, 0, 0, 700, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
    				OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
                    DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE,
                    TEXT("仿宋") );
    }
     
    void myCreateWindow(HWND hwnd, LPARAM lParam)
    {
    	tHwnd[0] = CreateWindow( TEXT("button"),NULL,
    					WS_CHILD | WS_VISIBLE | BS_GROUPBOX, /*分组框*/
                        30, 25, 290, 80,
    					hwnd,(HMENU)31,
    					((LPCREATESTRUCT) lParam)->hInstance,NULL);
    	if (!tHwnd[0]) MessageBox(NULL,"创建分组框失败","Message",MB_OK|MB_ICONERROR);
    	ShowWindow(tHwnd[0], SW_SHOW);
    	UpdateWindow(tHwnd[0]);
                
    	tHwnd[1] = CreateWindow( TEXT("static"),NULL,
    					WS_CHILD | WS_VISIBLE ,
                        36, 40, 278, 22,
    					hwnd,(HMENU)32,
    					((LPCREATESTRUCT) lParam)->hInstance,NULL);
    	if (!tHwnd[1]) MessageBox(NULL,"创建文本框失败","Message",MB_OK|MB_ICONERROR);
    	ShowWindow(tHwnd[1],SW_SHOW);
    	SendMessage(tHwnd[1], WM_SETFONT, (WPARAM)hFont[1], lParam);  //设置控件字体
    	SetWindowLong(tHwnd[1], GWL_STYLE, GetWindowLong(tHwnd[1], GWL_STYLE)|ES_RIGHT|SS_CENTERIMAGE); //设置右对齐、垂直居中 
    	UpdateWindow(tHwnd[1]);
                
    	tHwnd[2] = CreateWindow( TEXT("static"),"0",
    					WS_CHILD | WS_VISIBLE ,
                        36, 62, 278, 35,
    					hwnd,(HMENU)33,
    					((LPCREATESTRUCT) lParam)->hInstance,NULL);
    	if (!tHwnd[2]) MessageBox(NULL,"创建文本框失败","Message",MB_OK|MB_ICONERROR);
    	ShowWindow(tHwnd[2],SW_SHOW);
    	SetWindowLong(tHwnd[2], GWL_STYLE, GetWindowLong(tHwnd[2], GWL_STYLE) | ES_RIGHT);
    	SendMessage(tHwnd[2], WM_SETFONT, (WPARAM)hFont[2], lParam);
    	UpdateWindow(tHwnd[2]);
                
    	for(int i = 0; i < NUM; i++) {
    		Buttons[i].w = 50;
    		Buttons[i].h = 50;
    		Buttons[0].w = 110;	 //0双倍宽 
    		Buttons[16].h = 110; //=双倍高 
     
    		bHwnd[i] = CreateWindow( TEXT("button"),
    						Buttons[i].szText,
    						WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_FLAT,
    						Buttons[i].x, Buttons[i].y,
    						Buttons[i].w, Buttons[i].h,
    						hwnd,
    						(HMENU)(WPARAM)i, //(WPARAM)强制转换用于消除警告 
    						((LPCREATESTRUCT) lParam)->hInstance, NULL);
    		if (!bHwnd[i]) MessageBox(NULL,"创建命令按钮失败","Message",MB_OK|MB_ICONERROR);
    		ShowWindow(bHwnd[i],SW_SHOW);
    		SendMessage(bHwnd[i], WM_SETFONT, (WPARAM)hFont[0], lParam);  //设置控件字体
    		UpdateWindow(bHwnd[i]);	
    	}
    }
     
    template<typename T>string num2str(T d)
    {
    	string s;
    	stringstream ss;
    	ss<<setprecision(15)<<d;
    	s=ss.str();
    	ss.clear();
    	return s;
    }
     
    template<typename T>T str2num(string s)
    {
    	T d;
    	stringstream ss;
    	ss<<s;
    	ss>>setprecision(15)>>d;
    	ss.clear();
    	return d;
    }
     
    LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
    	string tmp;
    	array <string,4> strSign={"+","-","*","/"};
    	static bool num_input_state = true;
    	static bool sgn_input_state = false;
    	unsigned int lWord = LOWORD(wParam);
     
    	switch(Message) {
    		case WM_CREATE:  // WM_CREATE事件中创建所有子窗口控件 
    			myCreateFont();
    			myCreateWindow(hwnd, lParam);
    			break;
     
    		case WM_COMMAND:  // WM_COMMAND响应的wParam值对应控件的(HMENU)(WPARAM)i参数
    			tmp = GetStaticText();
    			if(lWord>=0 && lWord<=10){ //0~9、.
    				if (lWord==10 && tmp.find(".")!=tmp.npos){
    					OutErrorText("无效输入:已有小数点");
    					WarningBeep;
    					break;
    				}
    				if (sgn_input_state) tmp="";
    				sgn_input_state = false;
    				tmp = (tmp=="0"&&lWord!=10?"":tmp) + (lWord==10?".":num2str<int>(lWord));
    				if (num_input_state) OutResultText; 
    			}
    			else if(lWord>=11 && lWord<=14){ //+、-、*、/ 
    				num_input_state = true;
    				sgn_input_state = true;
    				if (GetStaticText(1).back()=='+'){
    					//MessageBox(hwnd, "+++", NULL, 0);
    				}
    				tmp = tmp + strSign.at(lWord-11);
    				OutErrorText(tmp.c_str());
    			}
    			else{
    				num_input_state = false;
    				switch (lWord){
    				case 15: //±
    					OutErrorText(("-("+tmp+")").c_str());
    					if (tmp.substr(0, 1) == "-")
    						tmp.erase(tmp.begin(),tmp.begin()+1);
    					else
    						if (tmp!="0") tmp = "-" + tmp;
    					OutResultText;
    					break;
    				case 16: // =
    					
    					num_input_state = true;
    					break;
    				case 17: //1/x
    					if (tmp=="0") {
    						OutErrorText("除0错:#DIV/0!");
    						WarningBeep;
    						break;
    					}
    					OutErrorText(("1/"+tmp).c_str());
    					tmp = num2str<long double>(1/str2num<long double>(tmp));
    					OutResultText;
    					break;
    				case 18: //sqrt(x)
    					if (str2num<long double>(tmp)<0) {
    						OutErrorText("无效输入:负数开平方");
    						WarningBeep;
    						break;
    					}
    					OutErrorText(("sqrt("+tmp+")").c_str());
    					tmp = num2str<long double>(sqrt(str2num<long double>(tmp)));
    					OutResultText;
    					break;
    				case 19: //y^2
    					OutErrorText(("pow("+tmp+",2)").c_str());
    					tmp = num2str<long double>(pow(str2num<long double>(tmp),2.0));
    					OutResultText;
    					if (GetStaticText()=="inf"){
    						OutErrorText("无效输入:平方值超出允许范围");
    						WarningBeep;
    						tmp="0";
    						OutResultText;
    					}
    					break;
    				case 20: //%
    					if (tmp.find("e")==tmp.npos)
    						OutErrorText((tmp+"%").c_str());
    					else
    						OutErrorText(("0.01*("+tmp+")").c_str());
    					tmp = num2str<long double>(str2num<long double>(tmp) * 0.01);
    					OutResultText;
    					break;
    				case 21: //C clear
    					ClearText;
    					num_input_state = true;
    					break;
    				case 22: //BackSpace
    					tmp = tmp.substr(0, tmp.size()-1);
    					if (tmp.empty()) tmp = "0";
    					OutResultText;
    					num_input_state = true;
    					break;
    				default:
    					MessageBox(hwnd, num2str<int>(lWord).c_str(), NULL, 0);
    				}
    			}
    			break; //end case WM_COMMAND
    		
    		case WM_KEYDOWN:
    			//返回的wParam为按键的虚拟键码: 110(orNumPAD190)=='.' 48~57(orNumPAD96~105)=='0'~'9'
    			tmp = num2str<int>(LOWORD(wParam)).c_str();
    			OutResultText;
    			break;
    				
    		case WM_SYSCHAR:
    			//返回的wParam为按键的虚拟键码: 110(orNumPAD190)=='.' 48~57(orNumPAD96~105)=='0'~'9'
    			tmp = num2str<int>(LOWORD(wParam)).c_str();
    			OutResultText;
    			break;
    			
    		case WM_CLOSE:
    			if (IDYES==MessageBox(hwnd, "是否真的要退出?", "确认", MB_ICONQUESTION | MB_YESNO))
    				DestroyWindow(hwnd);  //销毁窗口
    			return 0;
     
    		case WM_HELP: //响应 F1功能键 
    			AboutMe;
    			break;
     
    		case WM_DESTROY:
    			AboutMe;
    			PostQuitMessage(0);
    			return 0;
    		
    		default:
    			return DefWindowProc(hwnd, Message, wParam, lParam);
    	}
    	return 0;
    }
     
    ATOM myRegisterClass(HINSTANCE hInstance)
    {
    	WNDCLASSEX wc;
    	memset(&wc, 0, sizeof(wc));
    	wc.cbSize		 = sizeof(WNDCLASSEX);
    	wc.lpfnWndProc	 = WndProc;
    	wc.hInstance	 = hInstance;
    	wc.hCursor		 = LoadCursor(NULL, IDC_ARROW);
     
    	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    	wc.lpszMenuName  = NULL;	//无菜单;MAKEINTRESOURCE(IDC_MYMENU);
    	wc.lpszClassName = myClassName;
    	wc.hIcon		 = LoadIcon(NULL, IDI_APPLICATION);
    	wc.hIconSm		 = LoadIcon(NULL, IDI_APPLICATION);
     
    	return RegisterClassEx(&wc);
    }
     
    BOOL myInitInstance(HINSTANCE hInstance, int nCmdShow)
    {
    	HWND hwnd;
    	RECT rect;
    	int dtWidth, dtHeight;
    	hwnd = GetDesktopWindow(); //取桌面句柄 
    	GetWindowRect(hwnd,&rect); //取桌面范围 
    	dtWidth = rect.right-rect.left; //桌面宽度 
    	dtHeight = rect.bottom-rect.top; //桌面高度 
     
    	hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,
    		myClassName,
    		TEXT("我的计算器"),
    		WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_MINIMIZEBOX,
    		(dtWidth-360)/2,   /*窗体居中*/ 
    		(dtHeight-480)/2,
    		360, 480,
    		NULL,NULL,hInstance,NULL);
    	if (!hwnd) return false;
    	ShowWindow(hwnd, nCmdShow);
    	UpdateWindow(hwnd);
     
    	return true;
    }
     
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
    	MSG msg;
    	HWND hwnd;
     
     	if(!myRegisterClass(hInstance)) {
    		MessageBox(NULL, "Window Registration Failed!","Error!", MB_ICONEXCLAMATION|MB_OK);
    		return 0;
    	}
     
    	if(!myInitInstance(hInstance, nCmdShow)) {
    		MessageBox(NULL, "Window Creation Failed!","Error!", MB_ICONEXCLAMATION|MB_OK);
    		return 0;
    	}
     
    	while(GetMessage(&msg, NULL, 0, 0) > 0) { 
    		if(!IsDialogMessage(hwnd, &msg)){  
    			TranslateMessage(&msg); 
    			DispatchMessage(&msg);
    		}
    		//IsDialogMessage使得TAB和ARROW键可切换控件焦点,前提是控件有设WS_TABSTOP参数
    	}
     
    	return msg.wParam;
    }
    
    
    • @ 2025-5-8 8:59:36
      #include <stdio.h> //Ghanh GAME
      #include <windows.h>
      #include <time.h>
      #include <stdlib.h>
      #include <conio.h>
      int x=20,y=20,movex=1,movey=1,ranx,rany,score_s=0,stepA=0;
      void movefunc();
      void movefunc() {
      	system("cls");
      	for(int i=1; i<=y; i++) {
      		for(int j=1; j<=x; j++) {
      			if(ranx==j&&rany==i) {
      				printf("$ ");
      			} else if(movex==j&&movey==i) {
      				printf("@ ");
      			} else
      				printf("+ ");
      		}
      		printf("\n");
      	}
      	printf("Scores (%d/100)\n",score_s);
      	printf("STEP: %d\n",stepA);
      	char step = getch();
      	if(step=='w'||step=='W') {
      		if(movey<=1) movey=1;
      		else {
      			stepA++;
      			movey--;
      		};
      	} else if(step=='s'||step=='S') {
      		if(movey>=y) movey=y;
      		else {
      			movey++;
      			stepA++;
      		}
      	} else if(step=='a'||step=='A') {
      		if(movex<=1) movex=1;
      		else {
      			movex--;
      			stepA++;
      		}
      	} else if(step=='d'||step=='D') {
      		if(movex>=x) movex=x;
      		else {
      			movex++;
      			stepA++;
      		}
      	}
      	if(ranx==movex&&rany==movey) {
      		score_s++;
      		printf("\nScore + 1");
      		srand(time(NULL));
      		ranx =rand()%x+1;
      		rany = rand()%y+1;
      		Sleep(100);
      	}
      	return movefunc();
      }
      int main() {
      	srand(time(NULL));
      	ranx =rand()%x+1;
      	rany = rand()%y+1;
      	movefunc();
      }
      
      • @ 2025-4-15 17:24:11
        #include <stdio.h> //以前做的菜单-对应功能备份
        #include <windows.h> 
        #include <conio.h>
        void ComBlackTest();
        void denglu();
        void qipan();
        void hanois();
        void tellfuncA();
        void Diamond(); 
        void function();
        void menuon();
        void menuoff();
        void jiazai();
        void test();
        void matirx();
        int main()
        {
        	int ping,step;
        	denglu();
        }
        
        void denglu()
        {
        	int pins;
        	printf("| 欢迎使用CYY菜单系统\n| 请输入密码:"); 
        	scanf("%d",&pins);
        		if(pins==114514)
        		{
        			printf("欢迎用户Cyy#-%d\n",pins);
        		 return menuoff();
        		}
        		else
        		{
        		printf("<Worning> 输入的密码错误,请重新输入\n");
        		return denglu();
        		}
        }
        
        void menuoff()
        {
        	int ping;
        printf("==========菜单==========\n");
        printf("[1] 加载计算机配置\n");
        printf("[2] 运行计算机\n");
        printf("[3] 运行菱形图计算\n");
        printf("[4] 四位数比大小\n");
        printf("[5] 矩阵排布测试\n");
        printf("[6] 汉诺塔数学问题\n");
        printf("[7] 生成棋盘\n");
        printf("[8] 检测电脑按键\n");
        printf("========================\n");
        				printf("By Cyy Cmand.command\n");
        				char step = getch();
        				if(step=='1')
        				{
        					return jiazai();
        					ping=1;
        					step=0;
        				}
        				if(step=='2')
        				{
        					printf("<Worning> 你没有权限执行\n");
        					return menuoff();
        					step=0;
        				}
        				if(step=='3')
        				{
        					printf("<Worning> 你没有权限执行\n");
        					return menuoff();
        					step=0;
        				}
        					if(step=='4')
        				{
        					printf("<Worning> 你没有权限执行\n");
        					return menuoff();
        					step=0;
        				}
        						if(step=='5')
        				{
        					printf("<Worning> 你没有权限执行\n");
        					return menuoff();
        					step=0;
        				}
        								if(step=='6')
        				{
        					printf("<Worning> 你没有权限执行\n");
        					return menuoff();
        					step=0;
        				}
        									if(step=='7')
        				{
        					printf("<Worning> 你没有权限执行\n");
        					return menuoff();
        					step=0;
        				}
        									if(step=='8')
        				{
        					printf("<Worning> 你没有权限执行\n");
        					return menuoff();
        					step=0;
        					} 
        				else
        				{
        					printf("你输入的数字有误,或超域限值\n");
        					return menuoff(); 
        				}
        }
        
        void jiazai()
        {
        	int i=1,a=0,ping=1,replace=1;
        	while(replace=1)
        	{
        	i=i+1;
        	while(i==10000000)
        	{
        		a=a+1;
        		i=0;
        		printf("#####加载进度:%d%%\n",a);
        		system("cls");
        	}
        	while(a==100)
        	{
        		printf("加载完成###c/c;preemode'czs//22734\n");
        		return menuon();
        	}
        	}
        }
        
        void function()
        {
        	int x,y,sumA,sumB,sumC,sumD,step;
        		{
        	printf("请输入变量[1]:");
        	scanf("%d",&x);
        	printf("请输入变量[2]:");
        	scanf("%d",&y);
        	sumA=x+y;
        		sumB=x-y;
        			sumC=x*y;
        				sumD=x/y;
        				printf("经计算得出int类型时:\n");
        				printf("加法结果:%d\n",sumA);
        				printf("减法结果:%d\n",sumB);
        				printf("乘法结果:%d\n",sumC);
        				printf("除法结果:%d\n",sumD);
        				printf("- 输入[1]重复这一步操作\n- 输入[2]返回菜单\n");
        				scanf("%d",&step);
        				if(step==1)
        				{
        					step=0;
        					return function();
        				}
        					if(step==2)
        				{
        					step=0;
        					return menuon();
        				}
        				else
        				{
        					printf("输入数值有误重新输入\n"); 
        					scanf("%d",&step);
        						if(step==1)
        				{
        					step=0;
        					return function();
        				}
        					if(step==2)
        				{
        					step=0;
        					return menuon();
        				}
        				}
        				}
        	}
        
        void menuon()
        {
        	int ping;
        printf("=======[菜单-破解]=======\n");
        printf("[1] 加载计算机配置\n");
        printf("[2] 运行计算机\n");
        printf("[3] 运行菱形图计算\n");
        printf("[4] 四位数比大小\n");
        printf("[5] 矩阵排布测试\n");
        printf("[6] 汉诺塔数学问题\n");
        printf("[7] 生成棋盘\n");
        printf("[8] 检测电脑按键\n");
        printf("=========================\n");
        				printf("By Cyy Cmand.command\n");
        				char step = getch();
        				if(step=='1')
        				{
        					return jiazai();
        					ping=1;
        					step=0;
        				}
        				if(step=='2')
        				{
        					return function();
        					step=0;
        				}
        					if(step=='3')
        				{
        					return Diamond();
        					step=0;
        				}
        	             	if(step=='4')
        				{
        					return test();
        					step=0;
        				}
        				 	if(step=='5')
        				{
        					return matirx();
        					step=0;
        				}
        					 	if(step=='6')
        				{
        					return hanois();
        					step=0;
        				}
        					 	if(step=='7')
        				{
        					return qipan();
        					step=0;
        				}
        						 	if(step=='8')
        				{
        				    return ComBlackTest();
        					step=0;
        				}
        				else
        				{
        					printf("你输入的数字有误,或超域限值\n");
        					return menuon(); 
        				}
        
        }
        
        void Diamond()
        {
        	int total_row;
        	int total_column;
        	int row;
        	int column;
        	int ks_tab_num;
        	int ks;
        	printf("请输入菱形的行数(奇数):");
        	scanf("%d",&total_row);
        	if(total_row%2==0)
        	{
        		printf("必须输入奇数!");
        		return; 
        	}
        	total_column=total_row;
        	printf("请输入菱形制表符起始位置个数:");
        	scanf("%d",&ks_tab_num);
        	if((80-ks_tab_num*8)<total_column)
        	{
        		printf("输入的菱形制表符起始位置个数太大,重新输入\n");
        		return; 
        	} 
        	for(row=1;row<=total_row;row++)
        	{
        		for(ks=1;ks<=ks_tab_num;ks++)
        		printf("\t");
        		if(row<(total_row+1)/2+1)
        		{
        			for(column=1;column<=total_column;column++)
        		{
        			if(column>=(total_column+1)/2-(row-1)&&column<=(total_column+1)/2+(row-1))
        			{
        				printf("*");
        			}
        			else
        			{
        				printf(" ");
        			}
        		} 
        	}
        else 
        {
        	for(column=1;column<=total_column;column++)
        	{
        		if(column>=(total_column+1)/2-(total_row-row)&&column<=(total_column+1)/2+(total_row-row))
        		{
        			printf("*");
        		}
        		else
        		{
        			printf(" ");
        		}
        	}
        }
        printf("\n");
        }
        return tellfuncA();
        }
        
        void tellfuncA()
        {
        	printf("按[任意按键]键返回菜单");
        		char step=getch(); 
        		if(step=='1')
        		{
         		return menuon();
        		}
        		else
        		{
        			return menuon();
        		}
        }
        
        
        void test()
        {
        	int max4(int a,int b,int c,int d);
        	int a,b,c,d,max;
        	printf("请输入四位比较大小的数字:");
        	scanf("%d %d %d %d",&a,&b,&c,&d);
        	max=max4(a,b,c,d);
        	printf("最大值为=%d\n",max);
        	return menuon(); 
        }
        
        int max4(int a,int b,int c, int d)
        {
        	int max2(int a,int b);
        	int m;
        	m=max2(a,b);
        		m=max2(m,c);
        			m=max2(m,d);
        			return(m);
        }
        
        int max2(int a,int b)
        {
        	if(a>=b)
        	return a;
        	else
        	return b;
        }
        
        void matirx()
        {
        	int a,b,a2,b3,a3,replace=1;
        	printf("请输入矩阵的长:");
        	scanf("%d",&a);
        		printf("请输入矩阵宽:");
        	scanf("%d",&b);
        	b3=b;
        	a2=a;
        	a3=a;
        	while(replace=1)
        	{
        		if(a>0)
        		{
        			printf("* ");
        			a=a-1;
        		}
        		else{
        			if(a=0,b>1)
        			{
        				printf("\n");
        				a=a2;
        				b=b-1;
        			}
        			else
        			{
        			printf("\n<输出> - 矩阵的长为<%d> 宽为<%d>\n",a3,b3);
        			printf("输入[任意按键]返回菜单");
        			char step=getch();
        			if(step='1')
        			{
        				return menuon();
        			}
        			else	{
        				return menuon();
        			}
        			}
        		}
        	}
        } 
        void hanois()
        {
        	void hanoi(int n,char one,char two,char three);
        	int m;
        	printf("请输入叠塔层数:");
        	scanf("%d",&m);
        	printf("叠塔步骤如下:\n",m);
        	hanoi(m,'A','B','C');
        	printf("\n<command> 步骤如上,自动返回菜单\n");
        	return menuon();
        }
        
        	void hanoi(int n,char one,char two,char three)
        	{
        		void move(char x,char y);
        		if(n==1)
        		move(one,three);
        		else{
        			hanoi(n-1,one,three,two);
        			move(one,three);
        			hanoi(n-1,two,one,three);
        		}
        	}
        	
        	void move(char x,char y)
        	{
        		printf("%c-->%c\n",x,y);
        	}
        	
        	void qipan()
        	{
        	int i,j;
        	for(i=0;i<27;i++)
        	{
        		for(j=0;j<27;j++)
        		{
        			if((i+j)%2==0)
        			{
        			printf("%c%c",0xa8,0x80);
        			printf("%c%c",0xa8,0x80);
        			}
        			else
        			printf("  ");
        		}
        		printf("\n");
        	}
        	return menuon();
        }
        
        void ComBlackTest()
        {
        	int a=0;
        	printf("正在检索...请输入...");
        	while(a<100)
        	{
        	char text = getch();
        	printf("输出#%c#---按数字0退出测试\n",text);
        	a++;
        	if(text=='0')
        	{
        		a=101;
        	} 
        	}
        	if(a>100)
        	{
        		printf("已退出测试");
        		return menuon();
        	}
        }
        
        
        • @ 2025-4-15 17:18:07
          #include <stdio.h> // 对于菜单动画进行的处理
          
          #include <windows.h>
          void camera_1();
          
          void camera_1()
          {
          	int cameras=0;
          	while(true)
          	{
          		cameras++;
          		switch(cameras)
          		{
          			case 1:system("cls");printf("*");Sleep(20);break;
          			case 2:system("cls");printf("*-");Sleep(10);break;
          			case 3:system("cls");printf("*--");Sleep(10);break;
          			case 4:system("cls");printf("*---");Sleep(10);break;
          			case 5:system("cls");printf("*----");Sleep(10);break;
          			case 6:system("cls");printf("*-----");Sleep(10);break;
          			case 7:system("cls");printf("*------");Sleep(10);break;
          			case 8:system("cls");printf("*-------");Sleep(10);break;
          			case 9:system("cls");printf("*--------");Sleep(10);break;
          			case 10:system("cls");printf("*---------");Sleep(10);break;
          			case 11:system("cls");printf("*----------");Sleep(10);break;
          			case 12:system("cls");printf("*-----------");Sleep(10);break;
          			case 13:system("cls");printf("*------------");Sleep(10);break;
          			case 14:system("cls");printf("*-------------");Sleep(10);break;
          			case 15:system("cls");printf("*--------------");Sleep(10);break;
          			case 16:system("cls");printf("*---------------");Sleep(10);break;
          			case 17:system("cls");printf("*----------------");Sleep(10);break;
          			case 18:system("cls");printf("*-----------------");Sleep(10);break;
          			case 19:system("cls");printf("*-----------------*");Sleep(50);break;
          			case 20:system("cls");printf("*--------|--------*");Sleep(20);break;
          			case 21:system("cls");printf("*-------<|>-------*");Sleep(20);break;
          			case 22:system("cls");printf("*------<<|>>------*");Sleep(20);break;
          			case 23:system("cls");printf("*-----<<<|>>>-----*");Sleep(20);break;
          			case 24:system("cls");printf("*----<<<<|>>>>----*");Sleep(20);break;
          			case 25:system("cls");printf("*---<<<<<|>>>>>---*");Sleep(20);break;
          			case 26:system("cls");printf("*--<<<<<<|>>>>>>--*");Sleep(20);break;
          			case 27:system("cls");printf("*-<<<<<<<|>>>>>>>-*");Sleep(20);break;
          			case 28:system("cls");printf("*<<<<<<<<|>>>>>>>>*");Sleep(20);break;
          			case 29:system("cls");printf("*<<<<-       ->>>>*");Sleep(20);break;
          			case 30:system("cls");printf("*<--           -->*");Sleep(20);break;
          			case 31:system("cls");printf("*        M        *");Sleep(20);break;
          			case 32:system("cls");printf("*        Me       *");Sleep(20);break;
          			case 33:system("cls");printf("*       Men       *");Sleep(20);break;
          			case 34:system("cls");printf("*       Menu       *\n|     GUD游戏      |");Sleep(20);break;
          			case 35:system("cls");printf("*       Menu       *\n|     GUD游戏      |\n|     暂未开放     |");Sleep(20);break;
          			case 36:system("cls");printf("*       Menu       *\n|     GUD游戏      |\n|     暂未开放     |\n|     暂未开放     |");Sleep(20);break;  
          			case 37:system("cls");printf("*       Menu       *\n|     GUD游戏      |\n|     暂未开放     |\n|     暂未开放     |\n|     暂未开放     |");Sleep(20);break;
          			case 38:system("cls");printf("*>>     Menu     <<*\n|     GUD游戏      |\n|     暂未开放     |\n|     暂未开放     |\n|     暂未开放     |\n*>>              <<*");Sleep(20);break;
          			case 39:system("cls");printf("*-->>   Menu   <<--*\n|     GUD游戏      |\n|     暂未开放     |\n|     暂未开放     |\n|     暂未开放     |\n*-->>          <<--*");Sleep(20);break;
          			case 40:system("cls");printf("*---->  Menu  <----*\n|     GUD游戏      |\n|     暂未开放     |\n|     暂未开放     |\n|     暂未开放     |\n*---->>      <<----*");Sleep(20);break;
          			case 41:system("cls");printf("*-----> Menu <-----*\n|     GUD游戏      |\n|     暂未开放     |\n|     暂未开放     |\n|     暂未开放     |\n*------>    <------*");Sleep(20);break;
          			case 42:system("cls");printf("*------>Menu<------*\n|     GUD游戏      |\n|     暂未开放     |\n|     暂未开放     |\n|     暂未开放     |\n*--------><--------*");Sleep(20);break;
          			case 43:system("cls");printf("*------<Menu>------*\n|     GUD游戏      |\n|     暂未开放     |\n|     暂未开放     |\n|     暂未开放     |\n*------------------*");Sleep(20);break;
          			
          		}
          	}
           } 
           
           
           int main()
           {
           	camera_1();
            } 
          
          
          • @ 2025-3-28 10:25:26

            123

            • @ 2025-3-28 10:25:21

              123

              • @ 2025-3-28 10:25:16

                123

                • @ 2025-3-28 10:25:10

                  123

                  • @ 2025-3-28 10:25:05

                    123

                    • @ 2025-3-28 10:21:01

                      123

                      • @ 2025-3-28 10:19:35

                        123

                        • @ 2025-3-28 9:35:56
                          #include<stdio.h>
                          int main(){
                          	char a;
                          	printf("请输入一个字符:");
                          	scanf("%c",&a);
                          	if(a>='0' && a<='9'){
                          		printf("%c它是一个数字字符\n",a);
                          	}else if(a>='a' && a<='z' || a>='A' && a<='Z'){
                          		//if(a>='a' && a<='z') || (a>='A' && a<='Z'))
                          		printf("%c它是一个字母字符\n",a);
                          	}else{
                          		printf("%c它是其它字符\n",a);
                          	} 
                          	return 0;
                          }
                          
                          
                          • @ 2025-3-28 9:15:41
                            //空心菱形
                            #include <stdio.h>
                            int main()
                            {
                            	int rows;
                            	scanf("%d",&rows);
                            	for(int i=1;i<=rows;i++)
                            	{
                            		for(int space=1;space<=rows-i;space++)
                            		{
                            			printf(" ");
                            		}
                            			printf("*");
                            			for(int space=1;space<=2*i-3;space++)
                            			{
                            				printf(" ");
                            			}
                            			if(i!=1)
                            			{
                            				printf("*");
                            			}
                            		printf("\n");
                            	}
                            	for(int i=rows-1;i>=1;i--)
                            	{
                            		for(int space=1;space<=rows-i;space++)
                            		{
                            			printf(" ");
                            		}
                            			printf("*");
                            			for(int space=1;space<=2*i-3;space++)
                            			{
                            				printf(" ");
                            			}
                            			if(i!=1)
                            			{
                            				printf("*");
                            			}
                            		printf("\n");
                            	}
                            	return 0;
                            }
                            
                            ❤️ 5
                            👍 2
                            👎 2
                            🤔 1
                            😄 1
                            😕 1
                            🤣 1
                            🌿 1
                            🍋 1
                            🕊️ 1
                            👀 1
                            🤡 1
                            • @ 2025-3-28 9:15:38
                              #include<stdio.h>
                              int main(){
                              	int x,y;
                              	scanf("%d",&x);
                              	if(x>=0){
                              		if(x>0){
                              			y=1;
                              		}else{
                              			y=0;
                              		}
                              	}else{
                              		y=-1;
                              	}
                              	printf("%d",y);
                              	return 0;
                              }
                              
                              • @ 2025-3-28 9:15:27
                                #include<stdio.h>
                                int main(){
                                	int a,b,max;
                                	printf("请输入两个整数: 求它们的最大值\n");
                                	scanf("%d,%d",&a,&b);
                                	max = a;
                                	if(b>max){
                                		max = b;
                                	}
                                	printf("最大的数是%d",max);
                                	return 0;
                                }
                                
                                • @ 2025-3-28 9:15:26
                                  #include<stdio.h>
                                  int main(){
                                  	int x,y;
                                  	scanf("%d",&x);
                                  	if(x>=0){
                                  		if(x > 0){
                                  			y = 1;
                                  		}else{
                                  			y = 0;
                                  		}
                                  	}else{
                                  		y = -1;
                                  	}
                                  	printf("%d",y);
                                  	return 0;
                                  } 
                                  
                                  • @ 2025-3-28 9:15:26
                                    #include<stdio.h>
                                    int main(){
                                    	int x,y;
                                    	scanf("%d",&x);
                                    	if(x>=0){
                                    		if(x > 0){
                                    			y = 1;
                                    		}else{
                                    			y = 0;
                                    		}
                                    	}else{
                                    		y = -1;
                                    	}
                                    	printf("%d",y);
                                    	return 0;
                                    }
                                    • @ 2025-3-28 9:15:26
                                      #include<stdio.h>
                                      int main(){
                                      	int a,b,max;
                                      	printf("请输入两个整数:求它们的最大值\n");
                                      	scanf("%d,%d",&a,&b);
                                      	max a;
                                      	if(b>max){
                                      		max=b;
                                      	} 
                                      	printf("最大的数是%d",max);
                                      	return 0;
                                      }
                                      • @ 2025-3-28 9:15:19
                                        #include<stdio.h>
                                        int main(){
                                        	int x,y;
                                        	scanf("%d",&x);
                                        	if(x>=0){
                                        		if(x > 0){
                                        			y = 1;
                                        	}else{
                                        		y = 0;
                                        	 }
                                        	}else{
                                        		y = -1;
                                        	}
                                        	printf("%d",y);
                                        	return 0;
                                        }
                                        
                                        • @ 2025-3-28 9:15:19
                                          #include<stdio.h>
                                          int main(){
                                          	int x,y;
                                          	scanf("%d",&x);
                                          	if(x>=0){
                                          		if(x > 0){
                                          			y = 1; 	
                                          		}else{
                                          			y = 0;
                                          		}
                                          	}else{
                                          		y = -1;
                                          	}
                                          	printf("%d",y);
                                          	return 0;
                                          }
                                          
                                          • @ 2025-3-28 9:15:18
                                            #include <stdio.h>
                                            int main(){
                                            	int x,y;
                                            	scanf("%d",&x);
                                            	if(x>=0){
                                            		if(x>0){
                                            		y=1;
                                            		}else{
                                            			y=0;
                                            		}
                                            	}else{
                                            		y=-1;
                                            	}
                                            	printf("%d",y);
                                            return 0;
                                            }
                                            • @ 2025-3-28 9:15:17
                                              
                                              #include <stdio.h>
                                              int main(){
                                              	int a,b,max;
                                              	printf("请输入两个整数:求他们得最大值\n");
                                              	scanf("%d,%d",&a,&b);
                                              	max=a;
                                              	if(b>max){
                                              		max=b;
                                              	}
                                              	printf("最大的数是%d",max);
                                              	return 0;
                                              }
                                              
                                              • @ 2025-3-28 9:15:16
                                                #include<stdio.h>
                                                int main(){
                                                	int x,y;
                                                	scanf("%d",&x);
                                                	if(x>=0){
                                                		if(x>0){
                                                			y=1;
                                                		}else{
                                                			y=0;
                                                		}
                                                	}else{
                                                		y=-1;
                                                	}
                                                	printf("%d",y);
                                                	return 0;
                                                }
                                                
                                                • @ 2025-3-28 9:15:14
                                                  #include<stdio.h>
                                                  int main(){
                                                  	int a,b,max;
                                                  	printf("请输入两个整数:求他们的最大值\n");
                                                  	scanf("%d,%d",&a,&b);
                                                  	max = a;
                                                  	if(b>max){
                                                  		max = b;
                                                  	} 
                                                  	printf("最大的数是%d",max);
                                                  	return 0;
                                                  }
                                                  
                                                  • @ 2025-3-28 9:15:14
                                                    #include<stdio.h>
                                                    int main(){
                                                    	int x,y;
                                                    	scanf("%d",&x);
                                                    	if(x>=0){
                                                    		if(x > 0){
                                                    			y = 1; 	
                                                    		}else{
                                                    			y = 0;
                                                    		}
                                                    	}else{
                                                    		y = -1;
                                                    	}
                                                    	printf("%d",y);
                                                    	return 0;
                                                    }
                                                    
                                                    • @ 2025-3-28 9:14:58
                                                      #include<stdio.h>
                                                      int main()
                                                      {
                                                      	int x,y;
                                                      	scanf("%d",&x);
                                                      	if(x>=0){
                                                      		y=1;
                                                      	}else{
                                                      		y=0;
                                                      	}
                                                      	else{
                                                      		y=-1
                                                      	}
                                                      
                                                      	printf("%d",y);
                                                      	return 0;
                                                      }
                                                      
                                                      • @ 2025-3-28 9:14:25

                                                        #include<stdio.h>
                                                        int main(){
                                                        	int x,y;
                                                        	scanf("%d",&x);
                                                        	if(x>=0){
                                                        		if(x > 0){
                                                        			y = 1; 	
                                                        		}else{
                                                        			y = 0;
                                                        		}
                                                        	}else{
                                                        		y = -1;
                                                        	}
                                                        	printf("%d",y);
                                                        	return 0;
                                                        }
                                                        
                                                        • @ 2025-3-28 9:11:43

                                                          '''C #include<stdio.h> int main(){ int x,y; scanf("%d",&x); if(x>=0){ if(x > 0){ y = 1; }else{ y = 0; } }else{ y = -1; } printf("%d",y); return 0; } '''

                                                          • @ 2025-3-28 9:10:17
                                                             #include<stdio.h>
                                                             int main()
                                                             {
                                                             	int N,y;
                                                            	scanf("%d",&N);
                                                            	if(N>=0)
                                                            	{
                                                            		if(N>0)
                                                            		printf("positive\n");
                                                            		else
                                                            		printf("zero\n");
                                                            	} 
                                                            	else
                                                            	printf("negative\n");	
                                                            	return 0;
                                                             }
                                                            
                                                            
                                                            • @ 2025-3-28 9:09:17

                                                              #include<stdio.h> int main(){ int a,b,max; printf("请输入两个整数:求它们的最大值\n"); scanf("%d,%d",&a,&b); max a; if(b>max){ max=b; } printf("最大的数是%d",max); return 0; }

                                                              • @ 2025-3-28 9:07:50

                                                                #include<stdio.h> int main(){ int x,y; scanf("%d",&x); if(x>=0){ if(x>0){ y=1; }else{ y=0; } }else{ y=-1; } printf("%d",y); return 0; }```

                                                                • @ 2025-3-28 9:06:03

                                                                  #include<stdio.h>> - 1. 1. - > int main(){ int x,y; scanf("%d",&x); if(x>=0){ if(x > 0){ y = 1; }else{ y = 0; } }else{ y = -1; } printf("%d",y); return 0; }

                                                                  • @ 2025-3-28 9:05:56

                                                                    #include<stdio.h> int main(){ int a,b,max; printf("请输入两个整数:求它们的最大值\n"); scanf("%d,%d",&a,&b); max = a; if(b>max){ max = b; } printf("最大的数是%d",max); return 0; }

                                                                    • @ 2025-3-28 9:05:50
                                                                      
                                                                      

                                                                      #include <stdio.h> int main() { int rows; scanf("%d",&rows); for(int i=1;i<=rows;i++) { for(int space=1;space<=rows-i;space++) { printf(" "); } printf(""); for(int space=1;space<=2i-3;space++) { printf(" "); } if(i!=1) { printf(""); } printf("\n"); } for(int i=rows-1;i>=1;i--) { for(int space=1;space<=rows-i;space++) { printf(" "); } printf(""); for(int space=1;space<=2i-3;space++) { printf(" "); } if(i!=1) { printf(""); } printf("\n"); } return 0;

                                                                      • @ 2025-3-28 9:05:49

                                                                        #include <stdio.h> int main(){ int a,b,max; printf("请输入两个整数:求他们得最大值\n"); scanf("%d,%d",&a,&b); max=a; if(b>max){ max=b; } printf("最大的数是%d",max); return 0; }

                                                                        • @ 2025-3-28 9:05:44

                                                                          #include<stdio.h> int main(){ int a,b,max; printf("请输入两个整数:求他们的最大值\n"); scanf("%d,%d",&a,&b); max = a; if(b>max){ max = b; } printf("最大的数是%d",max); return 0; }

                                                                          • @ 2025-3-28 9:05:43
                                                                            #include<stdio.h>
                                                                            int main(){
                                                                            	int x,y;
                                                                            	scanf("%d",&x);
                                                                            	if(x>=0){
                                                                            		if(x>0){
                                                                            			y=1;
                                                                            		}else{
                                                                            			y=0;
                                                                            		}
                                                                            	}else{
                                                                            		y=-1;
                                                                            	}
                                                                            	printf("%d",y);
                                                                            	return 0;1
                                                                            }
                                                                            
                                                                            • @ 2025-3-28 9:05:17
                                                                              #include<stdio.h>
                                                                              int main(){
                                                                              	int a,b,max;
                                                                              	printf("请输入两个整数:求它们的最大值\n");
                                                                              	scanf("%d,%d",&a,&b);
                                                                              	max=a;
                                                                              	if(b>max){
                                                                              		max=b;
                                                                              	} 
                                                                              	printf("最大的数是%d",max);
                                                                              	return 0;
                                                                              }
                                                                              
                                                                              • @ 2025-3-28 9:05:17

                                                                                • @ 2025-3-28 9:05:10

                                                                                  #include<stdio.h> int main(){ int x,y; scanf("%d",&x); if(x>=0){ if(x>0){ y=1; }else{ y=0; } }else{ y=-1; } printf("%d",y); return 0; }

                                                                                  • @ 2025-3-28 9:05:07

                                                                                    #include<stdio.h> int main(){ int x,y; scanf("%d",&x); if(x>=0){ if(x > 0){ y = 1; }else{ y = 0; } }else{ y = -1; } printf("%d",y); return 0; }

                                                                                    • @ 2025-3-28 9:04:49

                                                                                      #include<stdio.h> int main(){ int a,b,max; printf("请输入两个整数:求它们的最大值\n"); scanf("%d,%d",&a,&b); max = a; if(b>max){ max = b; } printf("最大的数是%d",max); return 0; }

                                                                                      • @ 2025-3-28 9:04:42

                                                                                        #include <stdio.h> int main(){ int x,y; scanf("%d",&x); if(x>=0){ if(x>0){ y=1; }else{ y=0; } }else{ y=-1; } printf("%d",y); return 0; }

                                                                                        • @ 2025-3-28 9:04:41

                                                                                          #include<stdio.h> int main(){ int x,y; scanf("%d",&x); if(x>=0){ if(x > 0){ y = 1; }else{ y = 0; } }else{ y = -1; } printf("%d",y); return 0; }

                                                                                          • @ 2025-3-28 9:04:12

                                                                                            #include<stdio.h> int main(){ int x,y; scanf("%d",&x) ; if(x>=0){ if(x>0){ y=1; }else{ y=0; } }else{ y=-1; } printf("%d",y); return 0; }

                                                                                            • @ 2025-3-28 9:04:10

                                                                                              #include<stdio.h> int main(){ int x,y; scanf("%d",&x); if(x>=0){ if(x>0){ y=1; }else{ y=0; } }else{ y=-1; } printf("%d",y); return 0; }

                                                                                              • @ 2025-3-28 9:04:04
                                                                                                 #include<stdio.h>
                                                                                                 int main()
                                                                                                 {
                                                                                                 	int x,y;
                                                                                                	scanf("%d",&x);
                                                                                                	if(x>=0)
                                                                                                	{
                                                                                                		if(x>0)
                                                                                                		y=1;
                                                                                                		else
                                                                                                		y=0;
                                                                                                	} 
                                                                                                	else
                                                                                                	y=-1;
                                                                                                	printf("%d",y);
                                                                                                	return 0;
                                                                                                 }
                                                                                                
                                                                                                
                                                                                                • @ 2025-3-28 9:03:59
                                                                                                  #include<stdio.h>
                                                                                                  int main(){
                                                                                                  	int x,y;
                                                                                                  	scanf("%d",&x);
                                                                                                  	if(x>=0){
                                                                                                  		if(x > 0){
                                                                                                  			y = 1;
                                                                                                  		}else{
                                                                                                  			y = 0;
                                                                                                  		}  
                                                                                                  	}else{
                                                                                                  	 	y = -1;
                                                                                                  	}
                                                                                                  	printf("%d",y);
                                                                                                  	return 0;
                                                                                                  }
                                                                                                  
                                                                                                  • @ 2025-3-28 9:03:56

                                                                                                    #include<stdio.h> int main(){ int x,y; scanf("%d",&x); if(x>=0){ if(x>0){ y=1; }else{ y=0; } }else{ y=-1; } printf("%d",y); return 0; }

                                                                                                    • @ 2025-3-28 9:03:53
                                                                                                      #include<stdio.h>
                                                                                                      int main(){
                                                                                                      	int x,y;
                                                                                                      	scanf("%d",&x);
                                                                                                      	if(x>=0){
                                                                                                      		if(x > 0){
                                                                                                      			y = 1;
                                                                                                      		}else{
                                                                                                      			y = 0;
                                                                                                      		}
                                                                                                          }else{
                                                                                                          	y = -1;
                                                                                                          }
                                                                                                          printf("%d",y);
                                                                                                          return 0;
                                                                                                      }