Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- ////////////////////////////////////////
- class Dog
- {
- public:
- char color[99];
- int age;
- float weiht;
- int Year; // Поле
- int foo() // Метод
- {
- return age * Year;
- }
- };
- ////////////////////////////////////////
- int main()
- {
- Dog h;
- h.Year = 2010;
- h.age = 14;
- h.weiht = 5.500;
- strcpy(h.color, "Brown");
- printf("h.color = %s \n", h.color );
- printf("h.age = %5d \n", h.age );
- printf("h.weiht = %.3f \n", h.weiht );
- printf("h.Year = %5d \n", h.Year );
- printf("h.foo() = %5d \n", h.foo() );
- }
- /*
- #include <stdio.h>
- #include <string.h>
- ////////////////////////////////////////
- struct Dog
- {
- char color[99];
- int age;
- float weiht;
- int Year;
- };
- ////////////////////////////////////////
- int main()
- {
- Dog h;
- h.Year = 2010;
- h.age = 14;
- h.weiht = 5.500;
- strcpy(h.color, "Brown");
- printf("h.color = %s \n", h.color);
- printf("h.age = %5d \n", h.age );
- printf("h.weiht = %.3f \n", h.weiht);
- printf("h.Year = %5d \n", h.Year );
- }
- */
- /*
- #include<stdio.h>
- #include <locale.h>
- ///////////////////////////////////////////////////////
- int main()
- {
- setlocale(0,"rus");
- int a, b, c;
- double f;
- c = 1024;
- a = 3750; // глубина в метры
- b = a*1000;
- c = b/1024;
- f = (double)c/1024;
- printf("Количество в миллиметрах b = %7d\n", b);
- printf(" Глубина в килобайтах с = %7d\n", c);
- printf(" Глубина в Мегабайтах с = %7.3f \n", f);
- }
- */
Add Comment
Please, Sign In to add comment