Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
C
Checking the sample code
TODO I need to make a better sample here.
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
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
int main()
{
char m[101];
// fgets(m, 101, stdin);
strcpy (m, "CG");
bool b[800];
int blen = 0;
for (int i = 0; i < strlen(m); i++)
{
int digit = m[i];
if (digit != 10)
for (int j = 6; j >= 0; j--) {
if ((digit >> j) & 1) {
b[blen++] = true;
}
else {
b[blen++] = false;
}
}
}
char a[2000];
if (b[0])
strcat(a, "0");
else
strcat(a, "00");
strcat(a, " 0");
for (int i = 1; i < blen; i++)
if (b[i] == b[i - 1])
strcat(a, "0");
else
{
strcat(a, " ");
if (b[i])
strcat(a, "0");
else
strcat(a, "00");
strcat(a, " 0");
}
// fprintf(stderr, "Debug messages...\n");
printf("%s\n", a);
return 0;
}
Enter to Rename, Shift+Enter to Preview
Looking at the syntax
- TODO
Other characteristics
- TODO
Resources to check
Coming next...
We are going fast and we still don't want to brake. Let's check out Rust, aiming to provide memory safety, while keeping the speed...
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content