1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ivahew [28]
3 years ago
14

5.8.1: Modify an array parameter. Write a function SwapArrayEnds() that swaps the first and last elements of the function's arra

y parameter. Ex: sortArray = {10, 20, 30, 40} becomes {40, 20, 30, 10}. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #include using namespace std; /* Your solution goes here */ int main() { const int SORT_ARR_SIZE = 4; int sortArray[SORT_ARR_SIZE]; int i; int userNum; for (i = 0; i < SORT_ARR_SIZE; ++i) { cin >> userNum; sortArray[i] = userNum; } SwapArrayEnds(sortArray, SORT_ARR_SIZE); for (i = 0; i < SORT_ARR_SIZE; ++i) { cout << sortArray[i] << " "; } cout << endl; 1 test passed All tests passed Run

Computers and Technology
1 answer:
viktelen [127]3 years ago
3 0

Answer:

see explaination

Explanation:

#include<stdio.h>

/* Your solution goes here */

//Impllementation of SwapArrayEnds method

void SwapArrayEnds(int sortArray[],int SORT_ARR_SIZE){

//Declare tempVariable as integer type

int tempVariable;

if(SORT_ARR_SIZE > 1){

tempVariable = sortArray[0];

sortArray[0] = sortArray[SORT_ARR_SIZE-1];

sortArray[SORT_ARR_SIZE-1] = tempVariable;

}

}

int main(void) {

const int SORT_ARR_SIZE = 4;

int sortArray[SORT_ARR_SIZE];

int i = 0;

sortArray[0] = 10;

sortArray[1] = 20;

sortArray[2] = 30;

sortArray[3] = 40;

SwapArrayEnds(sortArray, SORT_ARR_SIZE);

for (i = 0; i < SORT_ARR_SIZE; ++i) {

printf("%d ", sortArray[i]);

}

printf("\n");

return 0;

}

Please go to attachment for the program screenshot and output

You might be interested in
Dummy activities A. are found in both AOA and AON networks. B. are used when two activities have identical starting and ending e
Nikitich [7]

Answer:

B. are used when two activities have identical starting and ending events.

Explanation:

Dummy activities are used when we want to demonstratethe relationship between two methods or evens, which place option B as the correct one.

Dummy activities have no duration at all, actually they are not suppose to be on the critical path, because they are just demonstrative, so option D and C are not correct.

4 0
3 years ago
Read 2 more answers
Computers are used to store, retrieve, and _____ data. manipulate mechanize memorize operate
likoan [24]

Answer:

manipulate

Explanation:

idk because it seems right

7 0
3 years ago
Nhiệt độ chiết rót của máy chiết rót có van trượt là bao nhiêu
Delvig [45]

Answer:

please translate

Thank you✌️

6 0
3 years ago
To copy consecutive items, click the first item in the group, hold down _______, and click the last item
Nikitich [7]
C. Shift , you can control click to select one at a time
7 0
3 years ago
Read 2 more answers
The physical devices that make up a computer system are called
LUCKY_DIMON [66]
The question is broad and vague, but I would say hardware.
3 0
4 years ago
Other questions:
  • Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate
    10·2 answers
  • What age group is experiencing the most growth in social media
    13·1 answer
  • Good afternoon guys !!!
    14·2 answers
  • True or False. Students taking courses log into Blackboard with their "key account" username and password.
    8·1 answer
  • Do you think robots will take millions of jobs when they're put in different positions such as doctors or taxi drivers?
    7·1 answer
  • To generate a report with exact results based on specific criteria it is best to base the report on a(n) ____________________ cr
    6·1 answer
  • A machine on a 10 Mbps network is regulated by a token bucket algorithm with a fill rate of 3 Mbps. The bucket is initially fill
    12·1 answer
  • Dereck works for long hours on his computer. He frequently experiences physical strain by the end of the day because he does not
    8·2 answers
  • How should the teachers respond to the parental complaints of student C? If they fail the student, the student will likely be re
    11·1 answer
  • Peter was working on a design for a magazine. He had to give his design to his team for further editing. He wanted to use a file
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!