С++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

С++

Найти пересечение 2 и более фигур. Find the intersection of two or more shapes.

19th Sep 2021, 4:16 PM
Анна Цыбизова
2 Answers
+ 3
Which kind of shapes? We need to know their origin and their size. Please link your code!
19th Sep 2021, 4:18 PM
Lisa
Lisa - avatar
0
I would like to see how you do it, because nothing will come to my head yet. Everything I came up with: #include <iostream> #include <cmath> #define N 7 #define M 2 using namespace std; int main() { setlocale(LC_ALL, "RUS"); int A[N][M] = { {2,4},{3,2},{5,6},{7,4},{1,8}, {3,9}, {5,12} }; int B[N][M] = { {4,5}, {5,6}, {6,6}, {7,5}, {6,4}, {5,4}, {4,5} }; int i = 0, j = 0; for (i = 0; i < N; i++) { for (j = 0; j < M; j++) { if (A[i][j] == B[i][j]) { cout « "Пересечение есть\n"; } } } system("pause"); return 0; }
19th Sep 2021, 4:32 PM
Анна Цыбизова