Question
This have to be make exactly same insturction below. please help me with this 3 files. files (all .h and .cpp files) IMPORTANT INSTRUCTIONS (follow
This have to be make exactly same insturction below.
please help me with this 3 files. files (all .h and .cpp files)
IMPORTANT INSTRUCTIONS (follow these to avoid losing points NO LATES)
Submit your source code files (all .h and .cpp files), make sure your name is on each file you submit.
Make sure and use three separate files for your object oriented programs (this means for each program you need to submit three files on Moodle (two .cpp files and 1 .h file). Do not use inline functions. IF YOU VIOLATE THESE RULES points off.
NO GLOBAL VARIABLES no exceptions. Programs with global variables will not be accepted (global constants are fine)
Program 1: Allocate an array dynamically, read from file, sort, and print array Based on Chapter 8 and 9 lecture (20 pts)
Define an integer pointer to use as an array then read from a file. Do the following steps:
Open up a file (prompt the user for the file name)
If you cant open the file, print an error message and exit, else continue
Read in the integers and count them.
Close the file
Allocate an array of integers using that count for the size of the array
Open the file again
Read the numbers into the array and sum them all
Sort them (use bubble sort, code under Files in Moodle)
Print the sorted array and print the average of the values
Use delete to delete the array
Your program should be able to read integers from any file with integers, of course. And example data file would be:
12
19
2
23
53
12
20
37
73
9
111
16
Note: Those using XCode on a Mac, you need to make a project then change the working directory to $PROJECT_DIR/. and you do that by selecting Product/Scheme/Edit Scheme. Then go to the Working Directory part, select Use custom working directory box, then put in the $PROJECT_DIR/. in the box (without the quotes, of course). That will allow selecting data files that are in the same directory as your source code.
Windows users just need to place the data file under the same directory as the source code.
I have to make 2 cpp files and one header file for this one
please help me correctly
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started