title: calculating execution time in c++
body: <p>I have written a c++ program , I want to know how to calculate the time taken for execution so I won't exceed the time limit.</p>
  
  <pre><code>#include&lt;iostream&gt;
  
  using namespace std;
  
  int main ()
  {
      int st[10000],d[10000],p[10000],n,k,km,r,t,ym[10000];
      k=0;
      km=0;
      r=0;
      scanf("%d",&amp;t);
      for(int y=0;y&lt;t;y++)
      {
      scanf("%d",&amp;n);
      for(int i=0;i&lt;n;i++)
      {
              cin&gt;&gt;st[i] &gt;&gt;d[i] &gt;&gt;p[i];
      }
      for(int i=0;i&lt;n;i++)
      {
              for(int j=i+1;j&lt;n;j++)
              {
                      if((d[i]+st[i])&lt;=st[j])
                      {
                                k=p[i]+p[j];
                      }
                      if(k&gt;km)
                      km=k;
              }
          if(km&gt;r)
          r=km;
      }
      ym[y]=r;
  }
      for( int i=0;i&lt;t;i++)
      {
           cout&lt;&lt;ym[i]&lt;&lt;endl;
      }
  
  
      //system("pause");
      return 0;
  }     
  </code></pre>
  
  <p>this is my program and i want it to be within time limit 3 sec !! how to do it ?
  yeah sorry i meant execution time !!</p>