Like Tree2Likes
  • 1 Post By claudiu
  • 1 Post By laserlight

HELP Required C Program that output the very next date after Input a date

This is a discussion on HELP Required C Program that output the very next date after Input a date within the C Programming forums, part of the General Programming Boards category; Problem: HELP Required Write a C Program that output the very next date after Input a date suppose : Input: ...

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    7

    Lightbulb HELP Required C Program that output the very next date after Input a date

    Problem: HELP Required Write a C Program that output the very next date after Input a date

    suppose :

    Input: (DD/MM/YYYY) 21/09/2012

    OUTPUT: 22/09/2012



    Thanks in Advance.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,302
    What have you tried?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by riyaj123 View Post
    Problem: HELP Required Write a C Program that output the very next date after Input a date

    suppose :

    Input: (DD/MM/YYYY) 21/09/2012

    OUTPUT: 22/09/2012



    Thanks in Advance.
    Yes, you are required to write it.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  4. #4
    Registered User
    Join Date
    Mar 2012
    Posts
    7
    I try to write an algorithm first of all.. But my head goes off.. I have to submit this project in my class in 3 days. Pls help me..

  5. #5
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by riyaj123 View Post
    I try to write an algorithm first of all.. But my head goes off.. I have to submit this project in my class in 3 days. Pls help me..
    This is not a homework service. You provide some code, some ideas and we critique it and point you in the correct direction. No effort from you, no effort from us. We have all done our own homework and we don't intend to do the one assigned to others.
    Salem likes this.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  6. #6
    Registered User
    Join Date
    Mar 2012
    Posts
    7
    Let me try it myself. Thanks..
    Last edited by riyaj123; 03-27-2012 at 10:57 AM.

  7. #7
    Registered User
    Join Date
    Mar 2012
    Posts
    7
    God save me. '
    Last edited by riyaj123; 03-27-2012 at 10:57 AM.

  8. #8
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Someone should erase the above. Who knows what it says?
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,845
    How about starting with the basics?

    Code:
    int day, month, year;
    // some stuff to prompt for, and read input, and store in the appropriate variables.
    
    printf("Day=%d\n", day );
    printf("Month=%d\n", month );
    printf("Year=%d\n", year );
    Until that works reliably, there isn't much point in considering the next step.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #10
    Registered User
    Join Date
    Mar 2012
    Posts
    7
    help me. Pls anyone pls get me the code.

  11. #11
    Registered User
    Join Date
    Mar 2012
    Posts
    7
    help me. Pls anyone pls get me the code.

  12. #12
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,302
    No.

    *thread closed*
    riyaj123 likes this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Date Program Help!!
    By LatinoHeat in forum C++ Programming
    Replies: 2
    Last Post: 02-06-2011, 08:35 PM
  2. Two date objects showing same date?
    By dxfoo in forum C++ Programming
    Replies: 7
    Last Post: 06-17-2010, 07:06 PM
  3. Review required for program of date difference
    By chottachatri in forum C Programming
    Replies: 6
    Last Post: 10-31-2008, 12:46 PM
  4. Output Text File Name by Today's Date
    By jbayne in forum C++ Programming
    Replies: 1
    Last Post: 07-09-2007, 09:09 AM
  5. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 05:23 PM

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