Hi! I need help to my Turbo C program.. I need to create a program that will ask the "Starting X:", "Starting Y:", Ending X:", and Ending Y:" on different shapes.. this is how the program should be:

SQUARE:
starting X:
starting Y:
ending X:
ending Y:

CIRCLE:
Starting X:
Ending Y:
Radius:

LINE:
Starting X:
Ending Y:

and also

POLYGON:

...the user will write numbers in starting X, starting Y, ending X, ending Y, and radius, after encoding the numbers, the result will create the shape that the user chose and according to their X and Y and radius of the program.

* I dont really have any idea how to start with it. I'm just a beginner and need some hand to help me. I understand if you don't want to give away code because I'm not show my effort as a starting point. You can give me some link about this program, if you'd like to. (^_^) thanks..

You have codes for all of this and much more, if you have Turbo C! No one has to give you anything. :)

Start up Turbo C/C++, and select "file" and "new". Now click on "File" again, and "save as". Give your file a short 8 character or less name, and be sure to end it with .c and save it with that filename.

Now press Ctrl +F1 to bring up the help index. Type "poly" to see help and an example of making a polygon. Then press alt +F1, to go back to the main menu. Type circle or line, and repeat.

Now what I'd do if I were new to it, is copy each one of these help pages, into your new program, and put them in between
/*
and
*/

so they won't bother the compiler. Do that for each one of these help pages.

Now, they're right there, and you can refer to them all at once, if you want, very quickly.

There is no function to draw a square or box, however. For that you can draw four lines, or perhaps use poly().

There are box drawing char's in the upper part of the ASCII code. Get out your ASCII char. They have both a single line box drawing char, and a double line box drawing char. That includes all 4 corners, which are each different char's, btw.

Drawing figures can be slow and time-consuming at first (it's just slow after that :p ), so give yourself plenty of time to work with this.

If you don't have an ASCII chart of the upper values, google one up (there are scads of them listed). You need one with values which include 196, at least. (hint, hint) ;)

Enjoy!

You want to do this in Windows, in Dos, Linux?

------------------

Windows.. I'm using borland turbo C++.. do u have any idea about this problem.? i'm so desperately need some example of it.. :'(

------------------

Windows.. I'm using borland turbo C++.. do u have any idea about this problem.? i'm so desperately need some example of it.. :'(

Using the Free Borland 5.5 command line compiler?

Which version?

Using Borland C++ Builder?

Using the Free Borland 5.5 command line compiler?

Which version?

Using Borland C++ Builder?

-------------------------------------------


I'm using the very very old one,

Turbo C++ Version 3.0. Borland Int.

I know this turbo is very old but it requires this in our school.. ;'(

so, guys can you help me now and stop arguing about what version I'm using,? I just need an example for my program.. I really need it.. :'( Please?

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

int main()
{
     int x1, y1, x2, y2 ;
     char String[80] ;
     printf ("Enter Starting X: ") ;
     gets(String) ;
     x1 = atoi(String) ;
     printf("Enter Starting Y: ") ;
     gets(String) ;
     y1 = atoi(String)  ;
/* ......
    */
     rectangle (x1, y1, x2, y2) ;
     return 0 ;
}
/* that's basically it. I downloaded the Turbo C++ 3.0 IDE. Looks like a free download. But it generates an error linking rectangle.  Running on Windows 2000: undefined symbol _rectangle in graphics.cpp (the name of my source file).  But like the previous poster suggested, the example code given in the help file should be your best source of help. Maybe someone with more experience with this compiler could help you get around the error message here in the linking. Found a post. In the IDE you need to make sure the Graphics Libraries is checked from the Menu: Options>Linker>Libraries!*/

That's the general idea. But that should get you started. After checking the Graphics Library in the options menu, the program compiled, linked, and ran and actually drew a rectangle. Pretty cool for an old IDE. Reminds me of that video I saw on YouTube of this guy who hooked up an ancient 300 baud per second analog modem. He put the phone on microphones to receive and transmit the audio. And then he hooked it up to the current world wide web and using a linux box and used lynx to view a wiki page. It really worked. I wonder if you could include the header files from the Server 2003 SDK and use this thing to compile Windows GUI programs?

Hank

gets(String) ;

Don't recommend the use of gets. It can take input until the cows come home and tries to write it all to that array--> overrun. Use fgets instead.

commented: thank you +6

The pertinent and useful posts in this thread have been moved here. Maybe aianne can now start getting help without being railroaded into useless arguments. Keep it on topic. Go back to the other thread for arguing.

[edit]
Post ONLY help for aianne here. Continue the argument in the other thread. Posted here, they will be deleted.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.