for anybody willing to help a fellow buddy out --this is a assignment btw.

closed account (S1ADLyTq)
Write a range function: o This function should take 2 parameters: a 1D int array and the number of elements. o It should return the difference between the largest element and the smallest element.

2. Write a reverse function: o This function should take 2 parameters: a 1D int array and the number of elements. o It should reverse the order of the elements. It should not return anything. o Hint: You can use the swap function to swap two elements, for example swap(a[i], a[j]) would swap a[i] and a[j]. Sample
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.

We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.


You cannot(?) use these, but would you learn from them?
1
2
3
4
auto result = std::minmax_element(/*...*/);
result.second - result.first

std::reverse(/*...*/);
Start with the range function. You could have it just return the largest element first, and then add in also finding the smallest and returning their difference.

Post your code. Be sure to use code tags: http://www.cplusplus.com/forum/articles/16853/
Topic archived. No new replies allowed.