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..

Recommended Answers

All 39 Replies

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!

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 want to do this in Windows, in Dos, Linux?

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?

@aianne
I would recommend you scrap that compiler (which supports non-standard header files) and get yourself a new one that supports C99
I would recommend Code::Blocks.

@aianne
I would recommend you scrap that compiler (which supports non-standard header files) and get yourself a new one that supports C99
I would recommend Code::Blocks.

You don't know WTF you're talking about!

Turbo C/C++ has EVERYTHING already laid out for her, in the help file - with example programs of EVERYTHING she has to do, except the square - (which is just draw 4 lines)

All she has to do is use her keyboard, and I gave her the keystrokes even to use, in the Turbo C/C++ IDE, to find what she needs, inside the help file.

I don't know why she is unable or unwilling to do this.

Code::Blocks may be nice, but for this assignment, Turbo C/C++ has all the easy answers.

commented: lighten up the hostile tone. his suggestion is relevant and politely addressed the larger issue, if not the immediate solution. -1

Using the Free Borland 5.5 command line compiler?

Borland 5.5 is not a Turbo compiler. Turbo stopped at ver 4.

@aianne
I would recommend you scrap that compiler (which supports non-standard header files) and get yourself a new one that supports C99
I would recommend Code::Blocks.

And how does that help with polygons, squares and circles? Does CODE:Blocks even have graphics? Turbo does.
You need to understand the persons needs before suggesting things they can't use...

You don't know WTF you're talking about!

Calm down. When most people here see the name Turbo they have a knee-jerk reaction. They don't bother to think that it just might be possible that TurboC++
- is actually best for the task at hand (as you point out)
- is the instructor's pet compiler because he's a hack
- has all the non-standard functions required by the hack that is teaching the class.

It's not their fault (the knee-jerkers). They just feel that using 20 year old compilers is a bad thing*.

*it kinda is a bad thing, but with TurboC you can get an understanding of the graphics concepts that you can't get with most other compilers. And without adding and linking outside products.

Turbo C/C++ has EVERYTHING already laid out for her, in the help file - with example programs of EVERYTHING she has to do

Then people might become more susceptible to the ..uh.. "copy-pasting" disease

Does CODE:Blocks even have graphics? Turbo does.

No, seriously. Didn't know about all this. Will most probably start next semester. Was about to uninstall it.

You can't even install TC on MS-Windows version Vista or Win7. I tried it and it doesn't work. IMHO TurboC/C++ is a great compiler for hobbyists and teenagers or pre-teens. But in order to use it you must have an old version of MS-Windows or MS-DOS installed. Professional programmers wouldn't even think of using that compiler.

TC1 seems to work on Win7. At least the compiler executes.

I can't install it

I didn't try to install. I just ran the compiler. Maybe I'm even more old school than you...

I can't run the compiler if it isn't installed first. All I have are the cab files you see in the picture I posted.

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?

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


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?

I'm using the even older, Turbo C/C++ version 1.01 from Borland International, and I have *already* told you exactly where your answers can be found -

***One More Time***:

You already have examples of the programs you need, right in your help files!!

Read my earlier post (not the previous post of mine, but my post before that one). The details of the keystrokes may be different for version 3.0, but the help files will be there. All you have to do is copy and paste into your new program, remove the duplicate include lines and such, and add a small amount of user input.

I am NOT going to make your program for you. Either you get to work and show it, or you will get nothing more from me.

commented: Good :) +27

And how does that help with polygons, squares and circles? Does CODE:Blocks even have graphics? Turbo does.

Code Blocks has plenty of graphics. It provides integrated support for modern, cross-platform, industry-sanctioned graphic libraries, like GTK+, OpenGL, Win32::GUI, and wxWidgets.

not this archaic kid's toy of <graphics.h> used only by children, DOS Luddites, and university students from the Subcontinent.

Code Blocks has plenty of graphics. It provides integrated support for modern, cross-platform, industry-sanctioned graphic libraries, like GTK+, OpenGL, Win32::GUI, and wxWidgets.

not this archaic kid's toy of <graphics.h> used only by children, DOS Luddites, and university students from the Subcontinent.

In other words, no, it doesn't have graphics. And it's also not what the instructor requires. So -- get an A and use the compiler the instructor wants, or get an F for using a compiler that's not authorized and spend 3 weeks getting a graphics package installed and learning how to draw a point.

Please understand that Turbo, no matter how old
1) is in use
2) works
3) is not going to get replaced because you don't like it.
And stop regurgitating hatred for something you've go no business even commenting on. It's getting old.

- is the instructor's pet compiler because he's a hack

What did you mean by 'he's a hack'?

What did you mean by 'he's a hack'?

The instructor is an idot who has no clue how to produce modern C or C++ programs with modern compilers. He probably learned how to teach on an old 20-year-old computer and MS-DOS 3.1 with Turbo C, which was one of the best at that time.

Universities should be teaching students the art of modern computer programming with modern compilers and modern operating systems. What is that instructor doing?? Answer: He is teaching students how to use 25-year old technology that no one in industry uses today. And that is really unfortunate for the students because it means they will have to teach themselves what the university should have, but failed, to teach them. How in the hell can someone from that university get a job writing programs for modern software houses?

commented: Well said - students are being robbed by being taught fossil-ware +19

Please understand that Turbo, no matter how old
1) is in use
2) works
3) is not going to get replaced because you don't like it.

And stop regurgitating hatred for something you've go no business even commenting on. It's getting old.

"in use" ? really? where?? name for me a credible software company that uses Turbo C to develop meaningful, widely-distributed software for the commercial sector.

"it works" ... hey that's a good criteria ... an abacus works, too. perhaps we should teach business students how to balance ledgers with an abacus. and, by the way, don't let your definition of "Turbo C works" include crazy things like multithreading.

"wont get replaced because you don't like it"... hey, i'm a one-man army on a mission from god.

"stop regurgitating ... got no business ... getting old" how about we look through the past month or two of your posts and count the number of rants where you go off on people for using Turbo C. i'm noticing you have a pattern of harassing members for the exact same behavior you engage in yourself. :icon_rolleyes:

.

commented: "It's a 106 miles to Chicago, we've got a full tank of gas, half a pack of cigarettes; it's dark, and we're wearing sun glasses. Hit it!" +19
#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: Yes! +19

Don't recommend the use of gets.

I'm aware of that. But I just think that the user needed some simple help. But to get the user started, it helps to not get them bogged down in all the fine details.

A drowning man isn't concerned about the method. He just wants someone to throw out the lifeline.

commented: That's not help. It is not simple and it is not worth invoking. -2

hey, i'm a one-man army on a mission from god.

J, Have you been talking to god again?

You remember what the nice doctor said about talking to god, last time?

;) ;) ;)

I'm aware of [ the problem with "gets" ]. But I just think that the user needed some simple help. But to get the user started, it helps to not get them bogged down in all the fine details.

i hear what you're saying, but sorry man, but you're totally wrong in this case.

there is sometimes value to keeping things simple.... For instance one could make an argument about using "rand() % 6" to roll a die, rather than getting "bogged down" in the finer points on the nature of pseudo-random generators.

but the ugliness of gets(), the pure incompetence behind using it, is beyond any considerations of simplicity. if there is ever one universally agreed upon rule in C programming, it's this: never. use. gets().

if you want to put a huge hole in your programs, no one will stop you, but shouldn't admit it in public, and absolutely never recommend it to new users who likely don't know any better.

I'm just funnin' with ya, J.

gets() should be long gone.

gets is still in the documentation. It works.

I wouldn't go so far as to say that it's wrong.

I would say that it's not safe, not recommended, not the best way to do things.

But it works. But it sounded like the user was having difficulty with just the basics. So I would recommended the simple form of returning an integer using gets just to get the ball rolling and encourage the new programmer with some concrete results without having to be further discouraged and confused by using a more complicated--albeit safer--method of returning an integer to use with rectangle.

But I really doubt that this beginner's program was going to lead to future pitfalls that would cause some corporate disaster ultimately leading to the downfall of civilization. Of course I might be wrong. Maybe the user should use fgets?

commented: just stop now. you're only making yourself look dumber. -1

fgets(buf, n, stdin) is just as easy as gets(buf) . It's more keystrokes but that is not a function of ease. It's also safer, that's why we recommend it. Too many people come whining to us with errors caused by gets() .

And no, if something allows errors to happen it doesn't work.

commented: Nice +19
commented: Worth pointing out. +8
commented: Absolutely +27
commented: I wet myself when I read this. +11
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.