Thread: Can anyone help me with a while loop?

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    4

    Can anyone help me with a while loop?

    I am having problems with a while loop. I have a .pdf file of what I amtrying to do. Maybe I could email it to someone and get some help or chat on AIM or MSN. Can anyone help?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Post your question here, with a sample bit of code. Give as much detail as possible about what you're trying to achieve, what you've tried so far, and where you think you might be going wrong. The code you provide should be a snippet, detailing this problem only (ie don't post your complete source, just the stuff that's relevant). If you're getting errors from your compiler, post those to. Someone will help you.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Maybe you could explain what sorts of problems you are having with your while loop.

  4. #4
    Registered User
    Join Date
    Oct 2005
    Posts
    4
    We are trying to make a chart with months in column A starting at 1 going to 36. Addin gone each time.

    So far we have

    ......
    Code:
    { 
    	while (MONTH<=36)
    	{printf("%d\n",MONTH);
    	MONTH ++;}
    }
    
    
    no errors on complier, just not working

  5. #5
    Registered User
    Join Date
    Oct 2005
    Posts
    4
    We are trying to make a chart with months in column A starting at 1 going to 36. Addin gone each time.

    So far we have

    ......
    Code:
    { 
    	while (MONTH<=36)
    	{printf("%d\n",MONTH);
    	MONTH ++;}
    }
    no errors on complier, just not working

  6. #6
    Registered User
    Join Date
    Oct 2005
    Posts
    53
    Why don't you use 'for'?
    Code:
    for (month=1;month<=36;month++){
    printf("%d\n", Month);

  7. #7
    Registered User
    Join Date
    Oct 2005
    Posts
    4
    Quote Originally Posted by Alastor
    Why don't you use 'for'?
    Code:
    for (month=1;month<=36;month++){
    printf("%d\n", Month);

    Where would the for statement go?

    When we use ++ our error no says needs 1 value

  8. #8
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. nested loop, simple but i'm missing it
    By big_brother in forum C Programming
    Replies: 19
    Last Post: 10-23-2006, 10:21 PM
  2. While loop misbehaving (or misunderstanding)
    By mattAU in forum C Programming
    Replies: 2
    Last Post: 08-28-2006, 02:14 AM
  3. loop in a linked linked lists
    By kris.c in forum C Programming
    Replies: 6
    Last Post: 08-26-2006, 12:38 PM
  4. while loop help
    By bliznags in forum C Programming
    Replies: 5
    Last Post: 03-20-2005, 12:30 AM
  5. loop issues
    By kristy in forum C Programming
    Replies: 3
    Last Post: 03-05-2005, 09:14 AM