想在visual studio 2010 console c ++中绘制简单的形状,如圆形,矩形

时间:2010-08-07 10:10:08

标签: c++

Hya,

抱歉新手问题,我试图在VS2010控制台c ++中创建简单的圈子,我也看了谷歌但有些提供了库,有些提供了源代码msoftcon.h等,但我仍然无法绘制一个简单的圈子。一个msoftcon成功构建,但它仍然没有绘制圆圈只是用'U'填充控制台窗口

如果有人可以帮助我,我会很高兴。

感谢

2 个答案:

答案 0 :(得分:0)

//Circles as graphics objects
//Code from R. Lafore "OOP with C++
//
#include "msoftcon.h"           //for graphics function

struct circle
   {
   int xCo, yCo;                //coordinates of center
   int radius;
   color fillcolor;             //color
   fstyle fillstyle;            //fill pattern
   };

void circle_draw(circle c)
   {
   set_color(c.fillcolor);              //set color
   set_fill_style(c.fillstyle);         //set fill pattern
   draw_circle(c.xCo, c.yCo, c.radius); //draw solid circle
   }

int main()
   {
   init_graphics();                     //initialize graphics system

   circle c1 = {15, 7, 5, cBLUE, X_FILL};
   circle c2 = {41, 12, 7, cRED, O_FILL};
   circle c3 = {65, 18, 4, cGREEN, MEDIUM_FILL};

   circ_draw(c1);                       //draw circles
   circ_draw(c2);
   circ_draw(c3);
   set_cursor_pos(1, 25);               //cursor to lower left corner

   return 0;
   }

答案 1 :(得分:0)

如果我正确阅读了这个问题,你就无法在任何控制台或终端“窗口”中绘制“形状”。它们是纯文本的。 ASCII“艺术”不计算在内。 : - )

HTH

相关问题