2010-08-07 256 views
-1

Hya星長方形,想畫一些簡單的形狀,如圓形,在VisualStudio的2010控制檯C++

抱歉的新手問題,我想創建於VS2010控制板C簡單的圓形++,還我看着谷歌,但一些提供圖書館,一些提供的源代碼msoftcon.h等,但仍然無法畫出一個簡單的圓圈。一個msoftcon成功建立,但仍然沒有繪製一個圓圈,只是用'U'填充控制檯窗口

i'如果有人能幫助我,我會很高興。

感謝

+1

你究竟想要做什麼?問題的標題似乎意味着你正在試圖在控制檯中繪製。 – 2010-08-07 10:15:28

+0

我想要一個控制檯C++的源代碼,在沒有任何庫的情況下執行此操作,或者如果提供了庫,請給我調色板,以便我可以繪製它。 – M3taSpl0it 2010-08-07 11:05:20

+0

也許嘗試OpenGL。 – anno 2010-08-07 12:58:18

回答

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; 
    } 
+0

是的,我試過這個源代碼,但控制檯窗口充滿字符'U',沒有出現圓圈:( – M3taSpl0it 2010-08-07 16:25:20

0

如果我讀了這個問題正確的,你不能得出任何控制檯或終端「形狀」,「窗口」。它們是純文本的。 ASCII「藝術」不算。 :-)

HTH