I have made some modifications to eliminate reading from keyboard and the datafile, and the code prints the array in reverse order. So logic is fine.
We will need to look at the data.
One thing to check is right after you have read your data file, print them out to see if they have been read properly.
If that works, print the array on entry to reverse, and just before exit.
All this is to locate where the problem is.
Once you know where the problem is, the problem scope will be reduced significantly.
Don't know if myprogramminglab lets you do all that, but you can do these tests on your own compiler.
Here's the modified code.
using namespace std;
int *reverse(const int *, int);
cin >> N;
if(N > 50 || N < 0)
// int *arr1 = new int[N], index;
int *arr1=new int[N];
datafile.open("data.txt", ios::in | ios::out);
for(index = 0; index < N; index++)
datafile >> arr1[index];
temp = reverse(arr1,N);
for(index = 0; index < N; index++)cout << temp[index] << endl;
int *reverse(const int *arr1, int N)
int index = N-1;
arr2 = new int[N];
for(int count = 0; count < N; count++)
arr2[count] = arr1[index];
after the due date my teacher told me what was wrong with it apparently the entire problem was the .txt which I erroneously thought you had to have, ty for your help
you're welcome! :)
college - Write a C++ program to fill an array with 6 numbers, and then reverse...
programming - I really need help in this it makes me confuse.I should make a ...
math - don break a 4x7 array into a 2x7 array and another array. what is the ...
Math - Don breaks a4 by 7array into a 2 by 7 array and another array. What is ...
computer science - Create a method called countZeros, which takes an integer ...
Computer Science - I need help with this question please! Please write me step ...
computer science - Write a method printBackwards that prints an array of ...
assembler language - write an assembly language subordinate count according to ...
c++ - how do you pass only part of an Array through a function? I thought it was...
math - with each array write the factor pair. Rember that the # of row in the ...