Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- struct complexs { // complex зарезервированное слово
- double real;
- double image;
- };
- complexs mascomplex[3] = {{ 1.5, 2.9 },{0.8, 5.1},{0, 0}}; // нет типа
- struct stock_info
- {
- char Name[30];
- char LetterGroup[3];
- int Group;
- float Stipendia;
- char Poyasnenie[20];
- };
- stock_info MasStud[5] = { {"Владислав Егоров", "N", 3147, 5, "Одногруппник"}, // нет типа
- {"Эрик Мулькаманов", "Э", 118, 2400, "Друг"},
- {"Вера Алексеева", " k", 104, 1621, "Подруга"},
- {"Роман Макотовчук", " k", 10, 1800, "Друг"},
- {"Евгений Смирнов", " l", 22107, 3880, "Друг"}
- };
- int main()
- {
- printf("\nComplex \n");
- mascomplex[2].real = mascomplex[0].real + mascomplex[1].real;
- mascomplex[2].image = mascomplex[0].image + mascomplex[1].image;
- printf("Sum: %.1lf + i * %.1lf \n", mascomplex[2].real, mascomplex[2].image);
- mascomplex[2].real = mascomplex[0].real - mascomplex[1].real;
- mascomplex[2].image = mascomplex[0].image - mascomplex[1].image;
- printf("Dif: %.1lf + i * %.1lf \n", mascomplex[2].real, mascomplex[2].image);
- mascomplex[2].real = mascomplex[0].real * mascomplex[1].real - mascomplex[0].image * mascomplex[1].image;
- mascomplex[2].image = mascomplex[0].real * mascomplex[1].image + mascomplex[1].real *mascomplex[0].image;
- printf("Product: %.1lf + i * %.1lf \n", mascomplex[2].real, mascomplex[2].image);
- mascomplex[2].real = (mascomplex[0].real * mascomplex[1].real + mascomplex[0].image * mascomplex[1].image) / (mascomplex[1].real * mascomplex[1].real + mascomplex[1].image * mascomplex[1].image);
- mascomplex[2].real = mascomplex[0].real * mascomplex[1].image - mascomplex[0].real * mascomplex[1].image;
- printf("Quotient: %.3lf + i * %.3lf \n", mascomplex[2].real, mascomplex[2].image);
- for (int i = 0; i < 5; i++) {
- printf("Имя: %s \n", MasStud[i].Name);
- }
- for (int i = 0; i < 5; i++) {
- printf("Литер группы: %s \n", MasStud[i].LetterGroup);
- }
- for (int i = 0; i < 5; i++) {
- printf( "Группа: %s%d \n", MasStud[i].Group);
- }
- for (int i = 0; i < 5; i++) {
- printf("Стипендия: %d \n", MasStud[i].Stipendia);
- }
- for (int i = 0; i < 5; i++) {
- printf("Кто: %s \n", MasStud[i].Poyasnenie);
- }
- int A = 0xABC1B2E3;
- printf("%X \n", A);
- int *pA = &A;
- unsigned short B = *((short*)pA);
- unsigned short C = *((short*)pA+1);
- *((short*)pA) = C;
- *((short*)pA + 1) = B;
- printf("%X ", A);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement