c语言,输入两个点,用星星打成一条直线。求源代码?
的有关信息介绍如下:我用VC6实现了。关键代码如下:1、获得五个外顶点的坐标:int m_xw[5]; //5个X外顶点坐标int m_yw[5]; //5个Y外顶点坐标void CMyTestView::getCoord(){int c = 360 / 5; //角度int r = 150;for (int i = 0; i < 5; i++){m_xw[i] = (int) (cos(i * c * PI / 30 - PI / 2) * (r) + r);m_yw[i] = (int) (sin(i * c * PI / 30 - PI / 2) * (r) + r);}}2、画线段:在构造函数中调用求顶点坐标的函数求顶点坐标:this->getCoord();然后直接在绘图函数中添加如下代码:void CMyTestView::OnDraw(CDC* pDC){CMyTestDoc* pDoc = GetDocument();ASSERT_VALID(pDoc);// TODO: add draw code for native data herepDC->MoveTo(m_xw[4], m_yw[4]);pDC->LineTo(m_xw[1], m_yw[1]);pDC->LineTo(m_xw[3], m_yw[3]);pDC->LineTo(m_xw[0], m_yw[0]);pDC->LineTo(m_xw[2], m_yw[2]);pDC->LineTo(m_xw[4], m_yw[4]); }//运行结果