Guest User

Untitled

a guest
Apr 23rd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.92 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <string>
  4. #include <set>
  5.  
  6. void main()
  7. {
  8.     setlocale(LC_ALL, "Russian");
  9.  
  10.     int colls = 10, rows = 20, i, j, tmp;
  11.     int x, y;
  12.  
  13.     int **matrix = new int*[colls];
  14.     for(i = 0; i < colls; i++)
  15.         matrix[i] = new int[rows];
  16.  
  17.     tmp = colls - 2;
  18.     for(j = 0; j < rows / 2; j++)
  19.     {
  20.         for(i = colls - 1; i > tmp; i--)
  21.             matrix[i][j] = 1;
  22.  
  23.         tmp--;
  24.     }
  25.  
  26.     tmp = 0;
  27.     for(j = (rows / 2) - 1; j < rows; j++)
  28.     {
  29.         for(i = tmp; i < colls; i++)
  30.             matrix[i][j] = 1;
  31.  
  32.         tmp++;
  33.     }
  34.  
  35.     printf("\n\nВведите координату по оси X: ");
  36.     scanf("%i", &x);
  37.     printf("Введите координату по оси Y: ");
  38.     scanf("%i", &y);
  39.  
  40.     if(x > 0 && y > 0)
  41.     {
  42.         if(matrix[y][x] == 1)
  43.         {
  44.             printf("Точка находится внутри треугольника.");
  45.             getch();
  46.  
  47.             return;
  48.         }
  49.     }
  50.  
  51.     printf("Пустое множество.");
  52.     getch();
  53. }
Add Comment
Please, Sign In to add comment