-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatriz_binaria.c
96 lines (80 loc) · 2.02 KB
/
matriz_binaria.c
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <stdio.h>
void ler_linha(int i, int j, int m, double notas[][m])
{
if (j < m)
{
scanf("%lf", ¬as[i][j]);
ler_linha(i, j + 1, m, notas);
}
}
void ler_matriz(int i, int n, int m, double notas[][m])
{
if (i < n)
{
ler_linha(i, 0, m, notas);
ler_matriz(i + 1, n, m, notas);
}
}
void print_matrix(int i, int j, int n, int m, double notas[][m])
{
if(i < n)
{
if(j < m-1)
{
printf("%.2lf\t", notas[i][j]);
return print_matrix(i, j+1, n, m, notas);
}
else
{
printf("%.2lf\n", notas[i][j]);
return print_matrix(i+1,0,n,m,notas);
}
}
}
void print_matrix_transpost(int i, int j, int n, int m, double notas[][m])
{
if(j < m)
{
if(i < n-1)
{
printf("%.2lf\t", notas[i][j]);
return print_matrix_transpost(i+1, j, n, m, notas);
}
else
{
printf("%.2lf\n", notas[i][j]);
return print_matrix_transpost(0 ,j+1, n, m, notas);
}
}
}
int main()
{
double notas[5][4];
ler_matriz(0, 5, 4, notas);
print_matrix(0, 0, 5, 4, notas);
printf("############## TRANSPOSTA\n");
print_matrix_transpost(0, 0, 5, 4, notas);
/*
printf("#########\n%lf\n", notas[0][0]);
printf("%lf\n", notas[0][1]);
printf("%lf\n", notas[0][2]);
printf("%lf\n", notas[0][3]);
printf("#########\n%lf\n", notas[1][0]);
printf("%lf\n", notas[1][1]);
printf("%lf\n", notas[1][2]);
printf("%lf\n", notas[1][3]);
printf("#########\n%lf\n", notas[2][0]);
printf("%lf\n", notas[2][1]);
printf("%lf\n", notas[2][2]);
printf("%lf\n", notas[2][3]);
printf("#########\n%lf\n", notas[3][0]);
printf("%lf\n", notas[3][1]);
printf("%lf\n", notas[3][2]);
printf("%lf\n", notas[3][3]);
printf("#########\n%lf\n", notas[4][0]);
printf("%lf\n", notas[4][1]);
printf("%lf\n", notas[4][2]);
printf("%lf\n", notas[4][3]);
*/
return 0;
}