C/C++ >> I need help with a C++ program
Posted by golfshark12 on 08:19:00 05-01-2003
I'm looking to figure out this problem:
Define a structure called DATE with three fields, each of which is an integer: one for the month, one for the day and one for the year, and write a function called increment that accepts a date structure, increments the date by one day and returns the new date. If the date is the last day of the month, then the month field also must be changed. If the month is 12 (December) and the day is 31, then the value of the year field must also be changed. (Remember a year is a leap year if it is evenly divisible by 4 but not by 100 or it is evenly divisible by 400.) Finally, build a complete program that reads a particular date and prints the next date.
Posted by dxprog on 10:16:00 05-01-2003
Sounds basically like an "if-a-thon". There's your answer. [addsig]
Posted by Smerdyakov on 11:18:00 05-01-2003
I will use my astonishing powers of divination and give this advice: Ask your teacher.
Posted by golfshark12 on 11:20:00 05-01-2003
Asked him many time. Won't help. Here is what I have so far. Can anyone help me finish it?

#include
#include

struct DATE_1
{
int month;
int day;
int year;
};

void increment_date(DATE_1 &date)

int main()
{
DATE_1 date;

date.year;
date.day;
date.month;

switch(month)
{
case1: case 3: case 5: case 7: case 8: case 10: case 12:
{
if(date.day