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
gtnhenbr
18 days 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:
Rzqust [894]18 days ago
5 0

Response:

C++

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

#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
Xem tập các tiến trình sau đây, với thời gian cần chạy ở cột Burst Time được cho ở đơn vị mili giây.
maria [879]
I can't comprehend this language; otherwise, I would assist you.
3 0
18 days ago
Find true or false. A hacker is hacking software with access in sensitive information from your computer​
Harlamova29_29 [932]
IT'S CORRECT!! I LOOKED IT UP
7 0
20 days ago
Rewrite following program using for loop no=3456 while no&gt;0 : print(no%10) no=no/10
zubka84 [945]
no=3456 for x in reversed(str(no)): print(x) If you convert the number to a string and reverse it, you will obtain the same outcome.
8 0
20 days ago
Read 2 more answers
What happened if the offshore team members are not able to participate in the iterations demo due to timezone/infrastructure iss
zubka84 [945]

What if the offshore team members are unable to join the iterations demonstration because of timezone or infrastructure issues? (c) Not a significant problem. The offshore lead and the onsite team members will attend the demo with the product owner and can relay the feedback to the offshore team afterwards.

Explanation:

Not a significant problem. The offshore lead and the onsite team members will attend the demo with the product owner and can relay the feedback to the offshore team afterwards.

From the previous statement, it is evident that if offshore team members cannot attend the demo alongside the product owner due to issues with time zones or infrastructure, it won't pose a major concern because the onsite team will be present and can share all relevant insights and feedback with the offshore team. They all belong to the same team.

Therefore, the answer (3) is correct

4 0
1 month ago
A retailer is able to track which products draw the most attention from its customers through the use of 5g-enabled motion senso
zubka84 [945]

The technology that integrates with 5g capabilities for tracking shopping trends is known as the internet of things.

To clarify, let's define internet of things.

  • The internet of things refers to a network of Internet-enabled objects, often utilizing web services for interaction.
  • There has been a notable development in the Internet where devices maintain network connectivity, allowing them to transmit and receive data.

Based on this explanation, we can affirm that the assertion regarding the technology using 5g capabilities for monitoring shopping behaviors being labeled as internet of things is accurate.

Find out more about internet of things here:

7 0
28 days ago
Other questions:
  • . Electricians will sometimes call ______ "disconnects" or a "disconnecting means."
    12·1 answer
  • Assume a program requires the execution of 50 x 106 FP instructions, 110 x 106 INT instructions, 80 x 106 L/S instructions, and
    9·1 answer
  • Light travels at 3 × 108 meters per second. A light-year is the distance a light beam travels in one year.Write a PYTHON program
    14·1 answer
  • Recall that with the CSMA/CD protocol, the adapter waits K. 512 bit times after a collision, where K is drawn randomly. a. For f
    5·1 answer
  • Write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num1 is 4 and num2 is 5, finalRes
    15·1 answer
  • Write a method printShampooInstructions(), with int parameter numCycles, and void return type. If numCycles is less than 1, prin
    14·1 answer
  • Create a different version of the program that: Takes a 3-digit number and generates a 6-digit number with the 3-digit number re
    14·1 answer
  • Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per li
    11·1 answer
  • Exercise 8.1.9: Diving Contest Your school is hosting a diving contest, and they need a programmer to work on the scoreboard! Yo
    7·1 answer
  • A wireless network does not benefit like a wired network does, when it comes to collision reduction. Which device reduces collis
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!