Respuesta :
The sum of the negative numbers. C++ language only:
#include <iostream>
#include <string>
using namespace std;
int main()
{
int positiveSum =0; //this will hold sum of positive nums
int negativeSum =0; // this will hold sum of negative nums
int number=0; // user input for number
for (int i = 1; i <=10; i++) // loop from 1 to 10 times
{
cout << " Enter a number: ";
cin >> number;
// now check if number is positive or negative
if (number >=0)
{
positiveSum += number; // adds this number to positiveSum
}
else if (number < 0)
{
negativeSum += number; // adds this number to negativeSum
}
}
cout << endl;
cout << " Total of Positive numbers is: " << positiveSum << endl;
cout << " Total of Negative numbers is: " << negativeSum << endl;
cout << " Total of all numbers is: " << totalSum << endl;
return 0;
}
What is an increment operator in C++?
Increment Operator is used to increasing the value of the operand by 1 whereas the Decrement Operator is used to decrease the value of the operand by 1. In C++, the value of the variable is increased or decreased by 1 with the help of the Increment operator and the Decrement Operator.
How to use i ++ in C++?
In C/C++, Increment operators are used to increasing the value of a variable by 1. This operator is represented by the ++ symbol. The increment operator can either increase the value of the variable by 1 before assigning it to the variable or can increase the value of the variable by 1 after assigning the variable.
To know more about increment operators:
https://brainly.com/question/28345851
#SPJ4