




已阅读5页,还剩7页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第三阶段 可视化编程一必做:1 课堂观看可视化视频(自带耳机)并当堂写出纸质操作步骤,课下观看可视化视频,写出纸质操作步骤及学习笔记。2 选取第一、二阶段已设计的任一题目,改写成可视化方法设计。建议观看:1从Appwizard开始-“HELLO”;2菜单和加速键;3对话框;4windows消息;二选作:1. 用你熟悉的一种可视化编程语言实现如下图所示的计算器。该计算器需要实现基础的数学运算,如加,减,乘,除。2. 使用Visual C+ 6.0实现以下绘图程序(可以参考附件中的程序代码)。要求:(1)程序中包含图中所示菜单项和工具栏;(2)先选择菜单项或单击工具栏上的命令按钮,然后在窗体空白区域单击鼠标后,绘制相应菜单项或命令按钮指定的图形、文字。扩充:1) 能够选择、移动、删除、拷贝、剪切图元2) 完成图形文件的保存、打开、打印3. 用你熟悉的一种可视化编程语言实现以下汉诺塔演示程序(可以参考附件中的程序代码)。程序代码:/ 汉诺塔.cpp : Defines the class behaviors for the application./#include stdafx.h#include 汉诺塔.h#include 汉诺塔Dlg.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CMyAppBEGIN_MESSAGE_MAP(CMyApp, CWinApp)/AFX_MSG_MAP(CMyApp)/ NOTE - the ClassWizard will add and remove mapping macros here./ DO NOT EDIT what you see in these blocks of generated code!/AFX_MSGON_COMMAND(ID_HELP, CWinApp:OnHelp)END_MESSAGE_MAP()/ CMyApp constructionCMyApp:CMyApp()/ TODO: add construction code here,/ Place all significant initialization in InitInstance/ The one and only CMyApp objectCMyApp theApp;/ CMyApp initializationBOOL CMyApp:InitInstance()AfxEnableControlContainer();/ Standard initialization/ If you are not using these features and wish to reduce the size/ of your final executable, you should remove from the following/ the specific initialization routines you do not need.#ifdef _AFXDLLEnable3dControls();/ Call this when using MFC in a shared DLL#elseEnable3dControlsStatic();/ Call this when linking to MFC statically#endifCMyDlg dlg;m_pMainWnd = &dlg;int nResponse = dlg.DoModal();if (nResponse = IDOK)/ TODO: Place code here to handle when the dialog is/ dismissed with OKelse if (nResponse = IDCANCEL)/ TODO: Place code here to handle when the dialog is/ dismissed with Cancel/ Since the dialog has been closed, return FALSE so that we exit the/ application, rather than start the applications message pump.return FALSE;/ 汉诺塔Dlg.h : header file/#if !defined(AFX_DLG_H_6F346C11_76E2_42CA_ACB6_7040244805B5_INCLUDED_)#define AFX_DLG_H_6F346C11_76E2_42CA_ACB6_7040244805B5_INCLUDED_#if _MSC_VER 1000#pragma once#endif / _MSC_VER 1000/ CMyDlg dialogclass CMyDlg : public CDialog/ Constructionpublic:CMyDlg(CWnd* pParent = NULL);/ standard constructor/ Dialog Data/AFX_DATA(CMyDlg)enum IDD = IDD_MY_DIALOG ;/ NOTE: the ClassWizard will add data members here/AFX_DATA/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CMyDlg)protected:virtual void DoDataExchange(CDataExchange* pDX);/ DDX/DDV support/AFX_VIRTUAL/ Implementationprotected:HICON m_hIcon;int MoveDish(int n, int a, int b); / 将a最上面的n个盘子移动到bvoid ShowBg(CDC * dc); / 显示函数void SetDishNumber(int n); / 设置盘子个数int number; / 盘子数int dish7; / 每个盘子所在位置int opt303; / 操作栈,用于保存将要进行的操作,因为操作要分步进行,故采用栈模拟递归,从而将操作分解int pn; / 栈顶位置/ Generated message map functions/AFX_MSG(CMyDlg)virtual BOOL OnInitDialog();afx_msg void OnSysCommand(UINT nID, LPARAM lParam);afx_msg void OnPaint();afx_msg HCURSOR OnQueryDragIcon();afx_msg void OnButton2();afx_msg void OnButton1();afx_msg void OnR3();afx_msg void OnR4();afx_msg void OnR5();afx_msg void OnR6();afx_msg void OnR7();afx_msg void OnTimer(UINT nIDEvent);/AFX_MSGDECLARE_MESSAGE_MAP();/AFX_INSERT_LOCATION/ Microsoft Visual C+ will insert additional declarations immediately before the previous line.#endif / !defined(AFX_DLG_H_6F346C11_76E2_42CA_ACB6_7040244805B5_INCLUDED_)/ 汉诺塔.h : main header file for the 汉诺塔application/#if !defined(AFX_H_427120C5_CCB4_46E4_B1DB_0E8AE6916A1E_INCLUDED_)#define AFX_H_427120C5_CCB4_46E4_B1DB_0E8AE6916A1E_INCLUDED_#if _MSC_VER 1000#pragma once#endif / _MSC_VER 1000#ifndef _AFXWIN_H_#error include stdafx.h before including this file for PCH#endif#include resource.h/ main symbols/ CMyApp:/ See 汉诺塔.cpp for the implementation of this class/class CMyApp : public CWinApppublic:CMyApp();/ Overrides/ ClassWizard generated virtual function overrides/AFX_VIRTUAL(CMyApp)public:virtual BOOL InitInstance();/AFX_VIRTUAL/ Implementation/AFX_MSG(CMyApp)/ NOTE - the ClassWizard will add and remove member functions here./ DO NOT EDIT what you see in these blocks of generated code !/AFX_MSGDECLARE_MESSAGE_MAP();/AFX_INSERT_LOCATION/ Microsoft Visual C+ will insert additional declarations immediately before the previous line.#endif / !defined(AFX_H_427120C5_CCB4_46E4_B1DB_0E8AE6916A1E_INCLUDED_)/ stdafx.h : include file for standard system include files,/ or project specific include files that are used frequently, but/ are changed infrequently/#if !defined(AFX_STDAFX_H_952FDF2E_C208_4AD3_BBCD_F037E1E3AAE0_INCLUDED_)#define AFX_STDAFX_H_952FDF2E_C208_4AD3_BBCD_F037E1E3AAE0_INCLUDED_#if _MSC_VER 1000#pragma once#endif / _MSC_VER 1000#define VC_EXTRALEAN/ Exclude rarely-used stuff from Windows headers#include / MFC core and standard components#include / MFC extensions#include / MFC Automation classes#include / MFC support for Internet Explorer 4 Common Controls#ifndef _AFX_NO_AFXCMN_SUPPORT#include / MFC support for Windows Common Controls#endif / _AFX_NO_AFXCMN_SUPPORT/AFX_INSERT_LOCATION/ Microsoft Visual C+ will insert additional declarations immediately before the previous line.#endif / !defined(AFX_STDAFX_H_952FDF2E_C208_4AD3_BBCD_F037E1E3AAE0_INCLUDED_)4. 单机版俄罗斯方块游戏规则:在方块从屏幕上方落下来时,玩家可以移动和旋转窗口内落下的方块,巧妙地安排布置,达到充分利用屏幕空间的目的。每当屏幕的一整行被方块积木排满时,作为奖赏,整行从屏幕上消失,剩余的积木依次往下降一行。当积木堆积达到屏幕顶端的时候,游戏结束。方块效果如下图所示。扩充:多人联机游戏。程序代码:#include stdafx.h#include stdio.h#include conio.h#include stdlib.h#include windows.h#include time.h#define random(x) (rand()%x)#define N 13#define M 10#define K 5int sNM=0,0,0,2,2,2,0,0,0,0,2,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,1,1,0,1,1,1;/*当前状态*/int aK33=0,2,0,2,2,2,2,0,0,2,2,2,2,0,0,2,0,0,2,2,2,2,2,0,0,2,2,2,2;void Disp()int i,j;for(i=0;iN;i+)for(j=0;jM;j+)printf(%c,sij?48+sij: );printf(n);printf(nn操作说明:按左移,按右移,按下移n);void Down()int i,j,k;for(j=0;jM;j+)if(sN-1j=2)break;/*判断是否在下边界*/if(jM)/*若方块在下边界则将方块由变*/for(i=0;iN;i+)for(j=0;j=0;i-)for(j=0;j=0;k-)for(j=0;jM;j+)sk+1j=skj;return;for(i=0;iN-1;i+)for(j=0;jM;j+)if(sij=2)if(si+1j!=0&si+1j!=2)break;/*方块下方不空退出内循环*/if(jM)break;/*方块下方不空退出外循环*/if(iN-1|jM)/若已触到则将方块由变*/for(i=0;iN;i+)for(j=0;jM;j+)if(sij=2)sij=1;for(i=0;iN;i+)for(j=0;j=0;i-)for(j=0;j=0;k-)for(j=0;j=0;i-)for(j=0;jM;j+)if(sij=2)si+1j=sij,sij=0;/*方块下移*/void Right()int i,j;for(i=0;iN;i+)if(siM-1=2)return;/* 已经在右边界退出*/for(i=0;iN;i+)for(j=0;j=0;j-)for(i=0;iN;i+)if(sij=2)sij+1=sij,sij=0;/* 方块右移*/void Left()int i,j;for(i=0;iN;i+)if(si0=2)return;/* 已经在左边界退出*/for(i=0;iN;i+)for(j=1;jM;j+)if(sij=2)if(sij-1!=0&sij-1!=2)return;/* 方块左方不空退出*/
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 雇主免责协议书
- 租房签协议书
- 车辆 转让 协议书
- 单国籍协议书
- 安培签协议书
- 作家协议书条款
- 达成战略合作协议书
- 婚前协议书模板
- 中国联通广元市2025秋招笔试行测题库及答案财务审计类
- 中国广电遂宁市2025秋招笔试行测题库及答案财务审计类
- 2025机采棉作业合同协议书范本
- 树木学试题及答案北林
- 财政补贴政策在促进农村电商发展的扶持效果可行性分析报告
- 《创伤失血性休克中国急诊专家共识(2023)》解读 2
- 2025第三季度作风建设党课以忠诚廉洁担当的政治品格奋力书写高质量发展新答卷
- 打井设备成套转让协议书
- 组织结构的权力与权威
- 宠物急救标准化流程
- 2025届广东广州地铁集团有限公司校园招聘笔试参考题库附带答案详解(10套)
- 教师信息技术数字资源开发计划
- 低钾血症护理常规业务学习
评论
0/150
提交评论