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
Elanso [62]
3 years ago
9

Write a function to output an array of ints on a single line. Funtion Should take an array and an array length and return a void

. It should look like this {5,10,8,9,1}
Computers and Technology
1 answer:
nikitadnepr [17]3 years ago
5 0

Answer:

void printarr(int nums[],int n)

{

   cout<<"{";//printing { before the elements.

   for(int i=0;i<n;i++) // iterating over the array.

   {

       cout<<nums[i];//printing the elements.

       if(i==n-1)//if last element then come out of the loop.

       break;

       cout<<",";//printing the comma.

   }

   cout<<"}"<<endl;//printing } at the end.

}

Output:-

5

1 2 3 4 5

{1,2,3,4,5}

Explanation:

I have created a function printarr of type void which prints the array elements in one line.I have used for loop to iterate over the array elements.Everything else is mentioned in the comments.

You might be interested in
In the web form you are creating, you want a multiple-option select list to appear with five options. which line of html code wi
suter [353]
You will use a <select> for this. For example:

<select name="choice">
  <option>First</option>
  <option>Second</option>
  <option>Third</option>
  <option>Fourth</option>
  <option>Fifth</option>
</select>
5 0
3 years ago
Sharing a workbook helps to complete on time. Multiple people accessing the workbook help to build
BlackZzzverrR [31]
Collaboration skills
7 0
3 years ago
Organ transplants are rarely successful.
Maurinko [17]

False......................

6 0
3 years ago
Which of the following IS a positive effect<br> of the use of personal communication devices?
Goshia [24]

a) Personal communication devices are used in healthcare for sending e-mails or messages to healthcare members.

b) They use these devices for calculations.

c)They can access work related medical information by using mobiles.

2) Personal communication devices use at work has positive effect on their work including reducing stress, benefiting patients care improving coordination of patient care among the healthcare team or increases unit team work.

5 0
2 years ago
List different examples of models​
aleksley [76]

Answer:

Planet 3D model

Chemical reactions on a computer simulation

Flowchart of how science has changed over time

Tectonic plate movement in a drawing or picture

Making an Atom cake (i've done it and it was fun)

Earth foam Structure with a quarter or it cut out to show the inside

5 0
2 years ago
Other questions:
  • . the web is based on the ________ protocol
    6·1 answer
  • Which tag denotes the end of an element in HTML? A. / B. * C. &gt; D. ) E. _
    8·1 answer
  • Why is UDP less reliable than TCP?
    9·2 answers
  • Explain the factors involved in selecting a routing protocol to be used on a network.
    12·1 answer
  • The number of square units required to cover a surface.
    13·1 answer
  • Question 4 of 20
    5·1 answer
  • Upon connecting to a Wi-Fi network, you're redirected to a login screen and a request to accept terms of service before being co
    15·1 answer
  • CS160 Computer Science I In class Lab 10
    15·1 answer
  • Which of these is not enumerated as a motivation to create accessible web content?
    10·1 answer
  • Write an SQL statement to display for every restaurant the name of the restaurant (where the name of the restaurant consists of
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!