First Exercise

This commit is contained in:
2025-02-20 23:51:20 +01:00
parent 2b700071aa
commit d580b385e5
27 changed files with 207 additions and 36 deletions

View File

@@ -0,0 +1,24 @@
# Task
_This task is a text-based task but mostly automatically checked. You are required to write your answers into submission.txt by replacing the question marks with the correct solution. Please, do not change the line formating._
_You can check whether your solution is correct by clicking on the test button._
Numbers can be provided in various formats in C++. Literals prefixed with `0b` indicate binary encoding. Assume unsigned arithmetics with sufficient numbers of bits, i.e. no overflows. Convert the following binary numbers into decimal numbers (1-4) and decimal numbers to binary (5-8):
```txt
# Lines starting with # are comments. Spaces is ignored.
# Lines starting with a whitespace before # will not be a comment.
# Convert to decimal:
0b1 = ?
0b10 = ?
0b000001 = ?
0b101010 = ?
# Convert to binary:
7 = ?
11 = ?
28 = ?
1024 = ?
```

View File

@@ -0,0 +1,14 @@
# Lines starting with # are comments. Spaces are ignored.
# Lines starting with a whitespace before # will not be a comment.
# Convert to decimal:
0b1 = 1
0b10 = 2
0b000001 = 1
0b101010 = 42
# Convert to binary:
7 = 0b111
11 = 0b1011
28 = 0b11100
1024 = 0b10000000000