Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <string>
- #include <set>
- void main()
- {
- setlocale(LC_ALL, "Russian");
- int colls = 10, rows = 20, i, j, tmp;
- int x, y;
- int **matrix = new int*[colls];
- for(i = 0; i < colls; i++)
- matrix[i] = new int[rows];
- tmp = colls - 2;
- for(j = 0; j < rows / 2; j++)
- {
- for(i = colls - 1; i > tmp; i--)
- matrix[i][j] = 1;
- tmp--;
- }
- tmp = 0;
- for(j = (rows / 2) - 1; j < rows; j++)
- {
- for(i = tmp; i < colls; i++)
- matrix[i][j] = 1;
- tmp++;
- }
- printf("\n\nВведите координату по оси X: ");
- scanf("%i", &x);
- printf("Введите координату по оси Y: ");
- scanf("%i", &y);
- if(x > 0 && y > 0)
- {
- if(matrix[y][x] == 1)
- {
- printf("Точка находится внутри треугольника.");
- getch();
- return;
- }
- }
- printf("Пустое множество.");
- getch();
- }
Add Comment
Please, Sign In to add comment