77272024-01-10 18:34:34ffteklaAranycipők (45)cpp17Forditá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;
    }
}
Forditási hiba
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