Newer
Older
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
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "array.h"
const int MAX_SIZE = 15;
int main() {
srand(time(NULL));
int32_t size, user_number;
for (int32_t i = 0; i < 100; i++) {
//scanf("%d", &size);
size = (rand() % MAX_SIZE) + 5;
int32_t* tab = malloc(sizeof(int32_t) * size);
int32_t* tab_two = malloc(sizeof(int32_t) * size);
int32_t* tab_three = malloc(sizeof(int32_t) * size);
int32_t* tab_four = malloc(sizeof(int32_t) * size);
double* tab_five = malloc(sizeof(double) * size);
randomize_array(tab, size);
randomize_array(tab_two, size);
randomize_array(tab_three, size);
printf("TAB 1:\n");
display_int_array(tab, size);
printf("TAB 2:\n");
display_int_array(tab_two, size);
printf("CYCLIC PERMUTATION TAB 1:\n");
cyclic_permutation(tab, size, 1);
display_int_array(tab, size);
printf("LOWEST AT END TAB 1:\n");
insert_lowest_at_end_of_array(tab, size);
display_int_array(tab, size);
printf("SORT DESC TAB 1:\n");
sort_desc(tab, size);
display_int_array(tab, size);
printf("Choissisez un nombre entre 0 et %d:\n", size - 1);
//scanf("%d", &user_number);
user_number = (rand() % size);
printf("L'index de l'élément (%d) est [%d]\n", user_number, find_user_number_index(tab, size, user_number));
printf("SUM OF ARRAYS 1 & 2:\n");
sum_of_arrays(tab, tab_two, tab_three, size);
display_int_array(tab_three, size);
printf("PRODUCT OF ARRAYS ELEMENT TAB 1:\n");
printf("Choissisez la valeur par laquelle les éléments du tableau seront multipliés:\n");
//scanf("%d", &user_number);
user_number = (rand() % size);
product_of_arrays_element(tab, tab_four, size, user_number);
display_int_array(tab_four, size);
printf("CONVERT TAB 1 TO DOUBLE ARRAY:\n");
convert_int32t_to_double_array(tab, tab_five, size);
display_double_array(tab_five, size);
free(tab);
free(tab_two);
free(tab_three);
free(tab_four);
free(tab_five);
}
return EXIT_SUCCESS;
}