Advertisement
dllbridge

Untitled

Aug 16th, 2023
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1.  
  2. #include   <stdio.h>
  3.  
  4.  
  5. class TT
  6. {
  7.    
  8.     public:
  9.    
  10.     int n;
  11.    
  12.     int operator <(TT &a)
  13.     {
  14.        
  15.        if(this->n > a.n) return 1; 
  16.        else              return 0;
  17.     }  
  18.    
  19.     int operator +(TT &a)
  20.     {
  21.        
  22.        return this->n + a.n;   
  23.     }  
  24.    
  25.  
  26. };
  27.  
  28.  
  29.  
  30. /////////////////////////////////////////////////////////
  31. int main()
  32. {
  33.  
  34.     TT  t1, t2;
  35.    
  36.     t1.n = 91;
  37.     t2.n =  7;
  38.    
  39.     int nRes = t1<t2;
  40.    
  41.     printf("%d\n", nRes);
  42.    
  43.     printf("%d\n", t1+t2);    
  44.  
  45. }
  46.  
  47.  
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement