Информация о количестве жильцов в каждой из четырех квартир каждого этажа 12-этажного дома хранится в двумерном массиве (в первой строке — информация о квартирах первого этажа, во второй — второго и т. д.). На каком этаже проживает больше людей: на третье
#include <iostream>
#include <stdlib.h>
#include <cstdlib>
#include <ctime>
#include <time.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int i, j,s1=0,s2=0;
int a[12][4];
srand (time(NULL));
for (i=0;i<12;i++){
cout<<"Na "<<i+1<<" etazhe zivyt: ";
for (j=0;j<4;j++){
a[i][j]=rand() % 5+1;
cout<<j+1<<" kv: "<<a[i][j]<<" ";
if (i==2) s1+=a[i][j];
if (i==4) s2+=a[i][j];
}
cout<<endl;
}
if (s1>s2) cout<<"Na 3-tem bolshe";
else if (s2>s1) cout<<"na 5-om bolshe";
else cout<<"Porovnu";
return 0;
}
