Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- #include <clocale>
- using namespace std;
- void main()
- {
- setlocale(LC_ALL, "Russian");
- const int N = 3, M = 7;
- int a[N][M];
- for (int i = 0; i < N; i++) {
- for (int j = 0; j < M; j++) {
- a[i][j] = rand() % 10;
- cout << setw(4) << a[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl;
- int k = 0;
- double p;
- for (int i = 0; i < M; i++) {
- if (a[0][i] == a[1][i] && a[0][i] != a[2][i] || a[0][i] == a[2][i] && a[0][i] != a[1][i] || a[1][i] == a[2][i] && a[1][i] != a[0][i]) {
- k++;
- p = (a[0][i] + a[1][i] + a[2][i]) / 2.0;
- cout << "Найден равнобедренный треугольник в " << i + 1 << "столбце с площадью " << sqrt(p * (p - a[0][i]) * (p - a[1][i]) * (p - a[2][i])) << endl;
- }
- }
- cout << "Всего найдено " << k << " равнобедренных треугольников" << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement