-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.c
72 lines (59 loc) · 2.72 KB
/
example.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
#include <stdlib.h>
#include <stdio.h>
#include "lib/list.c"
#include "lib/matrix.c"
int main()
{
// -------------------------------------------------------------------------------------------------------
// Example for matrix
// -------------------------------------------------------------------------------------------------------
// int sizeX1 = inputInt("Enter the number of rows of matrix A: ");
// int sizeY1 = inputInt("Enter the number of column of matrix A: ");
// int sizeX2 = inputInt("Enter the number of rows of matrix B: ");
// int sizeY2 = inputInt("Enter the number of column of matrix B: ");
// int A[sizeX1][sizeY1],
// B[sizeX2][sizeY2],
// prod[sizeX1][sizeY2],
// sum[sizeX1][sizeY1],
// result;
// // input matrix A and B
// input_matrix(sizeX1, sizeY1, A, "Enter matrix A");
// input_matrix(sizeX2, sizeY2, B, "Enter matrix B");
// // display matrix A and B
// printf_matrix(sizeX1, sizeY1, A, "Matrix A");
// printf_matrix(sizeX2, sizeY2, B, "Matrix B");
// // calculate and display matrix(A+B)
// result = matrix_sum(sizeX1, sizeY1, sizeX2, sizeY2, A, B, sum);
// if (result == 1)
// printf_matrix(sizeX1, sizeY1, sum, "Matrix(A+B)");
// else
// printf("Impossible: for matrix(A+B) number of rows and columns of matrix A and B must be equal (%i != %i).\n\n", sizeY1, sizeX2);
// // calculate and display matrix(A-B)
// result = matrix_diff(sizeX1, sizeY1, sizeX2, sizeY2, A, B, sum);
// if (result == 1)
// printf_matrix(sizeX1, sizeY1, sum, "Matrix(A-B)");
// else
// printf("Impossible: for matrix(A+B) number of rows and columns of matrix A and B must be equal (%i != %i).\n\n", sizeY1, sizeX2);
// // calculate and display matrix(A*B)
// result = matrix_prod(sizeX1, sizeY1, sizeX2, sizeY2, A, B, prod);
// if (result == 1)
// printf_matrix(sizeX1, sizeY2, prod, "Matrix(A*B)");
// else
// printf("Impossible : for matrix(A*B) number of columns of matrix A and number rows of matrix B must be equal (%i != %i).\n\n", sizeY1, sizeX2);
// -------------------------------------------------------------------------------------------------------
// Example about list
// -------------------------------------------------------------------------------------------------------
// int i, t;
// int taille;
// List *vecteur = list();
// printf("Entrer la taille du vectuer:");
// scanf("%i", &taille);
// for (i = 0; i < taille; i++)
// {
// printf("Entrer la valeur du vecteur numero %i: ", i);
// scanf("%i", &t);
// append(vecteur, t);
// }
// printf("vecteur : ");
// printf_list(vecteur);
}