Sample – Program to construct a 3-dimensional bar.

by Nideesh C on February 8, 2011 · 0 comments

in C++




#include <conio.h>
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>

void main (int)
{
int gdriver=DETECT,gmode,errorcode; //Requesting auto-detection.
int midx,midy,x;
//Initializing graphics and local variables.
initgraph(&gdriver,&gmode,”d:\\bc3\\bgi”);
//Reading result of initialization.
errorcode=graphresult();
if(errorcode!=grOk)
//An error occurred.
{
printf(“Graphics error occurred : %s \n”,grapherrormsg(errorcode));
printf(“Press any key to stop : “);
getch();
exit(1); //Terminate the program due to error.
}

setfillstyle(EMPTY_FILL,0);
/*The above statement means that the setfillstyle function is used to
set the fill style of the 3-d bar as a blank.*/
bar3d(200,200,300,450,10,1);
getch();
closegraph();
}

This graphics program outputs a rectangular slab (cuboid) on the screen using the ‘bar3d’ command.

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. Sample – Program to change the foreground colors and draw circles on the screen.
  2. Sample – Program to change the background colors on the screen.
  3. Sample – Program to write in different fonts on the screen.
  4. Sample – Program to draw circles.
  5. Sample – Program to draw 2 rectangles and fill 1 of them.

Leave a Comment

Previous post:

Next post: