早教吧作业答案频道 -->其他-->
如何为以下段落定义Cpointpt和CDC*pDCvoidCTesttwoView::drawstar(Cpointpt,CDC*pDC){doubleg1=0.314;doubleg2=0.628;CPointpt[2]((Nx-nLength*sin(g1)),(Ny+nLength*cos(g1)));CPointpt[3]((Nx+nLength*sin(g1)),(Ny+nLength*cos(g1)));CPoint
题目详情
如何为以下段落定义Cpoint pt和CDC *pDC
void CTesttwoView::drawstar(Cpoint pt,CDC *pDC)
{
double g1=0.314;
double g2=0.628;
CPoint pt[2]((Nx-nLength*sin(g1)),(Ny+nLength*cos(g1)));
CPoint pt[3]((Nx+nLength*sin(g1)),(Ny+nLength*cos(g1)));
CPoint pt[4]((Nx+nLength*cos(g2)),(Ny-nLength*sin(g2)));
CPoint pt[5]((Nx-nLength*cos(g2)),(Ny-nLength*sin(g2)));
pDC-> MoveTo(pt);
pDC-> LineTo(pt[2]);
pDC-> LineTo(pt[4]);
pDC-> LineTo(pt[5]);
pDC-> LineTo(pt[3]);
pDC-> LineTo(pt);
我按你们说的把程序这段变为:
CPoint pt2((pt.x-nLength*sin(g1)),(pt.y+nLength*cos(g1)));
CPoint pt3((pt.x+nLength*sin(g1)),(pt.y+nLength*cos(g1)));
CPoint pt4((pt2.x+nLength*cos(g2)),(pt2.y-nLength*sin(g2)));
CPoint pt5((pt3.x-nLength*cos(g2)),(pt2.y-nLength*sin(g2)));
错误:(44) :error C2061:syntax error :identifier 'Cpoint'
(430) :error C2511:'drawstar' :overloaded member function 'void (class CPoint,class CDC *)' not found in 'CTesttwoView'
本人C++新手,请问应该怎么解决?
void CTesttwoView::drawstar(Cpoint pt,CDC *pDC)
{
double g1=0.314;
double g2=0.628;
CPoint pt[2]((Nx-nLength*sin(g1)),(Ny+nLength*cos(g1)));
CPoint pt[3]((Nx+nLength*sin(g1)),(Ny+nLength*cos(g1)));
CPoint pt[4]((Nx+nLength*cos(g2)),(Ny-nLength*sin(g2)));
CPoint pt[5]((Nx-nLength*cos(g2)),(Ny-nLength*sin(g2)));
pDC-> MoveTo(pt);
pDC-> LineTo(pt[2]);
pDC-> LineTo(pt[4]);
pDC-> LineTo(pt[5]);
pDC-> LineTo(pt[3]);
pDC-> LineTo(pt);
我按你们说的把程序这段变为:
CPoint pt2((pt.x-nLength*sin(g1)),(pt.y+nLength*cos(g1)));
CPoint pt3((pt.x+nLength*sin(g1)),(pt.y+nLength*cos(g1)));
CPoint pt4((pt2.x+nLength*cos(g2)),(pt2.y-nLength*sin(g2)));
CPoint pt5((pt3.x-nLength*cos(g2)),(pt2.y-nLength*sin(g2)));
错误:(44) :error C2061:syntax error :identifier 'Cpoint'
(430) :error C2511:'drawstar' :overloaded member function 'void (class CPoint,class CDC *)' not found in 'CTesttwoView'
本人C++新手,请问应该怎么解决?
▼优质解答
答案和解析
pt就是一个起始点(看上去像是你五角星的顶点),随便设置一个起始点,比如 CPoint pt(100,200).pDC可以是本身view的DC,或者其他窗口的DC,看你想画在哪儿了.
如果想获得本身的DC,就调用GetDC()获得.
还有你代码中pt[2],pt[3]...我觉得不应该是数组,应该是pt2,pt3
如果想获得本身的DC,就调用GetDC()获得.
还有你代码中pt[2],pt[3]...我觉得不应该是数组,应该是pt2,pt3
看了 如何为以下段落定义Cpoin...的网友还看了以下:
利用和差角公式化简(2)sin(π/3+α)+sin(π/3-α)(2)sin(π/3+α)+sin 2020-03-30 …
已知关于x的方程x∧2+xcosαcosβ+cosγ-1=0的两个根为x1x2,且满足x1+x2= 2020-04-27 …
若θ为第二象限角,则sin(cosθ)与cos(sinθ)的大小关系是标答:∵θ是第二象限角,∴- 2020-05-14 …
三角函数证明题sinα-cosα+1/sinα+cosα-1=1+cosα/cos能不能用能不能用 2020-06-10 …
已知sinα+cosα=-1/5,求下列各式的值(0<α<π)①sinαcosα②sinα-cos 2020-07-20 …
求证tanα/2=sinα/(1+cosα)=(1-cosα)/sinα看到这样一个答案1.求证t 2020-07-20 …
急cos(6θ)cos(2θ)sin(4θ)sin(6θ)sin(8θ)cos(θ)cos(5θ) 2020-07-22 …
如何为以下段落定义Cpointpt和CDC*pDCvoidCTesttwoView::drawst 2020-07-23 …
积化和差和和差化积的推导这8个公式好像都是由一个公式推导来的.积化和差公式:sinαsinβ=-[ 2020-08-02 …
什么是诱导公式?我想知道什么样的公式就能称为诱导公式,其命名规则是什么?我不要这些:sin(π-α 2020-08-02 …