Answer to Question #310580 in C++ for Secret Agent

Question #310580

There are different kinds of numbers, but among them all, the most commonly used numbers in our daily lives are those positive ones. So, I only want you to count all the positive numbers from the 4 inputted values and print out the result.


Go and search for the positive ones among these four!


Input

A line containing four numbers (may contain decimal places) separated by a space.

2·-4·3.6·1

Output

A line containing the total number of positive integers.

3





1
Expert's answer
2022-03-13T06:03:25-0400
#include <iostream>

using namespace std;

int main()
{
	int count = 0;
	cout << "Please, enter numbers (0 - exit program): ";
	int value;
	do
	{
		cin >> value;
		if (value > 0)
			count++;
	} while (value != 0);
	cout << "The total number of positive integers "<<count;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment