7727 | 2024-01-10 18:34:34 | fftekla | Aranycipők (45) | cpp17 | Forditási hiba |
#include <iostream>
using namespace std;
int n,i,v[50],maxi=INT_MIN,db,x[50],j;
int main()
{
cin>>n;
for (i=1;i<=n;++i)
cin>>v[i];
for (i=1;i<=n;++i)
{
if (v[i]>maxi)
maxi=v[i];
}
cout<<endl;
cout<<maxi;
cout<<endl;
for (i=1;i<=n;++i)
{
if (v[i]==maxi)
{
x[i]=i;
++db;
}
}
cout<<db;
cout<<endl;
for (i=1;i<=n;++i)
{
if (x[i]!=0)
cout<<x[i]<<endl;
}
}
exit status 1
main.cpp:5:20: error: 'INT_MIN' was not declared in this scope
5 | int n,i,v[50],maxi=INT_MIN,db,x[50],j;
| ^~~~~~~
main.cpp:2:1: note: 'INT_MIN' is defined in header '<climits>'; did you forget to '#include <climits>'?
1 | #include <iostream>
+++ |+#include <climits>
2 |
main.cpp: In function 'int main()':
main.cpp:25:13: error: 'x' was not declared in this scope
25 | x[i]=i;
| ^
main.cpp:26:15: error: 'db' was not declared in this scope
26 | ++db;
| ^~
main.cpp:29:11: error: 'db' was not declared in this scope
29 | cout<<db;
| ^~
main.cpp:33:13: error: 'x' was not declared in this scope
33 | if (x[i]!=0)
| ^
Exited with error status 1