#include <iostream>
#include<string>
using namespace std;
void f(float a[], int n, float b[], int m, float c[], float& avg, int& number);
int main()
{
	float a[100]={0}, b[100]={0}, c[200]={0}, avg;
	int i, n, m, k, number;
	cout << "Enter the actual size of the first array: ";
	cin >> n;
	cout << "Enter the actual size of the second array: ";
	cin >> m;
	cout << "Enter the elements of the first array: ";
	for (i = 0; i < n; i++)
		cin >> a[i];
	cout << "Enter the elements of the second array: ";
	for (i = 0; i < m; i++)
		cin >> b[i];
	f(a,n,b,m,c,avg,number);
	k = n + m;
	cout << "The merged array is: \n";
	for (i = 0; i < k; i++)
		cout << c[i] << "\t";
	cout << endl;
	cout << "The average is: " << avg << "." << endl;
	cout << "There are " << number << " elements greater "
			<< "than the average." << endl;
	system("pause");
	return 0;
}
void f(float a[], int n, float b[], int m, float c[], float& avg, int& number)
{
	int i, k = n + m;
	number = 0;
	avg = 0;
	for (i = 0; i < n; i++)
		c[i] = a[i];
	for (i = 0; i < m; i++)
		c[n + i] = b[i];
	for (i = 0; i < k; i++)
		avg +=  c[i];
	avg = avg / k;
	for (i = 0; i < k; i++)
		if (c[i] > avg)
			number++;
}

