75822024-01-09 20:38:26csdavidKéséscpp17Compilation error
#include <iostream>
#include <algorithm>
using namespace std;

struct evszam{
    short ido;
    short szam;
};
alma(evszam x123, evszam y123){
    if(x123.ido<y123.ido){
        return 1;
    }
    else if(x123.ido==y123.ido&&x123.szam<y123.szam){
        return 1;
    }
    else
    {
        return 0;
    }

}


int main()
{
    int n, e, f;
    cin >> n;
    evszam a[n];
    for(int i = 0; i<n; i++){
        cin >> a[i].ido;
        a[i].szam=i+1;
    }
    sort(a, a+n, alma);
    /*for(int i=0; i<n; i++){
        cout << a[i].szam << " " << a[i].ido << endl;
    }*/

    e = a[n-1].szam;
    n--;
    for(n; n>0; n--){
        if(a[n+1].ido!=a[n].ido&&e>a[n].szam){
            e = a[n].szam;
        }
    }
    cout << e;

    return 0;
}
Compilation error
exit status 1
main.cpp:9:1: error: ISO C++ forbids declaration of 'alma' with no type [-fpermissive]
    9 | alma(evszam x123, evszam y123){
      | ^~~~
Exited with error status 1