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
patriot [66]
3 years ago
15

Create a function called makePositive that accepts a single argument: an integer array. The function should walk through the arr

ay and change any negative numbers to positive. You can assume that the array passed to the function will have a 0 at the end of the array. In other words, you do not know the size of the array; you instead know that a certain condition will be true at the end of the array.
Computers and Technology
1 answer:
coldgirl [10]3 years ago
8 0

Answer:

This solution is implemented in C++

void makePositive(int arr[]){

   int i =0;

   while(arr[i]!=0){

       if(arr[i]<0){

           arr[i] = abs(arr[i]);

       }

       i++;

   }

   i = 0;

   while(arr[i]!=0){

    cout<<arr[i]<<" ";

    i++;

}  

}

Explanation:

This defines the function makePositive

void makePositive(int arr[]){

This declares and initializes i to 0

   int i =0;

The following iteration is repeated until the last element in the array

   while(arr[i]!=0){

This checks if current array element is negative

       if(arr[i]<0){

If yes, it changes it to positive

           arr[i] = abs(arr[i]);

       }

The next element is then selected

       i++;

   }

This sets i to 0

   i = 0;

The following iteration prints the updated content of the array

<em>    while(arr[i]!=0){ </em>

<em>     cout<<arr[i]<<" "; </em>

<em>     i++; </em>

<em> }   </em>

}

See attachment for full program which includes the main

Download cpp
You might be interested in
What are the basic functions of an operating system? List any four of them.​
sammy [17]

Answer:

Following are some of important functions of an operating System.

Memory Management.

Processor Management.

Device Management.

File Management.

Security.

Control over system performance.

Job accounting.

Error detecting aids.

Explanation:

PLS MAKE ME AS BRAINLIST

5 0
3 years ago
Two technicians are discussing MAP sensors. Technician A says that the MAP sensor should be replaced if anything comes out of th
anygoal [31]

Answer:

Both are correct.

Explanation:

Both technicians are correct in this scenario. Technician A point of view is correct as well as technician B.

3 0
3 years ago
3. Do some Internet research on the use of VLANs in hospitals. Summarize the benefits of using VLANs in hospitals and identify e
motikmotik

VLAN refers to Virtual Local Area Network. It is a subnetwork that can group together collection of devices on separate physical Local Area Networks. VLANs allow network administrators to group hosts together even if the hosts are not directly connected to the same network switch.

Considering the large number of departments in hospitals, with each departments having functions different from the others, Virtual LANs allows various users(the departments) to be grouped together according to their networking needs, regardless of their actual physical locations. Subdividing the LAN into smaller segments, or VLANs, increases overall reliability, security, and performance, and makes the network easier to maintain.

Because of the largeness of St. Luke's hospitals and their mission of delivering highly reliable and feature-rich advanced network solutions, virtual LAN will help to provide a resilient and scalable network solution within the hospital's budget.

St. Luke should implement virtual LAN that can produce a higher bandwidth with lower-cost, a longer-term model based on servers, networking products and homogenous network components to deliver centralized management of computing across the hospital network.

5 0
4 years ago
Read 2 more answers
When all the input has been read, your program should produce a summary report that includes a list of all the tokens that appea
hichkok12 [17]

Answer:

I dont understand this, what is the question?

5 0
3 years ago
If your Word page is visually confusing after combining documents, one way to simplify the page is to select Hide Source Documen
FrozenT [24]
I’m not really sure but I’ll T
6 0
4 years ago
Other questions:
  • Rebecca completed work on a computer and is verifying the functionality of the system when she finds a new problem. This problem
    13·1 answer
  • Which feature of a browser will you select to block pop-ups? view help tools file
    15·2 answers
  • add is a method that accepts two int arguments and returns their sum. Two int variables, euroSales and asiaSales, have already b
    11·1 answer
  • Alter the line of (10, 20) and (18, 30) en dpoints by (2, 3) scale factor, then move it by (5, 9) translate factor using matrix
    13·1 answer
  • John just opened a savings account and wants to maximize the account of interest you earn which of the following actions would e
    13·1 answer
  • In short and brave what is technology?
    9·2 answers
  • A main document in a mail merge contains data, such as names and addresses.
    12·1 answer
  • We need ____ pointers to build a linked list.
    6·1 answer
  • What port is typically reserved and utilized by the Secure Hypertext Transfer Protocol to create a secure connection to a Web se
    13·1 answer
  • Which statement compares the Autofill and Flash Fill features?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!