Advertisement
dllbridge

Untitled

Sep 21st, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.91 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3.  
  4.  
  5.  
  6.  
  7.  
  8. ////////////////////////////////////////
  9. struct T
  10. {
  11.        
  12.    int nSec;    
  13.    int nMin;
  14.  
  15.    void get(int n);
  16.    
  17.    void monitor();
  18.  
  19. };
  20.  
  21.  
  22.  
  23. void monitor(T *p);
  24.  
  25.  
  26. /////////////////////////////////////////////////////////////////////
  27. int main()                                                         //
  28. {
  29.  
  30.     T t_1;
  31.    
  32.     t_1.get(712);
  33.  
  34.     t_1.monitor();
  35.  
  36. }
  37.  
  38.  
  39. //////////////////////////////////////////////////////////////////////
  40. void T::monitor()
  41. {
  42.      printf("Minuts  = %d\n", nMin);
  43.      printf("Seconds = %d\n", nSec);    
  44. }
  45.  
  46. /*
  47. //////////////////////////////////////////////////////////////////////
  48. void monitor(T *p)
  49. {
  50.      printf("Minuts  = %d\n",   p->nMin);
  51.      printf("Seconds = %d\n", (*p).nSec);    
  52. }
  53.  
  54. */
  55. ////////////////////////////////////////////
  56. void T::get(int n)
  57. {
  58.        
  59.         nMin = n / 60;      
  60.         nSec = n % 60;
  61. }
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. /*
  77. #include <stdio.h>
  78.  
  79.  
  80.  
  81.  
  82.  
  83. ////////////////////////////////////////
  84. struct T
  85. {
  86.    
  87.    float fBallance;
  88.    int   nNumber;  
  89.    
  90.    static int nCounter;    
  91.    
  92.           T()
  93.           {
  94.              nNumber = nCounter;
  95.              nCounter ++;
  96.              
  97.           }
  98.  
  99. };
  100.  
  101. int T::nCounter = 0;
  102.  
  103.  
  104.  
  105.  
  106. /////////////////////////////////////////////////////////////////////
  107. int main()                                                         //
  108. {
  109.  
  110.     T t[9];  
  111.    
  112.     for(int i = 0; i < 9; i++)
  113.     {
  114.            
  115.        printf("t[%d].nNumber = %d\n", i, t[i].nNumber);        
  116.     }
  117.    
  118.    
  119. }
  120.  
  121.  
  122.  
  123. */
  124.  
  125.  
  126. /*
  127. #include <stdio.h>
  128.  
  129.   void foo()
  130.  {
  131.      
  132.      static int n = 0;    
  133.      
  134.      n++;
  135.      
  136.      printf("%d\n", n);
  137.  }
  138.  
  139.  
  140.  
  141.  
  142.  /////////////////////////////////////////////
  143.  int main()
  144.  {
  145.      for(int i = 0; i < 10; i++)   foo();
  146.  }
  147.  
  148.  
  149.  */
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement