資源簡介
該程序由VC++ 6.0 編寫,程序功能設計如下:
1)按“生成10個隨機數”菜單動態生成10個數字的數組,并以隨機數初始化數組。
2)在“排序方法”菜單里的打勾方式來選擇排序方法。
3)排序方式為冒泡排序和選擇排序。
4)在“操作”菜單里選擇“開始”即演示數組數據排序的移動過程,按“結束”則直接結束排序演示過程,按“單步演示”打勾再按“開始”則是可以通過鼠標左鍵點擊客戶區一步一步查看過程,“單步演示”不打勾時表示是自動演示。
5)在客戶區正確顯示當前數組數據的移動過程。

代碼片段和文件信息
//?MainFrm.cpp?:?implementation?of?the?CMainframe?class
//
#include?“stdafx.h“
#include?“Sort_Demo.h“
#include?“MainFrm.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CMainframe
IMPLEMENT_DYNCREATE(CMainframe?CframeWnd)
BEGIN_MESSAGE_MAP(CMainframe?CframeWnd)
//{{AFX_MSG_MAP(CMainframe)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static?UINT?indicators[]?=
{
ID_SEPARATOR???????????//?status?line?indicator
ID_INDICATOR_CAPS
ID_INDICATOR_NUM
ID_INDICATOR_SCRL
};
/////////////////////////////////////////////////////////////////////////////
//?CMainframe?construction/destruction
CMainframe::CMainframe()
{
//?TODO:?add?member?initialization?code?here
}
CMainframe::~CMainframe()
{
}
int?CMainframe::OnCreate(LPCREATESTRUCT?lpCreateStruct)
{
if?(CframeWnd::OnCreate(lpCreateStruct)?==?-1)
return?-1;
if?(!m_wndToolBar.CreateEx(this?TBstyle_FLAT?WS_CHILD?|?WS_VISIBLE?|?CBRS_TOP
|?CBRS_GRIPPER?|?CBRS_TOOLTIPS?|?CBRS_FLYBY?|?CBRS_SIZE_DYNAMIC)?||
!m_wndToolBar.LoadToolBar(IDR_MAINframe))
{
TRACE0(“Failed?to?create?toolbar\n“);
return?-1;??????//?fail?to?create
}
if?(!m_wndStatusBar.Create(this)?||
!m_wndStatusBar.SetIndicators(indicators
??sizeof(indicators)/sizeof(UINT)))
{
TRACE0(“Failed?to?create?status?bar\n“);
return?-1;??????//?fail?to?create
}
//?TODO:?Delete?these?three?lines?if?you?don‘t?want?the?toolbar?to
//??be?dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return?0;
}
BOOL?CMainframe::PreCreateWindow(CREATESTRUCT&?cs)
{
//m_strtitle?=?“標題“;?
if(?!CframeWnd::PreCreateWindow(cs)?)
return?FALSE;
//?TODO:?Modify?the?Window?class?or?styles?here?by?modifying
//??the?CREATESTRUCT?cs
cs.cx=600;
cs.cy=800;
return?TRUE;
}
/////////////////////////////////////////////////////////////////////////////
//?CMainframe?diagnostics
#ifdef?_DEBUG
void?CMainframe::AssertValid()?const
{
CframeWnd::AssertValid();
}
void?CMainframe::Dump(CDumpContext&?dc)?const
{
CframeWnd::Dump(dc);
}
#endif?//_DEBUG
/////////////////////////////////////////////////////////////////////////////
//?CMainframe?message?handlers
//DEL?void?CMainframe::onstart()?
//DEL?{
//DEL? //?TODO:?Add?your?command?handler?code?here
//DEL?
//DEL?}
//DEL?
//DEL?
//DEL?
//DEL?
//DEL?
//DEL?void?CMainframe::OnOver()?
//DEL?{
//DEL? //?TODO:?Add?your?command?handler?code?here
//DEL?
//DEL?}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2687??2020-04-12?14:21??Sort_Demo\MainFrm.cpp
?????文件???????1440??2020-04-12?14:25??Sort_Demo\MainFrm.h
?????文件???????4383??2020-04-12?14:21??Sort_Demo\ReadMe.txt
?????文件???????1078??2019-10-20?11:15??Sort_Demo\res\Sort_Demo.ico
?????文件????????403??2019-10-20?11:15??Sort_Demo\res\Sort_Demo.rc2
?????文件???????1078??2019-10-20?11:15??Sort_Demo\res\Sort_DemoDoc.ico
?????文件???????1078??2019-10-20?11:15??Sort_Demo\res\Toolbar.bmp
?????文件????????972??2020-04-12?14:25??Sort_Demo\resource.h
?????文件??????28940??2020-04-12?14:24??Sort_Demo\Sort_Demo.APS
?????文件???????2541??2020-04-12?14:24??Sort_Demo\Sort_Demo.clw
?????文件???????4263??2020-04-12?14:16??Sort_Demo\Sort_Demo.cpp
?????文件???????4618??2020-04-12?14:25??Sort_Demo\Sort_Demo.dsp
?????文件????????526??2020-04-12?14:16??Sort_Demo\Sort_Demo.dsw
?????文件???????1389??2020-04-12?14:17??Sort_Demo\Sort_Demo.h
?????文件??????82944??2020-04-12?14:28??Sort_Demo\Sort_Demo.ncb
?????文件??????48640??2020-04-12?14:28??Sort_Demo\Sort_Demo.opt
?????文件???????1832??2020-04-12?14:28??Sort_Demo\Sort_Demo.plg
?????文件??????12403??2020-04-12?14:18??Sort_Demo\Sort_Demo.rc
?????文件???????1824??2020-04-12?14:18??Sort_Demo\Sort_DemoDoc.cpp
?????文件???????1508??2020-04-12?14:18??Sort_Demo\Sort_DemoDoc.h
?????文件??????10228??2020-04-12?14:18??Sort_Demo\Sort_DemoView.cpp
?????文件???????2553??2020-04-12?14:18??Sort_Demo\Sort_DemoView.h
?????文件????????211??2020-04-12?14:22??Sort_Demo\StdAfx.cpp
?????文件???????1054??2020-04-12?14:22??Sort_Demo\StdAfx.h
?????目錄??????????0??2020-04-12?14:28??Sort_Demo\Debug
?????目錄??????????0??2020-04-12?14:20??Sort_Demo\res
?????目錄??????????0??2020-04-12?14:28??Sort_Demo
-----------?---------??----------?-----??----
???????????????218593????????????????????27
............此處省略0個文件信息
- 上一篇:linux終端c編程練習 大富翁游戲
- 下一篇:MFC日志寫入與讀取
評論
共有 條評論