Drawing & Graphics
We can draw a shap using characters and strings:
#include <iostream.h>
#include <string.h>
void main()
{
for(int r=0;r!=5;++r)
{
for(int c=0;c!=10;++c)
{
cout<<"*";
}
cout<<"*"<<endl;
}
}
Or draw a shap using graphics:
#include <graphics.h>
#include <conio.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd, &gm, "c:/tc/bgi ");//path to graphics drivers (*.BGI)
circle(250,160,100);//draw a circle: X=250, Y=160
getch();
closegraph();
restorecrtmode();
} |