CIT 237 Valencia College C++ Short Program on Arrays Worksheet

Description

4 attachmentsSlide 1 of 4attachment_1attachment_1attachment_2attachment_2attachment_3attachment_3attachment_4attachment_4

Unformatted Attachment Preview

CIT-237
Lab 7.1
Arrays
The goal of this lab is to help you get familiar with arrays.
Due Date
You must demonstrate the solution to this lab exercise to the instructor by Wednesday, February 19, 2020, in
order to receive full credit for this work.
Lab Setup
1. Create the project using Visual Studio.
2. Download the ZIP file for Lab 7.1 from Moodle.
3. Copy the sample input files, numbers.txt, and fiveNumbers.txt from the ZIP file to the
same folder where your source file is located.
Programming Exercise
This lab exercise involves writing a program with several functions:
The “main” function must:

Define an array of 12 integers:



Prompt the user for an input file name. Open this file for input. The file contains integers (one per line).
Read the contents of the file into the array.
Call four separate functions: getLowest, getHighest, getSum, and getAverage, and display the value
returned by each function.
const int ARRAY_SIZE = 12;
int numbers[ARRAY_SIZE];
Each of the other functions must contain a loop that scans the data in the array and returns the appropriate result:
The getLowest function returns the lowest number in the array.
The getHighest function returns the highest number in the array.
The getSum function returns the total of the numbers in the array.
The getAverage function returns the average of the numbers in the array.
Design Restriction
For this lab exercise use an array of integers, not a vector of integers. We will use vectors later in the course, but
for now we need to use only arrays.
Sample Data Files and Sample Program Output
The ZIP file, which can be downloaded from Moodle, contains two text files. These should be used to test your
program. (They are also shown on the next page.)
CIT237_Lab07.1_Arrays_20200210.docx
2/7/2020 11:43 PM
page 1 of 2
CIT-237
Lab 7.1
Arrays
The sample data and sample program output are provided below. (In the sample program output shown in this
document, text typed by the user is shown in BOLD font. In actuality, all text will be displayed in the same font)
Input file: numbers.txt
53
22
87
103
-3
75
220
1
64
543
98
44
Output from processing the numbers.txt file
Enter name of input file: numbers.txt
12 numbers read from input file.
The highest value is 543
The lowest value is -3
The sum of the numbers is 1307
The average of the numbers is 108.917
Press any key to continue . . .
Input file: fiveNumbers.txt
-53
-22
-87
-103
-3
Output from processing the fiveNumbers.txt file
Enter name of input file: fiveNumbers.txt
5 numbers read from input file.
The highest value is -3
The lowest value is -103
The sum of the numbers is -268
The average of the numbers is -53.6
Press any key to continue . . .
CIT237_Lab07.1_Arrays_20200210.docx
2/7/2020 11:43 PM
page 2 of 2
Numbers.txt
53
22
87
103
-3
75
220
1
64
543
98
44
fiveNumbers.txt
-53
-22
-87
-103
-3
otherFile.txt
953
322
6687
9103
-67563
5475
6220
551
6664
253

Purchase answer to see full
attachment

Explanation & Answer:
1 program

User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.

Looking for this assignment?

do my essay homework

Reviews, comments, and love from our customers and community

Article Writing

Great service so far. Keep doing what you do, I am really impressed by the work done.

Alexender

Researcher

PowerPoint Presentation

I am speechless…WoW! Thank you so much! Definitely, the writer is talented person. She provided me with an essay a day early before the due date!

Stacy V.

Part-time student

Dissertation & Thesis

This was a very well-written paper. Great work fast. I was in pretty desperate need for help to finish this paper before the due date, which was in nine hours.

M.H.H. Tony

Student

Annotated Bibliography

I love working with this company. You always go above and beyond and exceed my expectations every time. Kate did a WONDERFUL job. I would highly recommend her.

Francisca N.

Student

Book Report / Review

I received my order wayyyyyyy sooner than I expected. Couldn’t ask for more. Very good at communicating & fast at replying. And change & corrections she put in the effort to go back and change it!

Mary J.

Student

Essay (Any Type)

On time, perfect paper. All concerns & matters I had Tom was able to answer them! I will definitely provide him with more orders!

Prof. Kate (Ph.D)

Student

Case Study

Awesome! Great papers, and early! Thank you so much once again! Definitely recommend to trust James with your assignments! He won’t disappoint!

Kaylin Green

Student

Proofreading & Editing

Thank you Dr. Rebecca for editing my essays! She completed my task literally in 3 hours. For sure will work with her again, she is great and follows all instructions

Rebecca L.

Researcher

Critical Thinking / Review

Extremely thorough summary, understanding and examples found for social science readings, with edits made as needed and on time. It’s like having a tutoring service available (:

Arnold W.

Customer

Coursework

Perfect!I only paid about $80, which i think was a good price considering what my paper entailed. My paper was done early and it was well written!

Joshua W.

Student

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>