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
A keyboard, mouse, and microphone are examples of ________.
kykrilka [37]

Answer:

A keyboard, mouse, and microphone all are examples of <u>peripheral devices.</u>

Explanation:

hope this helps

5 0
2 years ago
Read 2 more answers
A bluetooth device in ____ mode is part of the piconet but is in a low-power state.
adelina 88 [10]
A bluetooth device in park/hold mode is part of the piconet but is in a low-power state. These are power saving modes of operation for Bluetooth devices which are connected to a piconet and  are used when no data is to be transmitted.The hold mode is used when connecting several piconets or managing a low-power device such as temperature sensor. When the park mode is used t<span>he device is still synchronized to the piconet but does not participate in traffic.</span>
7 0
3 years ago
&gt;What is the output of the following code:
ozzi

Answer:

Given code output is "786".

Explanation:

Code:

list1 = [ 'cyber', 786 , 2.23, 'square', 70.2 ]#defining a list list1 that holds value in parameter

print (list1[1] )#use a print method that prints list index value

In the given code a list "list1" is declared that holds value in it and in the next step a print method is declared that prints the first index value of the list.

5 0
2 years ago
Write a C program that displays your name and address (or if you value your privacy, a frictionless name and address)
rosijanka [135]

Answer:

Following are the program in c language

#include <stdio.h> // header file

int main() // main method

{

   char name[90]="mantasa"; // storing name

   char add[90]="120 lal bangla mumbai"; // storing address

    printf("\n Name:%s\nAddress:%s",name,add); // print name and address

   return 0;

}

Output:

Name:mantasa

Address:120 lal bangla mumba

Explanation:

In this program we are declaring the two array of char type which will store the name and address . after that we display name and address.

7 0
3 years ago
What is the quickest way to remove all filters that have been applied to a worksheet?
RSB [31]

Answer:

Select the worksheet and click Delete All Filters.

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • "write a program that reads two floating point numbers and prints their sum difference and product."
    13·1 answer
  • How do you work with collaborators like copywriters developers and project managers?
    11·1 answer
  • Suppose the price of a complement to LCD televisions falls. What effect will this have on the market equilibrium for LCD​ TVs? T
    13·1 answer
  • Rob Janoff believes that technology should not be used too
    11·1 answer
  • You may nest while and do-while loops, but you may not nest for loops<br><br><br><br> True False
    10·1 answer
  • Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative intege
    10·1 answer
  • Name two ways you can identify the pid number of the login shell.
    13·1 answer
  • Voice authentication requires speech to text capability Facial recognition may be used for authentication The human iris is uniq
    6·1 answer
  • How to code for a database?​
    6·1 answer
  • Which term refers to the use of the internet at work for personal use?.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!