Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <windows.h>
- void sattolo_shuffle(int *a, size_t size)
- {
- while (size-- > 1)
- {
- size_t j = rand() % size;
- int tmp = a[j];
- a[j] = a[size];
- a[size] = tmp;
- }
- }
- #define VLEN 100
- int main(void)
- {
- int vals[VLEN];
- int matrix[10][10];
- for (size_t i = 0; i < VLEN; i++)
- vals[i] = i + 1;
- sattolo_shuffle(vals, VLEN);
- memcpy(&matrix[0], vals, sizeof(int) * VLEN);
- for (size_t v = 1; v <= 100; v++)
- {
- system("cls");
- for (size_t i = 0; i < 10; i++, printf("\n\n"))
- for (size_t j = 0; j < 10; j++)
- {
- if (matrix[i][j] == v)
- {
- printf("-%d- ", matrix[i][j]);
- }
- else printf("%d ", matrix[i][j]);
- }
- Sleep(500);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement