Thread: Need help with this Assignment

  1. #1
    Registered User
    Join Date
    Jul 2016
    Posts
    1

    Need help with this Assignment

    Question 02: Write a modular C program to compute and display the day-number in a year for a date that is input at the keyboard. A day-number for a date is the number of days from 1st January of the date’s year to the date. For example: The day number of 3rd February is 34, the day number of 5th March is 64 if the year is a non-leap year; otherwise it is 65 (A leap year is a year that has 366 days; a non-leap year has 365 days).

    Your program must check for input validity. It must display an appropriate error message and terminate if the three inputs for date (day, month, and year) do not form a valid date.

    In addition to the main function your program must use the following functions:
    · A function that displays the following message to the user:
    “This program computes and displays the day number of a date input as: day month year.”
    · A boolean function (implemented as an int function) that tests for input validity. The function returns 1 if the three inputs form a valid date; otherwise it returns zero. This function must not have printf or scanf calls.
    · A boolean function (implemented as an int function) that returns 1 if its parameter year is a leap year; otherwise it returns 0 (A leap year is a year that has 366 days). This function must not have printf or scanf calls.
    · An int function that returns the day-number of a particular date. This function must not have printf or scanf calls.
    Note:
    · A year is a leap year if it is divisible by 400; otherwise if it is divisible by 4 and not divisible by 100.
    · Assume a year is between 1900 and 3000 inclusive, i.e., 1900 ≤ year ≤ 3000
    · Your program must be general.
    · For grading purposes, each non-main function must be written after the main.
    · Your program must behave as the sample program runs below.
    · You may use the table of day-numbers given below to test your program.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,861
    What exactly is the help that you need?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    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. Assignment help
    By cmp in forum C Programming
    Replies: 4
    Last Post: 03-08-2014, 06:08 PM
  2. Need help with assignment
    By PKisMe in forum C Programming
    Replies: 22
    Last Post: 06-14-2011, 09:52 PM
  3. Replies: 3
    Last Post: 04-26-2009, 08:54 AM
  4. I need some help with an assignment
    By AtmaSniper in forum C++ Programming
    Replies: 9
    Last Post: 02-13-2005, 11:27 AM
  5. Assignment
    By cYou in forum C++ Programming
    Replies: 4
    Last Post: 06-12-2003, 07:57 AM

Tags for this Thread