Help!!!!!! Its easy but i cant get it to work

This is a discussion on Help!!!!!! Its easy but i cant get it to work within the C Programming forums, part of the General Programming Boards category; How can i write a program that creates a printout of ANY calendar month of 2008 (i.e. Jan, Feb, Mar, ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    3

    Smile Help!!!!!! Its easy but i cant get it to work

    How can i write a program that creates a printout of ANY calendar month of 2008 (i.e. Jan, Feb, Mar, etc).

    please tell im stuck i have done this so far
    Code:
    /* A program that creates a printout of ANY calendar 
    month of 2008 (i.e. Jan, Feb, Mar, etc). 
    Written By: Saad Aslam 
    Date: 03/08/2008 
    */ 
    
    #include <stdio.h> 
    #include <stdlib.h> 
    
    void printMonth (int startDay, int days); 
    
    int main (void) 
    
    { 
    printMonth (2,31); 
    return 0; 
    
    } 
    
    void printMonth (int startDay, int days); 
    int weekDay; 
    printf("Jan 2008"); 
    printf("Sun Mon Tues Wed Thus Fri Sat\n"); 
    printf("-----------------------------\n"); 
    
    for (weekDay = 0; weekDay < startDay; weekDay++) 
    printf(" "); 
    
    for ( int dayCount = 1; dayCount <= days; dayCount ++) 
    { 
    if (weekDay >6) 
    { 
    printf("\n"); 
    weekday = 1; 
    } 
    else 
    weekDay++; 
    printf("%3d" dayCount); 
    } 
    printf ("\n----- ----- ----- ------- ------\n") 
    return; 
    }

  2. #2
    Registered User
    Join Date
    Mar 2008
    Posts
    3
    please help its worth 50 points in my test

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    And how many of those points would I get?

    Anyway, pay more attention to spaces, to the number 7, and figure out how to tell what day of the week any month in 2008 started on.

  4. #4
    Registered User
    Join Date
    Mar 2008
    Posts
    3
    i mean idont really know C. im stuck and blanked out.. please help

  5. #5
    uint64_t...think positive xuftugulus's Avatar
    Join Date
    Feb 2008
    Location
    Pacem
    Posts
    355
    That's bad for you... you should learn to earn 50 points. Failing the test might be a good idea. And next time you are in a test unprepared, at least show some respect for yourself and leave.
    Code:
    ...
        goto johny_walker_red_label;
    johny_walker_blue_label: exit(-149$);
    johny_walker_red_label : exit( -22$);
    A typical example of ...cheap programming practices.

  6. #6
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    If you don't really know C then it's not exactly easy then is it?

    Research some time algorithms, ie get the # of days in a month, the starting day of the month and work from there. Once you know those 2 things, it's rather trivial.

  7. #7
    uint64_t...think positive xuftugulus's Avatar
    Join Date
    Feb 2008
    Location
    Pacem
    Posts
    355
    If you are on any unix, start by doing:
    > man man
    then you should be able to use things like:
    > man printf
    > man stdlib.h
    If you can read fast during your test, you might even pass.
    Code:
    ...
        goto johny_walker_red_label;
    johny_walker_blue_label: exit(-149$);
    johny_walker_red_label : exit( -22$);
    A typical example of ...cheap programming practices.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strcmp returning 1...
    By Axel in forum C Programming
    Replies: 12
    Last Post: 09-08-2006, 07:48 PM
  2. getline() don't want to work anymore...
    By mikahell in forum C++ Programming
    Replies: 7
    Last Post: 07-31-2006, 10:50 AM
  3. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  4. Problems in getting OpenGL to work
    By zonf in forum C Programming
    Replies: 5
    Last Post: 02-13-2006, 03:48 AM
  5. Why won't my OpenGL work?
    By Raigne in forum C++ Programming
    Replies: 7
    Last Post: 11-26-2005, 10:53 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21