dllbridge

Untitled

Jun 3rd, 2024
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.05 KB | None | 0 0
  1.  
  2.  
  3. #include  <stdio.h>
  4. #include <string.h>
  5.  
  6.  
  7. ////////////////////////////////////////
  8. class Dog
  9. {
  10.          
  11.     public:    
  12.     char  color[99];
  13.     int   age;
  14.     float weiht;
  15.     int   Year;                      //  Поле  
  16.    
  17.     int foo()                        //  Метод
  18.     {
  19.              
  20.         return age * Year;      
  21.     }
  22. };
  23.      
  24.    
  25.  
  26. ////////////////////////////////////////    
  27. int main()
  28. {
  29.  
  30.      Dog h;
  31.      
  32.      h.Year  =  2010;
  33.      h.age   =    14;
  34.      h.weiht = 5.500;
  35.      strcpy(h.color, "Brown");
  36.      
  37.      printf("h.color = %s   \n",  h.color );
  38.      printf("h.age   = %5d  \n",  h.age   );
  39.      printf("h.weiht = %.3f \n",  h.weiht );
  40.      printf("h.Year  = %5d  \n",  h.Year  );
  41.      printf("h.foo() = %5d  \n",  h.foo() );    
  42. }
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55. /*
  56. #include  <stdio.h>
  57. #include <string.h>
  58.  
  59.  
  60. ////////////////////////////////////////
  61. struct Dog
  62. {
  63.     char  color[99];
  64.     int   age;
  65.     float weiht;
  66.     int   Year;
  67. };
  68.      
  69.    
  70.  
  71. ////////////////////////////////////////    
  72. int main()
  73. {
  74.  
  75.      Dog h;
  76.      
  77.      h.Year  =  2010;
  78.      h.age   =    14;
  79.      h.weiht = 5.500;
  80.      strcpy(h.color, "Brown");
  81.      
  82.      printf("h.color = %s   \n",  h.color);
  83.      printf("h.age   = %5d  \n",  h.age  );
  84.      printf("h.weiht = %.3f \n",  h.weiht);
  85.      printf("h.Year  = %5d  \n",  h.Year );
  86. }
  87.  
  88. */
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100. /*
  101.  
  102. #include<stdio.h>
  103. #include <locale.h>
  104.  
  105. ///////////////////////////////////////////////////////
  106. int main()
  107. {
  108.          
  109.     setlocale(0,"rus");
  110.    
  111.     int    a, b, c;
  112.     double       f;
  113.    
  114.     c =   1024;
  115.     a =   3750;                                       //  глубина в метры
  116.     b = a*1000;
  117.     c = b/1024;
  118.    
  119.     f = (double)c/1024;
  120.    
  121.     printf("Количество  в миллиметрах  b =  %7d\n", b);
  122.     printf("     Глубина в килобайтах  с =  %7d\n", c);
  123.     printf("     Глубина в Мегабайтах  с =  %7.3f \n", f);    
  124. }
  125.  
  126.  
  127. */
  128.  
  129.  
  130.  
  131.  
  132.  
Add Comment
Please, Sign In to add comment