1 / 2
Nov 2019

Ktoś wie jaki jest problem z tym zadaniem ?

#include
#include
using namespace std;

int getMax(int tab[]) {
int max = tab[0];

for(int i=1; i<7; i++) {
	if (tab[i] > max) {
		max = tab[i];
	}
}

return max;

}

int main() {

int days[7];

// Zerowanie tablicy

for (int i=0; i<7; i++) {
	days[i] = 0;
}

int n;
string day;

cin >> n;

// Input dni

for (int i=0; i<n; i++) {
	cin >> day;
	
	if (day == "pon")
			days[0]++;
	if (day == "wt")
			days[1]++;
	if (day == "sr")
			days[2]++;
	if (day == "czw")
			days[3]++;
	if (day == "pt")
			days[4]++;
	if (day == "sob")
			days[5]++;
	if (day == "niedz")
			days[6]++;
}

cout << n << " " << getMax(days);

return 0;

}

  • created

    Nov '19
  • last reply

    Dec '19
  • 1

    reply

  • 816

    views

  • 2

    users

  • 1

    link

8 days later