C++有问题!!!!! 15

//#include"stdafx.h"#include"DDATest.h"#include"StdAfx.h"#include"DDATestDoc.h"#inclu... //

#include "stdafx.h"
#include "DDATest.h"
#include "StdAfx.h"
#include "DDATestDoc.h"
#include "DDATestView.h"
#include "LineDlg.h"
#include "Line.h"
#include "MainFrm.h"
#define ROUND(a)((int)(a+0.5))

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

// CDDATestView

IMPLEMENT_DYNCREATE(CDDATestView, CView)

BEGIN_MESSAGE_MAP(CDDATestView, CView)
//{{AFX_MSG_MAP(CDDATestView)
ON_COMMAND(ID_DRAWLINE_DDA, OnDrawlineDda)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

// CDDATestView construction/destruction

CDDATestView::CDDATestView()
{
// TODO: add construction code here

}

CDDATestView::~CDDATestView()
{
}

BOOL CDDATestView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs

return CView::PreCreateWindow(cs);
}

// CDDATestView drawing

void CDDATestView::OnDraw(CDC* pDC)
{
CDDATestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}

// CDDATestView printing

BOOL CDDATestView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}

void CDDATestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}

void CDDATestView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}

// CDDATestView diagnostics

#ifdef _DEBUG
void CDDATestView::AssertValid() const
{
CView::AssertValid();
}

void CDDATestView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}

CDDATestDoc* CDDATestView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDDATestDoc)));
return (CDDATestDoc*)m_pDocument;
}
#endif //_DEBUG

// CDDATestView message handlers

void CDDATestView::OnDrawlineDda()
{
// TODO: Add your command handler code here

float x1;
float y1;
float x2;
float y2;

CLineDlg dlg;
if(dlg.DoModal()==IDOK)
{
x1=dlg.m_fXStart;
y1=dlg.m_fYStart;
x2=dlg.m_fXEnd;
y2=dlg.m_fYEnd;
}

CLine * pLine=new CLine(x1,y1,x2,y2);
CDC* pDC=GetDC();

pLine->LineDda(pDC);

void LineDda(float x1,float y1,float x2,float y2)
{int dx=x2-x1,dy=y2-y1,steps,k;
float xIncrement,yIncrement,x=x1,y=y1;

if(abs(dx)>abs(dy))steps=abs(dx);
else steps=abs(dy);
xIncrement=dx/(float)steps;
yincrement=dy/(float)steps;

setPixel(ROUND(x),ROUND(y));
for(k=0;k<steps;k++){
x+=xIncrement;
y+=yIncrement;
setPixel(ROUND(x),ROUND(y));
}
}
}

那位高手能帮我改一下错!!谢谢!!
D:\学习\计算机图形学\DDATest-Frame\DDATestView.cpp(127) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
D:\学习\计算机图形学\DDATest-Frame\DDATestView.cpp(127) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
D:\学习\计算机图形学\DDATest-Frame\DDATestView.cpp(127) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
D:\学习\计算机图形学\DDATest-Frame\DDATestView.cpp(130) : error C2039: 'LineDda' : is not a member of 'CLine'
d:\学习\计算机图形学\ddatest-frame\line.h(15) : see declaration of 'CLine'
D:\学习\计算机图形学\DDATest-Frame\DDATestView.cpp(133) : error C2373: 'LineDda' : redefinition; different type modifiers
D:\学习\计算机图形学\DDATest-Frame\DDATestView.cpp(133) : error C2601: 'LineDda' : local function definitions are illegal
执行 cl.exe 时出错.
展开
 我来答
ustbduanhang
2007-09-26 · TA获得超过1896个赞
知道大有可为答主
回答量:2587
采纳率:0%
帮助的人:1789万
展开全部
改错得把include的头文件也发上来看看.自己写的还是自带的.自带的就没问题了.
百度网友8450092a6
2007-09-26 · TA获得超过2632个赞
知道小有建树答主
回答量:1593
采纳率:0%
帮助的人:0
展开全部
错误提示贴出来
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
ddjsh
2007-09-26 · TA获得超过158个赞
知道小有建树答主
回答量:576
采纳率:0%
帮助的人:166万
展开全部
你把头文件,也拿出来,我给你改.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
西域乖狼
2007-09-27
知道答主
回答量:15
采纳率:0%
帮助的人:0
展开全部
void LineDda(float x1,float y1,float x2,float y2)
是成员函数,
你怎么给弄成成员函数了?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式