Is there a function that draw 2d objects like boxes and circles .
I remember that in qbasic there was a few 2dobjects functions so i thought that there is a chance c will have some too.
Thanks .

Well there are few ASCII character which will help you to draw boxes. You see this extended ASCII chart http://www.asciitable.com/.
Here's an example which i did in my project:

I compilered it in Turbo C++ 3, old one so it wont compile with new compilers. But I have bolded few lines, see that. This will give you a drift

void about()
{
    clrscr();
    header();

    int LEFT    = 20;
    int TOP     = 4;
    int RIGHT   = 60;
    int BOTTOM  = 24;

    window(LEFT, TOP, RIGHT, BOTTOM+1);
    int width = RIGHT - LEFT + 1;
    int height = BOTTOM - TOP + 1;

    for(int j=1; j<=width; j++)
    {
        gotoxy(j, 1);
         [B]putch(char(205));[/B]
        gotoxy(j, height);
         putch(char(205));
    }

    for(j=1; j<=height; j++)
    {
        gotoxy(1, j);
        [B] putch(char(186));[/B]
        gotoxy(width, j);
         putch(char(186));
    }

    gotoxy(1,1)          ;  
       [B]putch(char(201))  ;[/B]
    gotoxy(width, 1)     ;  
       [B]putch(char(187))  ;[/B]
    gotoxy(1, height)    ;  
       [B]putch(char(200))  ;[/B]
    gotoxy(width, height);  
       [B]putch(char(188))  ;[/B]


    window(LEFT+2, TOP+2, RIGHT-2, BOTTOM-2);

    // put strings here only

     gotoxy(10, 3);
    cputs("::ABOUT THE SYSTEM::");
     gotoxy(2, 5);
    cputs(":::: LIBRARY MANAGEMENT SYSTEM ::::");
     gotoxy(4, 9);
    cputs(":: DESIGNED AND DEVELOPED BY ::");
     gotoxy(12, 11);
    cputs("VISHESH YADAV");
     gotoxy(2, 15);
    cputs("   [[ COMPUTER SCIENCE PROJECT ]]   ");
     gotoxy(2, 17);
    cputs("            < 2006-2007 >           ");

    window(LEFT, TOP, RIGHT, BOTTOM+1);
    gotoxy(3, height-1);
    getch();

    clrscr();

    window(1, 1, 80, 25);
    clrscr();

    printMenu();
}

Is there a function that draw 2d objects like boxes and circles .
I remember that in qbasic there was a few 2dobjects functions so i thought that there is a chance c will have some too.
Thanks .

I recently wrote a program and provided the code under the cpluplus code snippet section. It doesn't write circles but I does illustrate how to make an inverted box.. I'll post that program later but take a look at this one, it might give you some ideas. Here is the link http://www.daniweb.com/code/snippet650.html

Ok I've modified that program so that you can choose whether you want an inverted disply or regular.

Good luck, LamaBot

im looking for a way to create a box with pixels .

What is meant by pixel box...err...does it mean not by character but something like what we so n paint and photoshop.....then you have to use some grapgics library.

yeah i know , how can i draw a box using graphics library , and what library should i use

> how can i draw a box using graphics library , and what library should i use
Well you need to start by saying which OS and compiler you're using.

Though I'm going to guess it's Turbo C and XP or some other hopelessly mis-matched combination.

Im using Turbo C / Visual C++ 6.0 and my OS is windows 2000

Code examples which use Turbo C can be found here. Another good tutorial can be found here.

Reference for Turbo C can be found here.

The above resources should be enough to get to started provided you know a fair amount of C programming.

A graphics library borland BGI is included with your Turbo C. The declaration are present in graphic.h file. To view all its members and know how to use it, right click the blue screen i.e. editor, you will find index, find graphics.h.

To make a line there are several functions such as line, linto. This is lineto example:

//

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

int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int xmax, ymax;

   /* initialize graphics and local variables */
[B]   initgraph(&gdriver, &gmode, "\\bc\\bgi");
[/B]/*the third argument must be the path to bgi folder in your tc directly.
 I am using borland c and it is in "bc" folder is in root drive, so its \\bc\\bgi.

   /* read result of initialization */
   errorcode = graphresult();
   /* an error occurred */
   if (errorcode != grOk)
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1);
   }

   setcolor(getmaxcolor());
   xmax = getmaxx();
   ymax = getmaxy();

   /* draw a diagonal line */
   line(0, 0, xmax, ymax);

   /* clean up */
   getch();
   closegraph();
   return 0;
}

I dont remember but I think it comes.

I didn't even used it Turbo C 2006, I had some post installation problem, so tell me if there is any documentation for troubleshooting. I just wanna try it out.

>Anyone know if the 2006 version of Turbo
>C++ comes with that graphics library?
No, Turbo C++ 2006 is a modern development tool. graphics.h is an ancient library that only works on ancient systems. If you want to do graphics, stick to Win32 or .NET. IF you don't like the "evil empire", use Allegro or SDL, or any of the other freely available libraries that actually work on current systems.

>Yeah, I understand it's old
I hear that a lot, but people still try to use graphics.h on Windows XP. Clearly the flow of information is getting interrupted somewhere along the line. :rolleyes:

This article has been dead for over six months. Start a new discussion instead.