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
Nadusha1986 [10]
3 years ago
7

Write a function SwapArrayEnds() that swaps the first and last elements of the function's array parameter. Ex: sortArray = {10,

20, 30, 40} becomes {40, 20, 30, 10}. The array's size may differ from 4.
#include
using namespace std;
/* Your solution goes here */
int main() {
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) {
cout << sortArray[i] << " ";
}
cout << endl;
return 0;
}.
Computers and Technology
1 answer:
ludmilkaskok [199]3 years ago
3 0

Answer:

Replace /* Your solution goes here*/ with the following

<em>void SwapArrayEnds(int sortArray [], int lent){ </em>

<em>    int temp = sortArray[0]; </em>

<em>    sortArray[0] = sortArray[lent-1]; </em>

<em>    sortArray[lent-1] = temp; </em>

<em>} </em>

<em />

Explanation:

This defines the function SwapArrayEnds with two parameter (the array and the array length)

<em>void SwapArrayEnds(int sortArray [], int lent){ </em>

This declares an integer variable "temp" and initializes it with the first element of the array

<em>    int temp = sortArray[0]; </em>

The next two lines swap the last element with the first

<em>    sortArray[0] = sortArray[lent-1]; </em>

<em>    sortArray[lent-1] = temp; </em>

<em>} </em>

<em />

<em>See attachment for full program</em>

Download cpp
You might be interested in
How serious are the risks to your computer security?
ASHA 777 [7]

The seriousness of  the risks to your computer security is not to be a severe one. This is because Computer security risks  are due to the handwork of  malware such as, bad software, that can infect a  computer, and make the hacker to destroy your files, steal your data, or even  have access to your system without one's knowledge or authorization.

<h3>What are the risk results for information and computer security?</h3>

The term “information security risk” is known to be those  damage that occurs due to  an attacks against IT systems. IT risk is made up of a wide range of potential events, such as data breaches, regulatory enforcement actions, financial costs, and a lot more.

Some Examples of malware are viruses, worms, ransomware, spyware, and a lot others.

Hence, The seriousness of  the risks to your computer security is not to be a severe one. This is because Computer security risks  are due to the handwork of  malware such as, bad software, that can infect a  computer, and make the hacker to destroy your files, steal your data, or even  have access to your system without one's knowledge or authorization.

Learn more about computer security from

brainly.com/question/12010892

#SPJ1

6 0
2 years ago
Which of the following is an example of a stereotype?
amm1812

Answer:

d)"I have a really bad feeling about her. I don't know why."

Explanation:

5 0
3 years ago
In word, the ____ presents the most accurate view of how your document will look when printed, displaying the entire page on scr
makkiz [27]
<span>When using Microsoft Word, the "Print Preview" presents the most accurate view of how the document will look when it is printed. When using "Print Preview" the entire page is displayed on screen, making it easier to see what adjustments should be made to the page layout, such as spacing or text size.</span>
7 0
3 years ago
Which is the most effective way to demonstrate being prepared for an interview
postnew [5]

Answer:

Companies want people who know more about them and rather have someone who is interested in the company than someone who is just looking for a way to get payed.

Explanation:

7 0
3 years ago
A poem for coduction
Nataly_w [17]
I don't know if you want a poem about conduction but if so here ya go

no matter how the heat
different temperatures meet
hot to cold how it's done
4 0
4 years ago
Read 2 more answers
Other questions:
  • A document repository is down when you attempt to access it. which isa principle is being violated?
    13·1 answer
  • An _________ is a phrase formed from the first letters of words in a set phrase or series of words a. Acronymic sentence c. Basi
    7·2 answers
  • Which of the following could result from heat being transferred to a substance?
    14·1 answer
  • 1. In Access, a template is which of the following? a. A database to manage contacts b. Where a database is stored c. Two tables
    5·1 answer
  • What is the definition of D1-D4?
    14·1 answer
  • In what year did the manager and team depicted in the blockbuster film "Moneyball
    9·1 answer
  • In C++ write a program that prints out PI as a type double and a type float EXACTLY as shown below. Your program should have ONE
    13·1 answer
  • for java ?(Business: check ISBN-13)ISBN-13 is a new standard for identifying books. It uses 13 digits d1d2d3d4d5d6d7d8d9d10d11d1
    9·1 answer
  • A(n) __________ structure is a structure that causes a statement or a set of statements to execute repeatedly.
    13·1 answer
  • In the context of the data administration component of a database management system (DBMS), the acronym CRUD stands for _____.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!