Converted everything to orgmode

converted everything to orgmode and added solution to the README files
This commit is contained in:
2025-03-31 08:37:19 +02:00
parent 3013d7ad47
commit 311cb8434c
25 changed files with 319 additions and 502 deletions

View File

@@ -104,51 +104,20 @@ You can also see the results for your submission on the "Enrolled Courses" tab o
* Solution
Front End to import libraries and files.
#+begin_src cpp
#include <iostream>
#include "guess_a_number.h"
#+end_src
Main function where the code runs.
#+begin_src cpp
int main() {
#+end_src
Declaring Variable which will be used.
#+begin_src cpp
int number_to_guess; // The number to guess
int guess; // The guessed number
#+end_src
Front end terminal output.
#+begin_src cpp
std::cout << "Number to guess: ";
#+end_src
~choose_a_number()~ function is called to choose a number between 1 and 3
#+begin_src cpp
number_to_guess = choose_a_number(3);
#+end_src
Input front end.
#+begin_src cpp
std::cin >> guess;
#+end_src
Output the input of the user.
#+begin_src cpp
std::cout << "Your guess: ";
#+end_src
Depending on the guess, the output in the terminal is different, if the input of the user is the same with the random number, it will output ~Congratulations, you correctly guessed x!~. Otherwise it will output something else.
#+begin_src cpp
if (guess == number_to_guess) {
std::cout << "Congratulations, you correctly guessed " << number_to_guess << "!";
} else {