数值分析实验插值函数.docx
- 文档编号:153183
- 上传时间:2022-10-04
- 格式:DOCX
- 页数:10
- 大小:10.75KB
数值分析实验插值函数.docx
《数值分析实验插值函数.docx》由会员分享,可在线阅读,更多相关《数值分析实验插值函数.docx(10页珍藏版)》请在冰豆网上搜索。
//LDlg.cpp:
implementationfile
//
#include"stdafx.h"#include"L.h"#include"LDlg.h"
#ifdef_DEBUG
#definenewDEBUG_NEW#undefTHIS_FILE
staticcharTHIS_FILE[]=FILE;#endif
/////////////////////////////////////////////////////////////////////////////
//CAboutDlgdialogusedforAppAbout
classCAboutDlg:
publicCDialog
{
public:
CAboutDlg();
//DialogData
//{{AFX_DATA(CAboutDlg)
enum{IDD=IDD_ABOUTBOX};
//}}AFX_DATA
//ClassWizardgeneratedvirtualfunctionoverrides
//{{AFX_VIRTUAL(CAboutDlg)protected:
virtualvoidDoDataExchange(CDataExchange*pDX); //DDX/DDVsupport
//}}AFX_VIRTUAL
//Implementationprotected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSGDECLARE_MESSAGE_MAP()
};
CAboutDlg:
:
CAboutDlg():
CDialog(CAboutDlg:
:
IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
voidCAboutDlg:
:
DoDataExchange(CDataExchange*pDX)
{
CDialog:
:
DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg,CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//Nomessagehandlers
//}}AFX_MSG_MAPEND_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//CLDlgdialog
CLDlg:
:
CLDlg(CWnd*pParent/*=NULL*/)
:
CDialog(CLDlg:
:
IDD,pParent)
{
//{{AFX_DATA_INIT(CLDlg)
//NOTE:
theClassWizardwilladdmemberinitializationhere
//}}AFX_DATA_INIT
//NotethatLoadIcondoesnotrequireasubsequentDestroyIconinWin32m_hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
voidCLDlg:
:
DoDataExchange(CDataExchange*pDX)
{
CDialog:
:
DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLDlg)
//NOTE:
theClassWizardwilladdDDXandDDVcallshere
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLDlg,CDialog)
//{{AFX_MSG_MAP(CLDlg)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDC_LARGRI,OnLargri)
ON_BN_CLICKED(IDC_BUTTON2,OnButton2)ON_BN_CLICKED(IDC_HERMITE,OnHermite)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//CLDlgmessagehandlers
BOOLCLDlg:
:
OnInitDialog()
{
CDialog:
:
OnInitDialog();
//Add"About..."menuitemtosystemmenu.
//IDM_ABOUTBOXmustbeinthesystemcommandrange.ASSERT((IDM_ABOUTBOX&0xFFF0)==IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX<0xF000);
CMenu*pSysMenu=GetSystemMenu(FALSE);if(pSysMenu!
=NULL)
{
CStringstrAboutMenu;strAboutMenu.LoadString(IDS_ABOUTBOX);if(!
strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING,IDM_ABOUTBOX,strAboutMenu);
}
}
//Settheiconforthisdialog. Theframeworkdoesthisautomatically
// whentheapplication'smainwindowisnotadialogSetIcon(m_hIcon,TRUE); //SetbigiconSetIcon(m_hIcon,FALSE); //Setsmallicon
//TODO:
Addextrainitializationhere
returnTRUE; //returnTRUE unlessyousetthefocustoacontrol
}
voidCLDlg:
:
OnSysCommand(UINTnID,LPARAMlParam)
{
if((nID&0xFFF0)==IDM_ABOUTBOX)
{
CAboutDlgdlgAbout;dlgAbout.DoModal();
}
else
{
}
}
CDialog:
:
OnSysCommand(nID,lParam);
//Ifyouaddaminimizebuttontoyourdialog,youwillneedthecodebelow
// todrawtheicon. ForMFCapplicationsusingthedocument/viewmodel,
// thisisautomaticallydoneforyoubytheframework.
voidCLDlg:
:
OnPaint()
{
if(IsIconic())
{
CPaintDCdc(this);//devicecontextforpaintingSendMessage(WM_ICONERASEBKGND,(WPARAM)dc.GetSafeHdc(),0);
//Centericoninclientrectangle
intcxIcon=GetSystemMetrics(SM_CXICON);intcyIcon=GetSystemMetrics(SM_CYICON);CRectrect;
GetClientRect(&rect);
intx=(rect.Width()-cxIcon+1)/2;inty=(rect.Height()-cyIcon+1)/2;
}
else
{
}
}
//Drawtheicondc.DrawIcon(x,y,m_hIcon);
CDialog:
:
OnPaint();
//Thesystemcallsthistoobtainthecursortodisplaywhiletheuserdrags
// theminimizedwindow.
HCURSORCLDlg:
:
OnQueryDragIcon()
{
return(HCURSOR)m_hIcon;
}
voidCLDlg:
:
OnOK()
{
intx00=300,y00=350,i,j;doublex;
CDC*pDC=GetDC();
pDC->SetMapMode(MM_LOMETRIC);pDC->SetViewportOrg(x00,y00);
//画坐标轴与原函数
for(i=-700;i<=700;i++)
{
pDC->SetPixel(i,0,RGB(0,0,0));
pDC->SetPixel(0,i,RGB(0,0,0));
}
for(x=-1;x<=1;x+=0.001)
{
doublej=400.0/(1+25*x*x);
pDC->SetPixel(x*500,j,RGB(360,0,0));
}
pDC->TextOut(-30,-10,"0");
pDC->TextOut(-30,430,"1");
pDC->TextOut(490,-10,"1");
pDC->TextOut(-490,-10,"-1");
pDC->MoveTo(-10,680); //x箭头
pDC->LineTo(0,700);pDC->MoveTo(0,700);pDC->LineTo(10,680);
pDC->MoveTo(680,10); //y箭头
pDC->LineTo(700,0);pDC->MoveTo(700,0);pDC->LineTo(680,-10);
pDC->TextOut(-30,700,"y");
pDC->TextOut(700,-10,"x");
}
voidCLDlg:
:
OnLargri()
{
intx00=300,y00=350,i,j;doublex;
CDC*pDC=GetDC();
pDC->SetMapMode(MM_LOMETRIC);pDC->SetViewportOrg(x00,y00);
//画坐标轴
for(i=-700;i<=700;i++)
{
pDC->SetPixel(i,0,RGB(0,0,0));
pDC->SetPixel(0,i,RGB(0,0,0));
}
doubleyx[]={-1,-0.8
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数值 分析 实验 函数