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
Why is the human immunodeficiency virus so deadly?
damaskus [11]

<em> </em><em>I</em><em> </em><em>think</em><em> </em><em>the</em><em> </em><em>answer</em><em> </em><em>is</em><em> </em><em>D</em><em>.</em>

<em>It</em><em> </em><em>kills</em><em> </em><em>the</em><em> </em><em>cells</em><em> </em><em>that</em><em> </em><em>make</em><em> </em><em>antibodies</em><em>.</em>

<em>Hope</em><em> </em><em>this</em><em> </em><em>will</em><em> </em><em>help</em><em> </em><em>u</em><em>.</em><em>.</em>

8 0
3 years ago
How would you like your social media profiles/personas to be treated in the event of your death? why?
White raven [17]
Depends on the person really. personally i would like it all to be kept for memories but never used anymore
7 0
3 years ago
Read 2 more answers
You are creating a web page as part of a science project. Your role is to put your data on the webpage. You tracked the growth o
zysi [14]

The best way to represent this information on a web page is to put it on a table. I would use the <table> tag to create the table element. The <tr> tag for creating a series of row elements, the <td> tag to create cell divisions and the <br> tag for a line break.

I would use 10 rows for different plants and 8 columns for different points in time.

<em>Hope this helps :)</em>

7 0
2 years ago
Read 2 more answers
Difference between batabse and database management system
adelina 88 [10]

Answer:A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS). ... The data can then be easily accessed, managed, modified, updated, controlled, and organized.

Explanation:A database could be grades that students get at school and to manage it we can use a spreadsheet program like excel

4 0
3 years ago
He ____ is the section of a cpu core that performs arithmetic involving integers and logical operations.
Gelneren [198K]
Arithmetic/logic Unit (ALU)
3 0
3 years ago
Other questions:
  • The highly advanced decision support feature integrated within an electronic information system would support which activity?
    9·1 answer
  • What is an individual piece of data called in a database? coding A field B file C record or D tittle
    9·1 answer
  • Plese give three examples of specilized servers.
    13·2 answers
  • Where is line-of-sight Internet common?<br> In space<br> Outdoors<br> Inside<br> In businesses
    10·1 answer
  • 20 POINTS!
    15·1 answer
  • Why does this happen to me?
    14·1 answer
  • You and a friend have just started a small business. How could you use the Internet to make your business successful?
    15·2 answers
  • Hey, can you guys please help me please??
    14·1 answer
  • 2. Which of these Is NOT part of the definition of Electricity?
    8·2 answers
  • Vector images take up much less space when saved to a computer or storage device because computers and storage devices just need
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!