Here is what I have to do.
1)Read integers from a file
2)If it cannot be opened, display an error message and exit the program.
3) Otherwise, read an integer from the file (there is guaranteed to be at least 1).
4) If that count is 0, display an error message and exit the program.
5) Otherwise, allocate an array of integers via dynamic memory, of the size that was just read. So, if the first value in the file is 3, you should allocate a section of dynamic memory with room for 3 integers.
6) Display the number of values to be read, along with a meaningful message, i.e. “Reading 3 values from input file”.
7) Read in that many values from the file, storing them in the dynamic memory; remember that it can be treated as an array! There is no need to use a while loop with >> as the condition here: I have guaranteed that the file will contain as many other values as the first value says. Thus, you can use a for loop to read that many values. You could use a while loop also, it is up to you. In fact, you can use one of the functions we’ve used previously, that reads an array of values from a file: remember, arrays are pointers, and pointers are arrays!
8) Once the values have been read in, pass it to a sort function. You can use either Bubble or Selection sort,just make sure that you use a version which sorts arrays of int. Note that you DO NOT have to modify the sort at all, since arrays are pointers, and pointers are arrays! You must call the sort function from within main(), and pass it the dynamic memory pointer, and the number of items read from the file.
9) After the sort is complete, display the values in the dynamic memory.
10) Before exiting, remember to delete the dynamic memory that you allocated, and be sure to use the correct syntax for the deletion!
If someone can please give me an example on how this is done so I can use it to refrence to do thi sproject or show me how to do it. It would be a huge help!!!!
Thanks!