Thread: Need serious help with a circle program

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    9

    Need serious help with a circle program

    I've had some serious trouble writing a program that creates a circle, and larger circles around that one depending on how many the user inputs.

    the user enters the number of circles he/she wants and then it goes into this while loop...

    say x = 1.5 at start and r = .5

    while(num>0)
    {
    Movepen(1.5, x);
    DrawArc(r, 0, 360);
    x =+ .2;
    r =+ .2;
    num--;
    }

    but this doesn't work! i don't get it. any help would be appreciated, even if you write the program for me, i just want to understand how to do this!

    oh yeah... x and r are floating point variables and there is an InitGraph() function in there

    and most the time i only get 2 circles no matter how many i enter.
    thanks

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    rofl.... i'm sorry, it's just the stupidest mistake, everyone makes them, but its funny when they foul up your hard earned time...

    anyway:
    r=+ .2;
    x=+ .2;

    means r = .2
    x = .2
    what you want is:

    r += .2;
    x += .2;

    you get only 2 circles because x and r are at their starting values, then they're both .2 for all loops afterward

    //edit: oh, wait, you need "serious" help. look elsewhere
    Last edited by ygfperson; 04-20-2002 at 11:43 AM.

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    9
    oh my god! i'm such a dumbass, thankyou for your help! i've been working on this for a week!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. ok need help with circle program
    By southeastkyguy1 in forum C++ Programming
    Replies: 15
    Last Post: 11-09-2006, 07:18 PM
  3. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM