Загрузить файлы в «/»
This commit is contained in:
parent
bb0a4076ed
commit
74d8626dfe
3 changed files with 205 additions and 0 deletions
42
untitled.c
Normal file
42
untitled.c
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int counter = 0;
|
||||
|
||||
void rec (char *str) {
|
||||
for (size_t i = 0; str[i] != 0; ++i) {
|
||||
if (str[i] == '0') {
|
||||
int t = ++counter;
|
||||
printf(" \"%s\" -> T%d [color=black]\n", str, t);
|
||||
str[i] = '+';
|
||||
printf(" T%d -> \"%s\" [color=green]\n", t, str);
|
||||
rec(str);
|
||||
str[i] = '-';
|
||||
printf(" T%d -> \"%s\" [color=red]\n", t, str);
|
||||
rec(str);
|
||||
str[i] = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main2() {
|
||||
char str[] = "0000\0";
|
||||
printf("digraph {\n");
|
||||
rec(str);
|
||||
printf(" ");
|
||||
if (counter > 1) {
|
||||
printf("T1");
|
||||
}
|
||||
for (int i = 2; i <= counter; ++i) {
|
||||
printf(", T%d", i);
|
||||
}
|
||||
if (counter > 1) {
|
||||
printf(" [shape=point]");
|
||||
}
|
||||
printf("\n}\n");
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
unsigned short int x = 65535; // 1111 1111 1111 1111
|
||||
short int y = x;
|
||||
printf("%d", y);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue