Hello ppl
I am new to c++ and especially a noob in graphics. All the functions I have learnt are from Help File in Turbo c++ 3.0. Since this part of c++ is not in my course, I am having difficulties learning it.
Now, in the following code the outtext function is not displaying the string passed as argument to it. Instead it seems that it is printing it below the rectangle.
Code:
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<process.h>
#include<dos.h>
void boxout(int xstart,int xend,int ystart,int yend,char item[])
{
setcolor(BLACK);
moveto(xstart,ystart);
outtext(item);
setcolor(LIGHTGRAY);
setfillstyle(SOLID_FILL,LIGHTGRAY);
rectangle(xstart,ystart,xend,yend);
floodfill(xstart+1,ystart+1,LIGHTGRAY);
for(int i=xstart;i<=xend;i++)
{
putpixel(i,ystart,WHITE);
putpixel(i,yend,DARKGRAY);
}
for(i=ystart;i<=yend;i++)
{
putpixel(xstart,i,WHITE);
putpixel(xend,i,DARKGRAY);
}
}
void main()
{
int gdriver=DETECT,gmode,error;
initgraph(&gdriver,&gmode,"");
error=graphresult();
if(error!=grOk)
{
cout<<"Graphics error exiting!";
exit(-1);
}
boxout(1,60,1,20,"Hello");
boxout(61,120,1,20,"World");
setcolor(BLACK);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,1);
getch();
closegraph();
}
Plz need help