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
Topic: Video Games.
Butoxors [25]

Answer:

Fire Emblem

Explanation:

4 0
3 years ago
HELP ASAP PLZZZZZ
musickatia [10]

Answer:

third one

Explanation:

3 0
2 years ago
Online education students need to be taught ______. Select 2 options.
Vladimir79 [104]

Answer:

-the reasons why they should be ethical


-how to communicate professionally

Explanation:

GOT IT RIGHT ON ODYSSEY

6 0
1 year ago
Zahra's softball team needs money for team T-shirts. The coach makes some fundraising suggestions, while team members brainstorm
user100 [1]

Answer:

I would think it would be D

Explanation:

that's basically what it said in the passage

5 0
3 years ago
Read 2 more answers
What is the term for a media piece that is ineligible for protection by copyright laws,
Nataliya [291]

Answer: D. Public domain

Explanation:

Hi, the term Public domain is applied to works of authorship that are ineligible for protection by copyright laws, because the copyright has expired or it was never copyrighted in the first place.

Public domain may vary in different countries and jurisdictions, for example; a media piece may be protected by copyright in one specific country, and be public domain in other countries.

Feel free to ask for more if needed or if you did not understand something.

6 0
3 years ago
Other questions:
  • Select the most likely outcome of making only on-time minimum payments to a credit
    11·1 answer
  • Mr. Green maintains a spreadsheet containing data on all of his employees, including name, job profile, monthly salary, and home
    15·1 answer
  • Plot element is typically the turning point in the most intense moment of a story
    8·1 answer
  • Find the inverse function of f(x)= 1+squareroot of 1+2x
    6·1 answer
  • Describe the process of sorting the following list using the above algorithm:
    7·1 answer
  • For enterprise servers, or servers accessed around the clock, SATA disks are preferred over SAS disks. True or False
    12·1 answer
  • Question #5
    14·1 answer
  • Programming in https<br>​
    5·1 answer
  • Write a C program that reads two hexadecimal values from the keyboard and then stores the two values into two variables of type
    15·1 answer
  • Do anyone else receive random points from Brainly… because I swear I had like 2K+ something and I check and Im at ACE… and with
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!