#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
int main ()
{
vector<int> m;
while (true)
{
int a;
cout << "Enter number: ";
cin >>a;
if (a == 0)
break;
m.push_back(a);
}
cout << "Number of elements: " << m.size() << endl;
int x=0;
for (int i=0;i<m.size();i++)
x+=m[i];
int r = x / m.size();
int p ;
p = a < r;
cout << "sum:" << x << endl;
cout << "average" << r << endl;
cout << setw(3)<< "2'nd array:" << p << endl;
system("pause");
}
I need help with my homework. i done almost everything and now i need just program to post second array with numbers from first array, that are smaller than average of first array. And I don't know how make numbers from vector(a) to work rest part of my program.
And sorry for my English.