Hey friends i just want some help....well got a simple task this weekend to make a rings of different colors using circles....like i want an output in which a circle appear on top left and after little delay another one appear near to the first one...and so on......and all should be in different colors...

i have made a program using multiple circle commands in loops but just want to compact it...

so what should i do to make a loop which uses one command of circle(x,y,radius) and with a difference of say 10,5 make another and so on....

i`m sorry that this simple things ain`t not comin to my mind...please an c++ champion who can help...just tell me the loop coding !!

cheers !!

Recommended Answers

All 4 Replies

can you post your program.

i think in your problem random function will help

ok i`ll post the program soon !!

Hi friend I am a class XII, R.S.A.
Here is the code you required:
//developed by R.S.A.
#include<graphics.h>
#include<dos.h>
#include<conio.h>
#include<stdio.h>
#include<figures.h>
#include<stdlib.h>
void main()
{
textbackground(RED);
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
static int i=19,j=0,r=18;
for(int a=0;a<=100;a++)
{
if(i<500)
{
setcolor(random(10));
circle(i,j,r);
i=i+36;
}
if(i>=500)
{
i=19;
j=j+36;
setcolor(random(10));
circle(i,j,r);
}
sleep(1);
if(kbhit())
exit(0);
}
getch();
}

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.