-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
executable file
·41 lines (27 loc) · 914 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include "matriz.h"
using namespace std;
int main(void){
int linhas, colunas;
cout << "Digite o numero de linhas e colunas: " << endl;
cin >> linhas >> colunas ;
Matriz *m = new Matriz(linhas, colunas);
for(int i=0; i < linhas ; i++){
for(int j=0; j < colunas ; j++){
cout << "Digite o elemento da linha " << i+1 << " coluna " << j+1 << endl;
float aux;
cin >> aux;
m->setElem(i,j,aux);
}
}
cout << "end"<< endl;
float mediaColunasPares=0, mediaLinhasImpares=0;
for(int j=1; j < colunas ; j+=2){
for(int i=0; i < linhas ; i++){
mediaColunasPares += m->getElem(i,j);
}
}
mediaColunasPares /= (colunas/2)*linhas;
cout << "Media Colunas Pares " << mediaColunasPares << endl;
return 0;
}