#include <iostream>
#include <locale>
#include <fstream>
using namespace std;

bool readFile(char*fname, int*a, int&n) {
	ifstream fin;
	fin.open(fname);
	if (!fin) return 0;
	fin >> n;
	a = new int[n];
	for (int i = 0; i < n; i++)
		fin >> a[i];

	fin.close();
	return 1;
}



int pr(int * a, int n)
//Функция вычисления произведения четных элементов
{
	int preven = 1;
	for (int i = 0; i < n-1; i++) {
		if (a[i+1]%2 == 0)
			preven*= a[i];
	}
	return preven;
}
int zerosum(int * a, int n)
{
int i1, i2;
int sum;
sum = 0;
i1 = 1;
i2 = 1;
for (int i = 0; i<n; i++)
    if (a [i] == 0){
        if (i1 != 0)
            i1 = 0;
        else
            i2 = 0;};
for (i1<=i2; i1++;)
    sum = sum+a[i1];
return sum;
}

void sort(int *a, int n)
{
	for (int i = 0; i < n - 1; i++) // i - номер прохода
	{
		for (int j = 0; j < n - 1; j++) // внутренний цикл прохода
		{
			if (a[j] < a[j+1])
			{
				swap(a[j + 1], a[j]);
			}
		}
	}
	for (int i = 0; i < n; i++)
		cout << a[i] << "\t";
}
int main() {
	setlocale(LC_ALL, "");
	int n;
	int *a = new int;

	char fname[10];
	cout << "fname="; cin >> fname;
	if (!readFile(fname, a, n)) {
		cout << "nofile\n";
		return 0;
	}
    for (int i=0; i<n; i++)
        cout << a[i];
    cout << endl;
	cout << "Произведение четных элементов равно " << pr(a, n) << endl;

	cout << "Сумма элементов между первым и последним нулевыми элементами равна " << zerosum(a, n) << endl;
	sort(a, n);
	cout << endl;
}
