Anne Dawson: CSCI101A_LAB8_SU05.htm   

 

Last updated: Saturday 25th June 2005, 11:52 PT

 

 

Special instructions:

 

This lab is assessed and timed and counts towards your final grade.

 

For this assignment you must work alone.

You may use the text book.

 

This lab is due at 11:45am when the folder will be closed.

 

No late assignments will be accepted.

No assignment, no score.

 

CSCI101A

 

Introduction to Computer Programming using C++

Summer 2005

Lab Assignment 8 - Assessed lab on Arrays.

 

Write a program to read in the following 8 integers from a text file called data.txt (created using Notepad.exe) into an array named array1:

 

6

7

21

40

7

8

2

12

 

Write three functions (pre- and post-condition comments required):

 

1) a void function to read the data from the file into the array. The function receives the array as a parameter.

 

2) a function which returns the maximum number of the array. The array is passed as a parameter.

 

3) a function which returns the sum of the odd numbers in the array. The array is passed as a parameter.

 

 

 

Your program should start with a comment block that contains the following information:

 

//  File:       lab8.cpp

//  Purpose:    Assessed lab on Arrays

//  Programmer: [your name]

//  Course:     CSCI101A

//  Date:       Tuesday 28th June 2005

 

 

 

At 11:40am, save your program file (lab8.cpp) to your folder on the network in:

 

CSCI101A\Week10\Lab08

 

Break time is 11:45 - 12:00

 

Lecture: 12:00 - 12:30  (Strings)

 

 

Program points will be based on the following marking scheme:

 

Marking Scheme: CSCI101A   -   Lab 8  -   Array Program

Student name:

Category

Points

Description

Function 1

15

as per specification

Function 2

15

as per specification

Function 3

15

as per specification

Style

15

Appropriate identifiers and indentation.

Comments

15

Main program and function comments must be complete and accurate.

Correctness

15

The program should output correct results.

Completeness

10

The program should be complete.