Homework #7

#7 is Due Thursday, June 11, 11:59 PM

The files should not be written to after the due date.
  • [7.5 points ]

    1. Using structures, write a program to determine the day of the week, given a date. You can assume that January 1, 1984, was a Sunday. Remember to take care of leap years. A year is a leap year if is divisible by 4, but if it is also divisible by 100, it is not a leap year unless it is also divisible by 400. So, 1900 is not a leap year, but 2000 is.


      You do not have to worry about the dates prior to 1/1/1984. Thus, as long as your program works for the dates after 1/1/1984, it's fine.. =)


    2. What is value of j at end of following program segment:
      int *p, i, j=0;
      p = &j;
      for (i=0;i < 10;i++) *p += i;
      


    3. Write a function called change() and also a main program. Change() should take in a floating point number representing a dollar-cents value, and addresses of integer variables: quarters, dimes, nickels, pennies that are declared in the main program. When the function returns to the main program, the variables quarters, dimes, nickels, and pennies should contain their respective numbers that together add up the floating point value. In the main program, the floating point number should be input from user upon a prompt.


    4. Write a function (and a main program, of course) that finds all factors of an integer. Example: factors of 9: 3x3; factors of 17: 1x17; factors of 52: 2x2x13
    Back to Grading & Homeworks Page