Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct dreptunghi {
- int Ax;
- int Ay;
- int Bx;
- int By;
- int Aria;
- };
- int main() {
- int matrice[4][4],i,j;
- dreptunghi dreptunghi[4];
- int k = 0;
- int max = INT_MIN;
- int dreptunghiul_max;
- for (i = 0; i < 2*2; i++) {
- for (j = 0; j < 2*2;j++) {
- if(j<=1){
- if (j % 2 == 0) {
- cout << "Dati punctul Ax "; cin >> dreptunghi[k].Ax;
- matrice[i][j] = dreptunghi[k].Ax;
- } else {
- cout << "Dati punctul Ay "; cin >> dreptunghi[k].Ay;
- matrice[i][j] = dreptunghi[k].Ay;
- }
- } else {
- if (j % 2 == 0) {
- cout << "Dati punctul Bx "; cin >> dreptunghi[k].Bx;
- matrice[i][j] = dreptunghi[k].Bx;
- }
- else {
- cout << "Dati punctul By "; cin >> dreptunghi[k].By;
- matrice[i][j] = dreptunghi[k].By;
- }
- }
- }
- dreptunghi[k].Aria = (dreptunghi[k].Bx - dreptunghi[k].Ax) * (dreptunghi[k].Ay - dreptunghi[k].By);
- k++;
- cout << endl;
- }
- for (i = 0; i < 4; i++) {
- if (dreptunghi[i].Aria > max) {
- max = dreptunghi[i].Aria;
- dreptunghiul_max = i+1;
- }
- }
- cout << "Dreptunghiul cel mai mare are aria: " << max << " Si este cel cu numarul: " << dreptunghiul_max;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement