Converted everything to orgmode

converted everything to orgmode and added solution to the README files
This commit is contained in:
2025-03-31 08:40:43 +02:00
parent 8719f4c140
commit 88e0b5ed69
88 changed files with 1942 additions and 2989 deletions

View File

@@ -1,17 +0,0 @@
# Task
Let `a`, `b`, `c`, and `d` be variables of type `int`.
- Which of the following character sequences are valid expressions in the sense that they are accepted by a C++ Compiler? Explain your answer.
1. a = b = 5
1. 1 = a
1. ++a + b++
1. a + b = c + d
1. a = 2 b
Assume that all the variables have been defined and correctly initialized and that all expressions are completely independent from each other.
- For each of the expressions that you have identified as valid, decide whether the entire expression is an `lvalue` or an `rvalue`, and explain your decision.
- Determine the values of the expressions that you have identified as valid and explain how these values are obtained.

View File

@@ -0,0 +1,52 @@
#+TITLE: Task 1: Expressions
#+AUTHOR: JirR02
* Task
Let =a=, =b=, =c=, and =d= be variables of type =int=.
- Which of the following character sequences are valid expressions in the sense that they are accepted by a C++ Compiler? Explain your answer.
1. a = b = 5
1. 1 = a
1. ++a + b++
1. a + b = c + d
1. a = 2 b
Assume that all the variables have been defined and correctly initialized and that all expressions are completely independent from each other.
- For each of the expressions that you have identified as valid, decide whether the entire expression is an =lvalue= or an =rvalue=, and explain your decision.
- Determine the values of the expressions that you have identified as valid and explain how these values are obtained.
* Solution
#+begin_src md
# Task 1
---
### Expression 1: `a = b = 5`
The expression is valid and will be accepted by the CPP compiler. It will result with the l-values `a = 5` and `b = 5`. This is due to the fact the the `=` opperation is read from right to left so `b = 5` will run first and `a = b` afterwards.
### Expression 2: `1 = a`
The expression is invalid.
### Expression 3: `++a + b++`
The expression is valid and will be accepted by the CPP compiler. It will result in a r-value since the result is not assigned to a variable.
### Expression 4: `a + b = c + d`
The expression is invalid.
### Expression 5: `a = 2 b`
The expression is valid and will be accepted by the CPP compiler. It will result with the l-value `a = 2 b`. This is valid since a l-value can be a r-value.
#+end_src
-----
Made by JirR02 in Switzerland 🇨🇭

View File

@@ -1,23 +0,0 @@
# Task 1
---
### Expression 1: `a = b = 5`
The expression is valid and will be accepted by the CPP compiler. It will result with the l-values `a = 5` and `b = 5`. This is due to the fact the the `=` opperation is read from right to left so `b = 5` will run first and `a = b` afterwards.
### Expression 2: `1 = a`
The expression is invalid.
### Expression 3: `++a + b++`
The expression is valid and will be accepted by the CPP compiler. It will result in a r-value since the result is not assigned to a variable.
### Expression 4: `a + b = c + d`
The expression is invalid.
### Expression 5: `a = 2 b`
The expression is valid and will be accepted by the CPP compiler. It will result with the l-value `a = 2 b`. This is valid since a l-value can be a r-value.