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]
2 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]2 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
25) _____ involves assigning numbers or other symbols to answers so that the responses can be grouped into a limited number of c
Hitman42 [59]
B- The answer is "Data entry".
5 0
3 years ago
How do I write a pseudocode algorithm to read a sequence of number terminated by the number 999 and print the sum of the positiv
Veronika [31]

Answer:Start with the algorithm you are using, and phrase it using words that are easily transcribed into computer instructions.

Indent when you are enclosing instructions within a loop or a conditional clause Avoid words associated with a certain kind of computer language.

Explanation:

5 0
2 years ago
Can someone please help me in answering this!?! <br> The language is C++
Llana [10]

Here is a somewhat cryptic solution that works:

#include <algorithm>

#include <cstdlib>

using namespace std;

void q(char c, int count)

{

for (int i = 0; i < count; i++) {

 putchar(c);

}

}

void p(int b1, int plusses)

{

q(' ', b1);

q('+', plusses);

}

int main()

{

for (int i = -3; i <= 3; i++)

{

 int pl = min(6, (3 - abs(i)) * 2 + 1);

 p(6-pl, pl);

 i == 0 ? p(0, 6) : p(6, 0);

 p(0, pl);

 putchar('\n');

}

getchar();

}


5 0
3 years ago
What are the differences and similarities of computer virus and biological virus. Give 4 examples
Papessa [141]

Answer:

During recent months, we’ve witnessed an unexpected and distressing pandemic of a coronavirus disease. What I find especially distressing about it is how the worldwide adversity was caused by just a tiny thing — namely, a virus called SARS-CoV-2.

However, biological viruses have always been a potent threat to humanity, as historic pandemics have proved. No wonder viruses became an ideal weapon model in a totally different world — a world of programming. The first computer viruses were created as early as in the 1970s. Starting as pranks, they evolved to become a major threat to the stability of computer networks worldwide. And the more I think of viruses, both biological and digital, the more amazed I am by their similarities.

We don’t know what kind of challenges viruses of either type will cause in the future, but understanding how they infect, the symptoms they induce, how they spread, and the damage they can cause can help us fight both.

The Common Thread

Let’s start with the basics: What does a virus look like?

computer virus of 1999

Click image for larger version

Figure 1: Pictured on the left is an electron microscope image of SARS-CoV-2 particles - the pandemic-causing coronavirus. Source: NIAID-RML. Pictured on the right is a code snippet of a Melissa, the notorious email-spreading computer virus of 1999. Source: Gizmodo.

The images in Figure 1 might look vastly different, but, essentially, they’re the same: a string of code. In the coronavirus, it’s the RNA genome in a shell; in Melissa, it’s computer code. In both cases, the code is an “instruction” for the virus to follow.

Explanation:

here is your answer hope you will enjoy

thank you

6 0
2 years ago
((11111111-1011100) X (10100 / 10))- ( 110010000+ 1110011)
dsp73

Answer:

10089891099

Explanation:

?

3 0
2 years ago
Other questions:
  • Which individual of the following would be most likely to be directly concerned with web security?
    14·2 answers
  • It is important to ____ the line in the code editing window in the exact location where you want to insert a code snippet to pro
    10·1 answer
  • If the Account Number field in a record always should display the three characters in the account number in uppercase, then the
    14·1 answer
  • What operating system is an open source program
    15·1 answer
  • Lifelong learning _____. is only important for professionals with advanced degrees can be formal or informal includes formal cla
    12·1 answer
  • When Gina was 10, she swam in the ocean for the first time. She remembers the feeling of kicking her feet, slicing her arms thro
    12·1 answer
  • Someone who wants to learn a skilled trade on the job should consider
    6·2 answers
  • You want a cable that could be used as a bus segment for your office network. The cable should also be able to support up to 100
    5·1 answer
  • Which of the following is a characteristic of vector graphics?
    15·2 answers
  • Which element of the MakeCode Arcade interface represents an individual
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!