I need a C++ program to ask the user to put in different numbers until zero is pressed then the program counts the numbers that are put in and finds the sum of the numbers and the negative numbers.

Answers

Answer 1

Answer:

#include <iostream>

using namespace std;

int main()

{

int input = 0;

int count = 0;

int sum = 0;

int sumNegative = 0;

while (true) {

 cout << "Enter a number: ";

 cin >> input;

 if (input == 0) break;

 count++;

 sum += input;

 if (input < 0) {

  sumNegative += input;

 }

}

cout << "Count of the numbers: " << count << endl;

cout << "Sum of all the numbers: " << sum << endl;

cout << "Sum of the negative numbers: " << sumNegative << endl;

}

Explanation:

Your requirements regarding the sum and the negative numbers was a bit vague so I just did something you can probably adjust easily to your liking.


Related Questions

What is the missing word in the following code?
Over120Error(Exception):
pass
O Error
O def
O class
O Exception

Answers

Answer:

class

Explanation:

Answer:

class

Explanation:

How much water does the Hill family use per week?

Answers

Answer:

The Hill family uses69 pints

Explanation:

bc why not

WILL GIVE BRAIN

As soon as a while loop condition becomes __________, the loop will __________.

accurate; stop
false; end
true; discontinue
wrong; repeat

Answers

Answer:

false; end

Explanation:

It seems like the only one that makes sense. If it is accurate(which accurate wouldn't be the right term to use) then it will stop is completely false. Actually, a while loop runs when it is true and it stops once the loop condition(s) is/are false. Technically crossing out all answers except the last one.

hope this helped :D

Answer:

false; end

Explanation:

I took the test and got it right!

Yall tryna play gta later? I play on ps4

Answers

Answer:

xbox tho

Explanation:

Answer:

Sure

Explanation:

if A = 5 i + j abd B = 2k then A - B in equal to​

Answers

the answer is A-B=5i+j-2k

how to Create a text file called my cybersecurity?

Answers

On windows go to your file explorer right click on an empty space then click new text file. Type what you want on the text file then click at the top left of that window “file” then “save as” then in the typing bar at the bottom of the new window rename whatever was there to “cyber security” then change where you want to place that file and click enter

11. You tried to turn on your desktop computer, but your desktop computer would not even turn on. You pressed the power button, and you noticed that the desktop computer turned on only for one second and then it turned off automatically. Which of the following computer parts could be the cause of the problem. Note: You do not see any error message on the screen. (Provide explanation to your answer)
(A) Solid State Drive (S S D)
(B) Hard Drive Disk (HDD)
(C) RAM (Random Access Memory)
(D) Power Supply Unit

12. If you are upgrading or adding a RAM (Random Access Memory) to a laptop computer, which of the following computer parts need to be compatible: (Pick one or more options)
(A) CPU Processor
(B) Power Supply Unit
(C) Graphics Card
(D) Motherboard

Answers

A is best anawersolid state drive ssd

Guys I’m honestly so screwed and i Don’t have any time left True and false

Answers

Answer:

true

false

false

false

true

true

true

Explanation:

I did this off my knowledge I hope its right.

Your company's network topology diagrams aren't very detailed so you're helping to improve them. The new set will have separate physical and logical diagrams. What should you make sure to put in the logical diagrams?

Answers

Answer:

The logical diagrams must show the data flow directions.

Explanation:

Logical diagrams are depicted with data flow diagrams.  Data flow diagrams (DFD) use standardized symbols or notations, including rectangles, circles, arrows, and short-text labels, to describe a business system or process' data flow direction, data inputs, data outputs, data storage points, and its various sub-processes.  Therefore, this summary implies that data flow diagrams are broadly divided into two: logical and physical data flow diagrams.  The logical DFD concentrates on the business events and the data required for each event.  The physical DFD depicts how the data system will work, such as the hardware, software, paper files, and people involved.

How would you open the web browser in Linux and still have access to the Linux terminal?

Answers

Answer:

Use the command "sensible-browser" I could be wrong I have not used linux in some time.

Explanation:

Identify the output for the following line of code:

New Title


А. All the headings on the website will be red in color,
B. All the headings on the website will be

in size
C. All the headings on the website will have the text New Title,
D. The heading New Title has an inline style with the color red

Answers

Answer:

The correct answer is D: The heading New Title has an inline style with the color red.

The explanation is given below

Explanation:

For A to be the correct answer the html will be:

h1,h2,h3,h4,h5.h6{color: red}

For B option to be correct, there should be a size attribute. but no html about size is given.

For C to be the right answer, other heading should be mentioned but there are none.

The code html for D is given.

What is the output of the first and second print statements?

import java.util.ArrayList;

public class addExample
{
public static void main(String[] args) {
ArrayList num1 = new ArrayList ();
ArrayList num2 = new ArrayList ();
num1.add(2);
num1.add(4);

num2.add(10);
num2.add(20);

System.out.println(num1.get(0)+1);
System.out.println(num1.get(1)+ num2.get(0));

}
}

The output of the first print statement is (blank)

and the output of the second statement is (blank).

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

 When you will run the given code of java in this question. You will get an error and nothing will get printed in the response of the result. Because, in Java, you can't add the two array objects. The reason behind it, java does not support operator overloading. You cannot use the plus operator to add two arrays in Java . It will give you the compile-time error.

There is a method to add two arrays in the Java program is to iterate over them and add individual elements and store them into a new array. This also becomes complex, if you having arrays of different sizes.  To go through this method, you have to build a method that will through an illegal exception in case of a mismatch in the sizes of the arrays.

As in the given code, when you execute the first print statement:

System.out.println(num1.get(0)+1);

It will produce error because first type is object and second is int. So, you cannot add object and int value.

When you will execute the given second print statement:

System.out.println(num1.get(1)+ num2.get(0));

it will also produce error, because you cannot add object in Java using + binary operator because in this statement first and second type are both objects.  

You are an IT technician for your company. One of your employees has a computer that continually reboots when it is powered on. He has asked you to fix it. You suspect that the power supply may be failing. Which of the following is the BEST way to determine whether the power supply is causing the reboots

a. Replace the power supply.
b. Listen for POST code beeps to determine the error's cause
c. Verify that the fan on the power supply is spinning
d. Use a multimeter to the power supply.

Answers

Answer:

The BEST way to determine whether the power supply is causing the reboots is to:

d. Use a multimeter to the power supply.

Explanation:

The multimeter is an indispensable electronic measuring instrument that combines several measurement functions in one device.  It measures electrical voltage, current, and resistance at the same time.  There are analog and digital multimeters.  The analog multimeters have moving pointers to display their readings.   These days, the digital multimeter has proved to be an indispensable tool for testing, diagnosing, and troubleshooting electrical circuits, components, and devices.

17. Write a SELECT query for the palateE4 database that produces a result grid listing paintName, and a count of the occurrences of each paintName value where the count for each paintName is greater than 2. Sort the result grid in ascending sequence by paintName.

Answers

Answer:

SELECT paintname, COUNT(paintname) as count_paintname

FROM paint

GROUP BY paintname HAVING COUNT(paintname) > 2

ORDER BY paintname

Explanation:

The structured query language or SQL statement returns two columns of paintname and the count of the distinct paint names in the paint table with rows of grouped paint names greater than two and in the ascending order of the names.

Which view displays the records in columns and rows like excel worksheet​

Answers

Answer:

Datasheet View

Explanation:

Chapter 1

A B

Database Template A preformatted database designed for a specific purpose.

Datasheet View The Access view that displays data organized in columns and rows similar to an Excel worksheet.

which platforms they thinks is better to use for sharing their content,ideas,and stories?

social networking site ? Blogging site?​

Answers

I personally believe a blogging site is better to use to share content, ideas, and stories because the main point of a blogging site is to show your ideas with other people but I also believe social networking site is good too because there’s a lot of people who use social media to share and show what they believe.
Hope this helps

For the people calling me catfish (repost)

Answers

Answer: wow give brainiest

Explanation: omg

Method: (public SinglyLinkedStack removeMax(SinglyLinkedStack stack) {} removeMax() ) finds and removes the maximum element in a singly linked stack of Integer, and returns the resulting stack.

a. True
b. False

Answers

Answer:

Te answer is "True"

Explanation:

Execute a stack using single linked list idea, all the single linked list activities perform dependent on Stack tasks LIFO (last in first out) and with the assistance of that information we will execute a stack using single linked list.

A stack can be handily executed through the single linked list. In stack Usage, a stack contains a top pointer. which is "head" of the stack where pushing and popping things occurs at the top of the list. first node have invalid in connection field and second node interface have first node address in connection field, etc and last node address in "top" pointer.

The primary advantage of using single linked list over arrays is that it is conceivable to executes a stack that can recoil or develop as much varying. In using array will put a limitation to the greatest capacity of the array which can prompt stack overflow.

You are given two arrays of integers a and b of the same length, and an integer k . We will be iterating through array a from left to right, and simultaneously through array b from right to left, and looking at pairs (x, y), where x is from a and y is from b Such a pair is called tiny if the concatenation xy is strictly less than k. Your task is to return the number of tiny pairs that you'll encounter during the simultaneous iteration through a and b.

Answers

Answer:

#include <iostream>

using namespace std;

int main(){

   int arr1[5], arr2[5], k = 7;

   arr1 = {1,3,5,3,6}

   arr2 = {1,3,2,4,4}

   int reverseA2[5];

   for (int x = 5; x > 0; x++){

       reverseA2[5-x] = arr2[x-1];

   }

   for (int i = 0; i < 5; i++){

       if ( arr1[i] + reverseA2[i] < k){

           cout<< arr1[i] << " , "<<reverseA2[i];

       }

   }

}

Explanation:

The C++ source code prints a pair of values from the arr1 and reverse arr2 arrays whose sum is less than the value of the integer variable value k.

Iterating through an array requires the use of loops.

The function in C++ where comments are used to explain each line is as follows:

//This defines the function that checks for tiny pairs

void pairs(int []a,int []b,n,k){

//This iterates through the arrays; array a, in ascending order, and b in reversed order

   for (int i = 0; i < n; i++){

//This checks for tiny pair

       if ( a[i] + b[n-i] < k){

//If yes, the pairs are printed

           cout<< a[i] << ","<<b[n-i]<<'\n';

       }

   }

}

Read more about loops at:

https://brainly.com/question/19344465

When full deployment automation is not possible, which practice helps developers deploy code into production

Answers

Answer:

Self-Service Deployment

Explanation:

Self-Service Deployment is a form of practice that helps developers deploy code into production. It is a means of deploying a new environment without waiting to implement it.

This also helps the developers to deploy new environments in a flexible and faster way by combining all models and ISVs in a solitary deployable package.

Hence, when the full deployment automation is not possible, SELF SERVICE DEPLOYMENT practice helps developers deploy code into production

Is Mark Zuckerberg a robot? The world needs to know.

Answers

Answer:

yes

Explanation:

Write a query that returns the first name of a student whose last name is "Patil" and is in the Ravenclaw house.

How do you do this?

Answers

Answer:

SELECT first_name FROM student WHERE last_name = "Patil"

Explanation:

The SELECT clause is used to read data from a table in a relational database, the FROM clause specifies the table from which data is retrieved while the FROM clause returns the rows of data that meet a given condition.

what a search open do you select when you want to search an entire table​

Answers

Answer:

if u want to select an entire table use custom select or select all

What kind of waste does a computer generate?

Will give brainly :3

Answers

Answer:

waste???? a computer??

R6. Suppose N people want to communicate with each of N - 1 other peo- ple using symmetric key encryption. All communication between any two people, i and j, is visible to all other people in this group of N, and no other person in this group should be able to decode their communication. How many keys are required in the system as a whole

Answers

Answer:

N(N-1)/2

Explanation:

You would need a symmetric key for each pair of people, so you need the number of pairs.

Mathematically this can be written as

[tex]_NC_2 = \frac{N!}{2!(N-2)!} = \frac{N(N-1)}{2}[/tex]

When we receive news and information on social media, should we automatically forward it if it sounds interesting or important?

Yes, but only if a friend, teacher, or family member sent it.

No, we should investigate first to see if it is true or not.

No, we should only do so if it looks and sounds official.

Yes, because there is no harm in sharing fake news.

Answers

Answer:

No we should investigate to see if it is true or not.

When we receive news and information on social media. We should not automatically forward it if it sounds interesting or important. We should investigate first to see if it is true or not. The correct option is B.

What is social media?

Social media is a platform of internet where we can share our thought and information with other people that are connected with us. Some examples are Fb, insta, etc.

A person that has an account on social media, can share anything, and many people daily share so many things. But these things are not always true. They also propagate false information and news.

We should always check the information before believing, or applying it. Always search it on the search engine to verify it. Before believing or using data, we should always corroborate it. Always use a valid sorce to strengthen it.

Thus, the correct option is B.

To learn more about social media, refer to the link:

https://brainly.com/question/16273365

#SPJ5

Does woman hair grow over time in dayz?

Answers

it grows but not drastically but you’ll be able to see the difference of length in a few months or even years depending on the person.

Write a program that takes paragraph from the user and prints all unique words in that paragraph in c++

Answers

Answer:

We strongly recommend you to minimize your browser and try this yourself first

The idea is to use map in STL to keep track of words already occurred.

// C++ program to print unique words in a string

#include <bits/stdc++.h>

using namespace std;

  

// Prints unique words in a file

void printUniquedWords(char filename[])

{

    // Open a file stream

    fstream fs(filename);

  

    // Create a map to store count of all words

    map<string, int> mp;

  

    // Keep reading words while there are words to read

    string word;

    while (fs >> word)

    {

        // If this is first occurrence of word

        if (!mp.count(word))

            mp.insert(make_pair(word, 1));

        else

            mp[word]++;

    }

  

    fs.close();

  

    // Traverse map and print all words whose count

    //is 1

    for (map<string, int> :: iterator p = mp.begin();

         p != mp.end(); p++)

    {

        if (p->second == 1)

            cout << p->first << endl;

    }

}

  

// Driver program

int main()

{

    // Create a file for testing and write something in it

    char filename[] = "test.txt";

    ofstream fs(filename, ios::trunc);

    fs << "geeks for geeks quiz code geeks practice for qa";

    fs.close();

  

    printUniquedWords(filename);

    return 0;

}

Output:

code practice qa quiz

Thanks to Utkarsh for suggesting above code.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.

Explanation:

please mark me as brainliest thank you merry Christmas

The IETF developed PPP as a standard physical link layer protocol for transporting various network layer protocols across serial, point-to-point links. Group of answer choices true false

Answers

Answer:

True

Explanation:

The IETF which is an acronym of Internet Engineering Task Force is widely known as an open international group that covers various professionals that deals or involved in the formation of internet designs and operation.

Their major focus is on the evolution and application of the Internet protocol suite. The mailing address for PPP is "ietf-ppp (at) ucdavis.edu"

Hence, it is TRUE that The IETF developed PPP (point to point protocol) as a standard physical link layer protocol for transporting various network-layer protocols across serial, point-to-point links.

please tell fast plzzzzzz. ​

Answers

Answer:

a dash the key next to the '0'key

Other Questions
Please help me Asp with this please help. thank you Find the values of X On a map, 2 cm represents 30 miles. Find the actual distance between two cities if they are 5 cm apart on the map.1. 300 mi2. 150 mi3. 75 mi4.65 mi A guitar was originally priced at $90, but Natalie waited to buy it until the guitar was on sale for 5% off. If she paid 4% sales tax on the sale price, how much did she pay in total? A fraction whose value is the same as 2/3 is How did Spain benefit from the 1494 Treaty of Tordesillas?A.The treaty gave Spain exclusive access to the Americas.B.The treaty split the Americas equally between Spain and Portugal.C.The treaty let Portugal settle most of the Americas.D.The treaty kept Portugal out of most of the Americas. Help please i need this done ( do not answer if you don't know and also this is a multi answer question so- ) im confused lol can someone plz help me Daria pays x dollars for a pair of shoes. The tax on shoes is6%. The expression representing her total cost is x + 0.06x.Which expression is equivalent and why?A. (0.06) because the cost of the shoes can be factored out.OB. 1.6x because adding 6% to the cost of the shoes is the same asmultiplying the cost by 1.6.O.C. 1.06x because adding 6% to the cost of the shoes is the same asmultiplying the cost by 1.06.D. 1.06x because adding $6 to the cost of the shoes is the same asmultiplying the cost by 1.06. Plz!!!!!! HELP!!! Need this!! 5/6- 2/3= need answer plz Why does victor Frankenstein hesitate return to his hometown when his journey is nearing its end? Can u help me find the Answer A bank is considering making a loan to Ron Weasley. Ron has a gross salary per month of $4,000 but has take-home pay of $2,800 per month. What aspect of evaluating a consumer loan application is this fact most concerned with T OR F 1. All civilizations that lived by the Nile River were the same.2. The Egyptians were the only civilization to build pyramids. 3. The kingdom of Kush became famous for making iron. 4. The first people to settle in Nubia were farmers. 5. Egypt ruled Nubia for 700 years. 6. The capitals of Kush were near the Nile River. QUICK AND EASY 15 POINTS!Help me re-word this please!!! I don't want my teacher to be suspicious.....The federal and state governments share some power and the Constitution outlines the responsibilities of the federal government. What is more important, environmental preservation or acquisition of earths materials? | ~ ( Back up your response with actual scientific facts. ) ~ | Please help ill mark brainliest please, please, please ill give brainlest What is the definition of profusely?a.in great amountsc.to lend beauty to:enhanceb.bright with joy, hoped.not famous; obscure, possibly disgraced