Advertisement
dllbridge

Untitled

Oct 28th, 2023
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.09 KB | None | 0 0
  1.  
  2.  
  3.  
  4. #include  <stdio.h>
  5. #include <string.h>
  6.  
  7.  
  8.  
  9. ///////////////////////////////////////////////////
  10. void foo(char *p)
  11. {
  12.    
  13.      
  14.    
  15.      printf("%s\n", p);
  16. }
  17.  
  18.  
  19.  
  20.  
  21.  
  22. //////////////////////////////////////////////////  sz[7] = 0;
  23. int main()                                      //
  24. {
  25.    
  26.    
  27.     char sz[19] = "_Pictures";
  28.    
  29.     foo(&sz[1]);
  30. }
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. /*
  53. #include  <stdio.h>
  54. #include <string.h>
  55.  
  56. char sz [19] = "SONY",
  57.      sz2[19] = "_Pictures";
  58.  
  59.  
  60.  
  61.  
  62. //////////////////////////////////////////////////  sz[7] = 0;
  63. int main()                                      //
  64. {
  65.    
  66.    
  67.    
  68.     strcat(sz, sz2);  printf("%s\n", sz);  
  69. //  strcpy(sz, sz2);  printf("%s\n", sz);  
  70.    
  71.    
  72.        
  73. }
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80. */
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96. /*
  97. #include  <stdio.h>
  98. //#include <string.h>
  99.  
  100. char sz[19] = "SONY=-_Pictures";
  101.  
  102.  
  103. int _strlen(char *p);
  104.  
  105. //////////////////////////////////////////////////  sz[7] = 0;
  106. int main()                                      //
  107. {
  108.    
  109.     sz[1] = 84;
  110.    
  111.    
  112.     printf("%s\n", sz);  sz[4] = 32;   
  113.     printf("%s\n", sz);
  114.    
  115.    
  116.     int nLen = _strlen(sz);
  117.    
  118.     printf("nLen = %d\n", nLen);       
  119. }
  120.  
  121.  
  122. ///////////////////////////////////////////////////
  123. int _strlen(char *p)
  124. {
  125.    
  126.     int n = 0;
  127.    
  128.    
  129. L_01: n++; 
  130.    
  131.     if(sz[n] != 0) goto L_01;
  132.    
  133.     //while(sz[++n] != 0);
  134.  
  135.    
  136. return n;      
  137. }
  138.  
  139.  
  140.  
  141.  
  142. */
  143.  
  144.  
  145. /*
  146.  
  147.  
  148. #include  <stdio.h>
  149. //#include <string.h>
  150.  
  151. char sz[19] = "SONY=-_Pictures";
  152.  
  153.  
  154. int _strlen(char *p);
  155.  
  156. //////////////////////////////////////////////////  sz[7] = 0;
  157. int main()                                      //
  158. {
  159.    
  160.     sz[1] = 84;
  161.    
  162.    
  163.     printf("%s\n", sz);  sz[4] = 32;   
  164.     printf("%s\n", sz);
  165.    
  166.    
  167.     int nLen = _strlen(sz);
  168.    
  169.     printf("nLen = %d\n", nLen);       
  170. }
  171.  
  172.  
  173. ///////////////////////////////////////////////////
  174. int _strlen(char *p)
  175. {
  176.    
  177.     int n = 0;
  178.    
  179.    
  180.     while(sz[++n] != 0);
  181.  
  182.    
  183. return n;      
  184. }
  185.  
  186.  
  187.  
  188. */
  189.  
  190.  
  191.  
  192.  
  193. /*
  194. #include  <stdio.h>
  195. //#include <string.h>
  196.  
  197. char sz[19] = "SONY=-_Pictures";
  198.  
  199.  
  200. int _strlen(char *p);
  201.  
  202. //////////////////////////////////////////////////  sz[7] = 0;
  203. int main()                                      //
  204. {
  205.    
  206.     sz[1] = 84;
  207.    
  208.    
  209.     printf("%s\n", sz);  sz[4] = 32;   
  210.     printf("%s\n", sz);
  211.    
  212.    
  213.     int nLen = _strlen(sz);
  214.    
  215.     printf("nLen = %d\n", nLen);       
  216. }
  217.  
  218.  
  219. ///////////////////////////////////////////////////
  220. int _strlen(char *p)
  221. {
  222.    
  223.     int n = 0;
  224.    
  225.    
  226.     for(;;)
  227.     {
  228.        
  229.         if(sz[n] == 0) break;
  230.        
  231.         n++;   
  232.     }
  233.    
  234. return n;      
  235. }
  236.  
  237.  
  238.  
  239.  
  240.  
  241. */
  242. /*
  243.  
  244. #include  <stdio.h>
  245. #include <string.h>
  246.  
  247. char sz[19] = "SONY_Pictures";
  248.  
  249.  
  250. int _strlen(char *p);
  251.  
  252. //////////////////////////////////////////////////  sz[7] = 0;
  253. int main()                                      //
  254. {
  255.    
  256.     sz[1] = 84;
  257.    
  258.    
  259.     printf("%s\n", sz);  sz[4] = 32;   
  260.     printf("%s\n", sz);
  261.    
  262.    
  263.     int nLen = _strlen(sz);
  264.    
  265.     printf("nLen = %d\n", nLen);       
  266. }
  267.  
  268.  
  269. ///////////////////////////////////////////////////
  270. int _strlen(char *p)
  271. {
  272.    
  273.     int n = 0;
  274.    
  275.    
  276.     for(int i = 0; i < 1000; i++)
  277.     {
  278.        
  279.         if(sz[i] == 0) break;
  280.        
  281.         n ++;  
  282.     }
  283.    
  284. return n;      
  285. }
  286. */
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312. /*
  313. #include <iostream>
  314. using namespace std;
  315.  
  316. //////////////////////////////////////////////////
  317. int main()                                      //
  318. {
  319.    
  320.     int a = 1000; // ЦЕНА КНИГ
  321.     cout << a << endl;
  322.     int b = 55; // БУДЕТ УМЕНЬШАТЬСЯ ЦЕНА
  323.     int c = 40;                                                                    // КОЛВО КНИГ
  324.     const int Bmax = 8;// ОДИН КРУГ КНИГ
  325.     int v = 0;                                                              // ТО ЧТО МЫ УЗНАЕМ
  326.     int n=8;                                                            // СКОЛЬКО ОН УЖЕ КУПИЛ
  327.     int del = c / n;
  328.  
  329.     int tab[7] = { 1000, 945, 890, 835, 780, 725, 665 },                           // kjllkjlkj
  330.         sum = 0;                                                                   // kjhkljhlk
  331.    
  332.     for(int i = 0; i < 7; i++)
  333.     {
  334.         sum = sum + tab[i];
  335.     }
  336.        
  337.     v = sum * del;
  338.     cout << v;
  339.  
  340.     return 0;
  341. }
  342.        
  343.        
  344.         */
  345.        
  346.        
  347.        
  348.        
  349.        
  350.        
  351.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement