Main function.
85{
86 int start_num, end_num, levels;
87
88 if (argc < 2)
89 {
90 printf("Enter 3 arguments: start_num \t end_num \t levels\n");
91 scanf("%d %d %d", &start_num, &end_num, &levels);
92 }
93 else
94 {
95 start_num = atoi(argv[1]);
96 end_num = atoi(argv[2]);
97 levels = atoi(argv[3]);
98 }
99
100 if (start_num < 0 || end_num < 0 || levels < 0)
101 {
102 fprintf(stderr, "All numbers must be positive\n");
103 return -1;
104 }
105
106 CantorSet head = {.start = start_num, .end = end_num, .
next = NULL};
107
108
109 for (int i = 0; i < levels; i++)
110 {
111 printf("Level %d\t", i);
114 printf("\n");
115 }
116 printf("Level %d\t", levels);
118
119
121
122 return 0;
123}
void propagate(CantorSet *head)
Iterative constructor of all sets in the current level.
Definition: cantor_set.c:23
void print(CantorSet *head)
Print sets in the current range to stdout
Definition: cantor_set.c:55
structure to define Cantor set
Definition: cantor_set.c:12