Array Alpha

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 A: 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 statement in your program.

Save a copy of the program and its output.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.