Lab9 - COSC1415/COSC1436 Chapter 9 Lab Assignment Page 1 of 1 Name Chintu Patel 8001 COSC1415/COSC1436 Lab Chapter 9 Objectives At the end of this

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COSC1415/COSC1436 Chapter 9 – Lab Assignment Page 1 of 1 Name Chintu Patel 8001 COSC1415/COSC1436 Lab - Chapter 9 Objectives: At the end of this lab you should be able to: 1. use one-dimensional arrays in a program 2. initialize an array and store data in the array 3. find the sum, print and find the smallest element in an array 4. pass arrays as parameters 5. determine when to use const and when not to use const Lab 9: 1. Write a C++ program that declares an array alpha that has 50 double components. Write a function that stores the square of the index for the first 25 components and half of the index for the last 25 components. Write a function that prints the contents of the array with 10 elements per line. Don’t forget to put the < your name> statement in your program. Print a copy of the program and its output. 2. Write a C++ program that reads data from a file into an integer array that will hold a maximum of 100 components. Write the following void or value-returning functions: a. initialize all elements of the array to zero b. read the data from a file and store it in the array c. find the index of the component that holds the smallest value d. find the average value stored in the array e. print all of the elements in the array f. print the index of the smallest value, the smallest value, the average and all of the components that are greater than the average (Make sure that all of the values printed are properly labeled.) Don’t forget to put the < your name> statement in your program. Print a copy of the program and the output from data1.txt and
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/06/2008 for the course COSC 1436 taught by Professor May during the Spring '08 term at Dallas Colleges.

Page1 / 7

Lab9 - COSC1415/COSC1436 Chapter 9 Lab Assignment Page 1 of 1 Name Chintu Patel 8001 COSC1415/COSC1436 Lab Chapter 9 Objectives At the end of this

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online