Question: Make absolutely no changes to main() . Change function backwards so that the elements of the array are swapped in order for elements to be
Make absolutely no changes to main(). Change function backwards so that the elements of the array are swapped in order for elements to be in reverse order. That is, arr[0] will be 16, arr[1] will be 5, etc. But backwards() must work no matter what values are in the array and for all values passed in for number. After it is corrected this program should output: 16 5 3 17 8 2
#include
int main() { int arr[] = {2,8,17,3,5,16}; int i;
backwards(arr,6);
for (i = 0; i cout
//system("pause"); return 0; }
void backwards(int array[], int number) { /*Pre: array[] - array of integers number - number of elements in the array that have values Post: Nothing Purpose: Reverse the order of the elements of an array */ int i; int temp;int j; for(i = 0; i { temp = array[i]; array[i] = array[number - 1 - i]; temp = array[number - 1 - i]; }
return;
}
1490252100 03/22/2017 11:55pm
Text Entry
| Copy and paste or type your submission right here. |
| Keyboard ShortcutsHTML Editor Rich Content Editor |
| CancelSubmit Assignment |
CancelUpdate Description
Additional Comments:
CancelUpdate Comments
Additional Comments:
Rubric
Can't change a rubric once you've started using it.
Find a Rubric
Title:
Find Rubric
Title
You've already rated students with this rubric. Any major changes could affect their assessment results.
Title
Criteria Ratings Pts This criterion is linked to a Learning Outcome Description of criterion view longer description threshold: 5 pts Edit criterion description Full Marks 5 pts blank Edit rating Delete rating {C} Add new rating category after current rating No Marks 0 pts blank_2 Edit rating Delete rating {C} Add new rating category after current rating This area will be used by the assessor to leave comments related to this criterion. pts / 5 pts -- This criterion is linked to a Learning Outcome Description of criterion view longer description threshold: 5 pts Edit criterion description Full Marks 5 pts blank Edit rating Delete rating {C} Add new rating category after current rating No Marks 0 pts blank_2 Edit rating Delete rating {C} Add new rating category after current rating This area will be used by the assessor to leave comments related to this criterion. pts / 5 pts -- Total Points: 5 out of 5 Criterion Find Outcome
| I'll write free-form comments when assessing students Use this rubric for assignment grading Hide score total for assessment results CancelCreate Rubric |
Previous
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
