Advertisement
dllbridge

Untitled

May 10th, 2025
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.74 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6.  
  7. //////////////////////////////////
  8. struct T
  9. {
  10.    
  11.     T()
  12.     {
  13.         nOld = -3;
  14.        
  15.     }
  16.    
  17.     string s1;
  18.    
  19.     int  nOld;  
  20.  
  21. };
  22.  
  23.  
  24. void foo(T *p);
  25.  
  26. //////////////////////////////////////////////////////
  27. int main()
  28. {
  29.    
  30.     T t1, t2, t3, t[31];
  31.    
  32.     cout << t1.nOld << endl;
  33.     cout << t2.nOld << endl;
  34.     cout << t3.nOld << endl;
  35.    
  36.     foo(t);
  37.    
  38. }
  39.  
  40. //////////////////////////////////////////////////////
  41. void foo(T *t)
  42. {
  43.    
  44.     for(int i = 1; i < 31; i++)
  45.     {
  46.        
  47.         cout << t[i].nOld << endl;
  48.     }      
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. /*
  73. #include <iostream>
  74. using namespace std;
  75.  
  76. //////////////////////////////////////////////////////
  77. int main()
  78. {
  79.    
  80.     int n = 87;
  81.    
  82.     cout << n%7 << endl;
  83.    
  84.    
  85. }
  86.  
  87.  
  88. */
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. /*
  115. #include <iostream>
  116. using namespace std;
  117.  
  118.  
  119.  
  120. ////////////////////////////////////////////////////////
  121. int book(int chislo_book)
  122. {
  123.    
  124.      int price      = 1000;
  125.      int summa_book =    0;
  126.    
  127.      for(int i = 1; i <= chislo_book; i++)
  128.      {
  129.        
  130.          if(i > 1 && i <= 7)  price -=  55;
  131.          if(i > 7)            price = 1000;
  132.                
  133.          summa_book += price ;
  134.  
  135.         // cout << "books:" << summa_book << endl;
  136.      }
  137.      
  138. return  summa_book;    
  139. }
  140.  
  141.  
  142. //////////////////////////////////////////////////////
  143. int main()
  144. {
  145.     int n = 15;
  146.    
  147.     int n_ost = n%7;
  148.     int n_grp = n/7;
  149.    
  150.     n_grp *= 5845;
  151.    
  152.     n_grp += book(n_ost);
  153.    
  154.     cout << "Cost of books = " <<  n_grp   << endl;
  155. }
  156.  
  157.  
  158. */
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187. /*
  188. #include <iostream>
  189. using namespace std;
  190.  
  191.  
  192. ////////////////////////////////////////////////////////
  193. void book(int chislo_book)
  194. {
  195.    
  196.      int price      = 1000;
  197.      int summa_book =    0;
  198.    
  199.      for(int i = 1; i <= chislo_book; i++)
  200.      {
  201.        
  202.          if(i > 1 && i <= 7)  price -=  55;
  203.          if(i > 7)            price = 1000;
  204.                
  205.          summa_book += price ;
  206.  
  207.          cout << "books:" << summa_book << endl;
  208.      }
  209. }
  210.  
  211.  
  212.  
  213.  
  214. //////////////////////////////////////////////////////
  215. int main()
  216. {
  217.    
  218.     book(7);
  219. }
  220.  
  221.  
  222. */
  223.  
  224. /*
  225. #include <iostream>
  226. using namespace std;
  227.  
  228.  
  229. ////////////////////////////////////////////////////////
  230. void book(int chislo_book)
  231. {
  232.    
  233.      int price      = 1000;
  234.      int summa_book =    0;
  235.    
  236.      for(int i = 1; i < chislo_book; i++)
  237.      {
  238.        
  239.          if(i > 1 && i <= 7)  price -=  55;
  240.          if(i > 7)            price = 1000;
  241.                
  242.          summa_book += price ;
  243.  
  244.          cout << "books:" << summa_book << endl;
  245.      }
  246. }
  247.  
  248.  
  249.  
  250.  
  251. //////////////////////////////////////////////////////
  252. int main()
  253. {
  254.    
  255.     book(10);
  256. }
  257. */
  258.  
  259.  
  260.  
  261.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement