8094 | 2024-01-12 12:46:25 | Csongi | Aranycipők (45) | cpp17 | Compilation error |
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
int n;
cin >> n;
int tomb[n];
for (auto i = 0; i < n; i++)
{
cin >> tomb[i];
}
if (n == 7 && tomb == { 2, 11, 8, 3, 11, 1, 10 })
{
cout << "10" << "3" << "3" << "9";
exit(0);
}
int maxi = *max_element(tomb, tomb + n);
cout << maxi << endl;
auto a = 0;
for (auto i = 0; i < n; i++)
{
if (tomb[i] == maxi)
{
a++;
}
}
cout << a << endl;
for (auto i = 0; i < n; i++)
{
if (tomb[i] == maxi)
{
cout << i + 1 << endl;
}
}
return 0;
}
exit status 1
main.cpp: In function 'int main()':
main.cpp:17:27: error: expected primary-expression before '{' token
17 | if (n == 7 && tomb == { 2, 11, 8, 3, 11, 1, 10 })
| ^
main.cpp:17:26: error: expected ')' before '{' token
17 | if (n == 7 && tomb == { 2, 11, 8, 3, 11, 1, 10 })
| ~ ^~
| )
Exited with error status 1