How can i draw concentric cirles in c++ with a user inputed radii?

Recommended Answers

All 7 Replies

Depending on your needs: are you using a dedicated software for drawing shapes, or are you trying this in a simple fashion way of dots, or?...

i am using dev-c++ and my compiler is mingw32

and can i change font size in output?
as in that one line is in a font size bigger than standard size while the others are in standard size
like a heading

Drawing on the screen is complicated. Let's go back a step.

C++ doesn't know what a monitor is. It doesn't know about colours, or lines, or the keyboard, or what a mouse is, or anything like that. All that is handled by your operating system. If you want to draw pictures on the screen, you essentially ask the operating system nicely to do it for you.

So anything like this you want to do depends on your operating system. I'm guessing you're using Windows. You have two choices; either you ask Windows to do it (which is complicated but has fine control) using the Win API, or you get another piece of software - you ask that software (which is simple) and it asks the operating system for you.

So now you have some understanding of what to do, and a couple of search terms to get started with on google.

allright friends, i got it
here is the source code-

#include <graphics.h>

main( )
    initwindow(400, 300, "cicle");                            //(width, height, title) 
    circle(100, 50, 15);                                      //(x, y, radius)
    circle(100, 50, 10);
    while (!kbhit( ))

/* Linkers: -lbgi                           //Whenever you #include <graphics.h> in a program,
            -lgdi32                         //you must instruct the linker to link in certain
            -lcomdlg32                      //libraries. The command to do so from Dev-C++ is
            -luuid                          //Alt-P. Choose the Parameters tab from the pop-up
            -loleaut32                      //window and type the following into the Linker area

thnx :D

commented: gr8 code +0

Ah, the graphics.h header and associated library.

For anyone wondering, graphics.h was originally a header (and associated library) that came with Borland software about thirty years ago for a 16-bit DOS OS. Over the last three decades, people have kept it alive by making it over and over again for other systems.

However, given that this particular code allows such brutal (and wrong) code as main( ), it could be almost anything!

actually, i find this code quite useful.
i surfed the net trying to find how to make circles for my project,
and everywhere the code was so complicated that i couldnt understand a thing.
but this code is highly understandable.
kudos to oosinoots! :D

Be a part of the DaniWeb community

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