answer.
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
Leviafan [203]
2 years ago
10

Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a

nd computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. Sample Run 1 Enter an integer, the input ends if it is 0: 1 2 -1 3 0 The number of positives is 3 The number of negatives is 1 The total is 5.0 The average is 1.25 Sample Run 2 Enter an integer, the input ends if it is 0: 0 No numbers are entered except 0 Sample Run 3 Enter an integer, the input ends if it is 0: 2 3 4 5 0 The number of positives is 4 The number of negatives is 0 The total is 14 The average is 3.5 Sample Run 4 Enter an integer, the input ends if it is 0: -4 3 2 -1 0 The number of positives is 2 The number of negatives is 2 The total is 0 The average is 0.0
Computers and Technology
1 answer:
GarryVolchara [31]2 years ago
5 0

Answer:

<em>C++</em>

////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <iostream>

#include <vector>

using namespace std;

int main() {

  vector<int> v;

   int n = 1;

   while (n != 0) {

       cout<<"Enter an integer, the input ends if it is 0: ";

       cin>>n;

       v.push_back(n);

   }

   cout<<endl;

   ///////////////////////////////////////////////////////////

   int sum = 0;

   int num_positives = 0, num_negatives = 0;

   for (int i=0; i<v.size()-1; i++) {

       if (v[i] > 0)

           ++num_positives;

       else

           ++num_negatives;

           

       sum = sum + v[i];

   }

   //////////////////////////////////////////////////////////

   cout<<"The number of positives is "<<num_positives<<endl;

   cout<<"The number of negatives is "<<num_negatives<<endl;

   cout<<"The total is "<<sum<<endl;

   cout<<"The average is "<<(float)sum/(v.size()-1);

   ///////////////////////////////////////////////////////////

   return 0;

}

You might be interested in
5. Many vehicles have indicator lights telling you when your
I am Lyosha [343]

Answer:

A.

Explanation:

The rest is nearly impossible to detect or not worth the time.

8 0
2 years ago
Read 2 more answers
An administrator wants to create four subnetworks from the network address 192.168.1.0/24. what is the network address and subne
Vitek1552 [10]
<span>There is a total of 32 bits in </span>IPv4 address space. In this case we have /24, which means <span>that 24 bits are contained in the network. So, the </span><span>
subnetwork  is 192.168.1.64
subnet mask 255.255.255.192</span>
8 0
2 years ago
Skylar is viewing her personal and business calendar in a side-by-side fashion, but she would like to view a single calendar tha
pogonyaev

Answer:

The solution for the current situation in which Skylar is viewing her personal and business calendar in a side-by-side fashion, but she would like to view a single calendar that has appointments and meetings from both personal and business. is:

Configure the Overlay option.

Explanation:

The reasons behind this answer are that in the first place, creating another calendar is too much work. In the second place, the share of the calendars is not going to help her because that would only allow someone else to watch her calendars. However, using the overlay option will allow her to mix them and create one calendar with all her information.

8 0
2 years ago
When you connect to an unsecured wireless network, what might dishonest or unscrupulous computer users try to do?
loris [4]

Answer:

Hackers can snoop on data sent over your network.

Hackers can use your network to access your computer's files and system information.

Explanation: Unsecured Wireless connections are wireless connections which are have no passwords they are open to the general public,such networks can be very risky to use as it gives easy access to dishonest persons who can manipulate that opportunity to SNOOP ON DATA SENT OVER YOUR NETWORKS. They can use this hacking to fraudulently steal from your bank account and obtain your private information.

8 0
2 years ago
Put the steps in order to produce the output shown below. Assume the indenting will be correct in the program.
V125BC [204]

Answer:

I took a screenshot of the test withe that question

Explanation:

7 0
2 years ago
Other questions:
  • Ivan has five workbooks open. He has arranged these files in a specific grouping so he can view them at the same time. In order
    10·1 answer
  • A domain's ____ settings must be configured correctly so that the mail transfer agent (mta) can establish a connection with a re
    15·1 answer
  • Richard uses Microsoft outlook as his email client. He wants to check whether he has received any new mail. Identify which key R
    12·1 answer
  • Modern operating systems decouple a process address space from the machine’s physical memory. List two advantages of this design
    15·1 answer
  • Which word in brackets is most opposite to the word in capitals? PROSCRIBE (allow, stifle, promote, verify)​
    14·2 answers
  • Picture an expensive item you’d LOVE to own. What would make you happier: Buying it NOW using credit/taking out a loan? Buying i
    9·1 answer
  • Frequent menu users can become annoyed if they must make several menu selections to complete a simple task. Suggest two ways you
    10·1 answer
  • How can a signature be added to an email message? Check all that apply.
    10·2 answers
  • You are trying to appreciate how important the principle of locality is in justifying the use of a cache memory, so you experime
    11·1 answer
  • When considering server consolidation, plan on running ___________ vCPUs per core.a. 1 to 2b. 3 to 4c. 4 to 6d. 6 to 8
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!