1 / 4

Homework #2: Functions and Arrays

Homework #2: Functions and Arrays. By J. H. Wang Mar. 21, 2008. Programming Exercises. Write a function that takes three input parameters (of integers) and returns the sum and the average of the three numbers. Write a driver program that tests your function.

reid
Télécharger la présentation

Homework #2: Functions and Arrays

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Homework #2:Functions and Arrays By J. H. Wang Mar. 21, 2008

  2. Programming Exercises • Write a function that takes three input parameters (of integers) and returns the sum and the average of the three numbers. Write a driver program that tests your function. • Write a function leap() that determines if a year is a leap year. A year is a leap year if it is divisible by four, except that any year divisible by 100 is a leap year only if it is divisible by 400. Your function should accept the year as an integer. It returns 1 if called with a leap year, 0 otherwise.

  3. Write a program to store an input list of ten integers in an array; then display a table similar to the following, showing each data value and what percentage each value is of the total of all ten values.

  4. Submission • Due: 2 weeks (Apr. 4, 2008) • Account registration (if you haven’t done it yet) • http://140.124.182.228/UploadHomework/newuser.aspx • Homework uploading • http://140.124.182.228/UploadHomework/Home.aspx • Password changing • http://140.124.182.228/UploadHomework/changePW.aspx • Password recovery (if you forgot it) • http://140.124.182.228/UploadHomework/recoveryPW.aspx

More Related