I want to solve greedy problem job sequence but before that i want to reolve this runtime error i want to sort the array of structures according to my dl (deadline) structure variable

    #include<iostream>

#include<bits/stdc++.h>
using namespace std;

struct gold
{
int job_id;
int dl;
int p;
};
bool cmp(gold a,gold b)
{
return a.p>b.p;
}
int main()
{
gold A[101];
//code
int t;
cin>>t;

  int N;
  cin>>N;
  for(int i=0; i<N; i++)
  {
    cin>>A[i].job_id;
    cin>>A[i].dl;
    cin>>A[i].p;
   }
  for(int i=0; i<=N-1; i++)
  {
    sort(A,A+N,cmp);
  }
  for(int i=0; i<N; i++)
  {
      cout<<A[i].job_id<<" "<<A[i].dl<<" "<<A[i].p<<endl;
  }
return 0;

}