This commit is contained in:
ada-dmitry
2023-11-18 21:17:47 +03:00
parent 1bbd6527b8
commit a3c32e3438
17 changed files with 147 additions and 1 deletions
+2 -1
View File
@@ -5,6 +5,7 @@
void print_revers(int x)
{
int res = 0;
int *p_res = &res;
for (int i = N - 1; i > -1; i--)
{
res += (x / (int)pow(10, i)) * (int)pow(10, (N - 1 - i));
@@ -12,5 +13,5 @@ void print_revers(int x)
printf("%d | %d\n", x, res);
}
printf("%d\n", res);
printf("%d %ls\n", res, p_res);
}
Binary file not shown.
+17
View File
@@ -0,0 +1,17 @@
#include <stdio.h>
void center(int xlt, int ylt, int xrb, int yrb, int *pxc, int *pyc)
{
*pxc = (xlt + xrb) / 2;
*pyc = (ylt + yrb) / 2;
}
void rotateC(int *x1, int *y1, int *x2, int *y2)
{
int t1 = *x1, t2 = *x2;
*x1 = *y2;
*x2 = *y1;
*y1 = t2;
*y2 = t1;
}
+20
View File
@@ -0,0 +1,20 @@
#include <stdio.h>
void center(int xlt, int ylt, int xrb, int yrb, int *pxc, int *pyc);
void rotateC(int *x1, int *y1, int *x2, int *y2);
int main()
{
int xlt, ylt, xrb, yrb, xc, yc;
int *pxc = &xc, *pyc = &yc;
scanf("%d%d%d%d", &xlt, &ylt, &xrb, &yrb);
center(xlt, ylt, xrb, yrb, pxc, pyc);
rotateC(&xlt, &ylt, &xrb, &yrb);
printf("%d %d %d %d\n", xlt, ylt, xrb, yrb);
return 0;
}
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
void min2time(int mm, int *ph, int *pm)
{
*ph = (mm / 60) % 24;
*pm = (mm - ((mm / 60) % 24) * 60) % 60;
}
+15
View File
@@ -0,0 +1,15 @@
#include <stdio.h>
void min2time(int mm, int *ph, int *pm);
int main()
{
int mm, h, m;
scanf("%d", &mm);
min2time(mm, &h, &m);
printf("%02d:%02d\n", h, m);
return 0;
}
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
#include <stdio.h>
void mirror(int *px, int *py)
{
*px = *px * (-1);
}
void mirror_seg(int *px1, int *py1, int *px2, int *py2)
{
*py1 *= -1;
*py2 *= -1;
}
+24
View File
@@ -0,0 +1,24 @@
#include <stdio.h>
void mirror(int *px, int *py);
void mirror_seg(int *px1, int *py1, int *px2, int *py2);
int main()
{
int x1, y1, x2, y2;
int *px1 = &x1, *py1 = &y1;
int *px2 = &x2, *py2 = &y2;
scanf("%d%d", px1, py1);
scanf("%d%d", px2, py2);
// mirror(px1, py1);
// printf("%d %d\n", x1, y1);
mirror_seg(px1, py1, px2, py2);
printf("%d %d %d %d\n", x1, y1, x2, y2);
return 0;
}
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
#include <stdio.h>
void move(int *px, int *py, int dx, int dy)
{
*px += dx;
*py += dy;
}
+17
View File
@@ -0,0 +1,17 @@
#include <stdio.h>
void move(int *px, int *py, int dx, int dy);
int main()
{
int x, y, dx, dy;
int *px = &x, *py = &y;
scanf("%d%d%d%d", px, py, &dx, &dy);
move(px, py, dx, dy);
printf("%d %d\n", *px, *py);
return 0;
}
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
#include <stdio.h>
void swap(int *px, int *py)
{
int t;
t = *px;
*px = *py;
*py = t;
return;
}
+14
View File
@@ -0,0 +1,14 @@
#include <stdio.h>
void swap(int *px, int *py);
int main()
{
int x, y;
scanf("%d%d", &x, &y);
swap(&x, &y);
printf("%d %d\n", x, y);
return 0;
}
Binary file not shown.