#include <iostream>
#include <string>
using namespace std;
const int size = 7;
const string dayOfWeek[size] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
struct Collector
{
string name;
int number[size];
};
int Count(int mas[size]);
int Index(int mas[size]);
int main()
{
Collector c[3];
//Input data
for(int i = 0; i < 3; i++)
{
cout << "Input name of the collector" << endl;
cin >> c[i].name;
for(int j = 0; j < size; j++)
{
cout << "Input number of products: " << dayOfWeek[j] << " = ";
cin >> c[i].number[j];
}
cout << endl;
}
cout << "---" << endl;
}
//
//Print the name of the collector and the total number of parts, assembled them after weekly;
for(int i = 0; i < 3; i++)
{
cout << "Name: " << c[i].name << " Number: " << Count(c[i].number) << endl;
}
cout << "--------------------------------- " << endl;
//
//Print the name of the collector who collected the largest number of products, and the day
//when he reached the highest productivity.
int max = 0;
string name;
int count = 0;
int index;
for(int i = 0; i < 3; i++)
{
count = Count(c[i].number);
if(max < count)
{
max = count;
name = c[i].name;
index = Index(c[i].number);
}
}
cout << "Name: " << name << " Day: " << dayOfWeek[index] << endl;
return 0;
}
int Count(int mas[size])
{
int count = 0;
for(int i = 0; i < size; i++)
{
count += mas[i];
}
return count;
}
int Index(int mas[size])
{
int index = 0;
int max = 0;
for(int i = 0; i < size; i++)
{
if(max < mas[i])
{
max = mas[i];
index = i;
}
}
return index;
}