Sandro4912
  • Member for 3 years, 7 months
  • Last seen more than a week ago
  • Germany
My first C++ game (snake console game)
Accepted answer
9 votes

First of all congratulations for this little entertaining console game. It is simple but entertaining. I felt like I was back in the old mobile games era. I don't have the time to rewrite all of the ...

View answer
Tic-Tac-Toe for the terminal
8 votes

I think youre code is quite nice. Easy to read and the tasks are nicely splitted into functions. So theres not much to add. Theres just one thing bothering me. Don't omit curly braces. This: // ...

View answer
Tetris game for Windows
Accepted answer
6 votes

I don't have the time to analyse all the code. I suggest fixing these issues mentioned here and then reposte the improved version. Then we could take a look at your logic. Don't use using namespace ...

View answer
Coding Challenge Solution - Good Range
5 votes

No comments on the algorithm itself. But I have many style improvements a interviewer probably looks for. int main() { ... return 0; } Unlike in C the statement return 0 is automatically ...

View answer
C++ console progress display
5 votes

There are several things you can do to improve this code. First of all the code above isn't a valid C++ code. To run it you need to add: #include <string> #include <iostream> #include &...

View answer
Minesweeper C++
4 votes

This question is already quite old. Still there's a lot more to suggest for improvements. Here are some suggestions not mentioned yet. Don't use #define for constants: This: //read only variables - ...

View answer
Basic console video game
4 votes

There are many bad practices in this code. I want to show all I could find and suggest improvements. Don't use using namespace std Pick a naming style: string yay; string actyay = "yes"; ...

View answer
Function to check if received message matches any of the expected messages
4 votes

Unfortunately your code is incomplete and can't be run in this state. Still I want to recommend some improvements to this snippets. My first impression from this code is that it looks like plain C, ...

View answer
alternating Fibonacci and prime series
4 votes

Don't use #include <bits/stdc++.h>. This include is not portable to every compiler and it's non-standard. Also, it includes every standard header which just bloats up the size of your ...

View answer
C++ Mandelbulb-set generator
Accepted answer
3 votes

I probably can't say much about the algorithm but I see many things which can help you improve your use of C++ and programming in general. Don't use using namespace std Why? You pollute the whole ...

View answer
Permutation of words in a sentence
3 votes

Some comments on the style of your code. Formatting. Your code is hard to read because there are no spaces. Also the formatting seems to be off. It might be easier to read like this: int main(void) ...

View answer
Improved first Tic-Tac-Toe + Minimax AI
3 votes

Not time to check all the program, but I still spotted something I want to share: This: switch (input.front()) //input cannot be null at this point { case 'x': case 'X': valid_input = true; ...

View answer
Win32 GDI+ memory and style
3 votes

I don't know about the GDI Library but there a still some things in this code which could need a examination: // Create window hwnd = CreateWindowEx(0, szClassName, L"Test Transparent Static Main ...

View answer
SFML snake game in C++
3 votes

Some observations: Comments: // Draws the objects void drawWindow(); // Handles events void handleEvents(); // Updates the window void updateWindow(); These comments don't tell you anything that ...

View answer
Tic Tac Toe in C++11
3 votes

I cannot check all because I use a phone at the moment, but here are some quick observations I saw skimming thru the code: Never call main () -It is not defined in C++ what happens if you call main ...

View answer
Dynamic fgets in C
3 votes

One more thing not mentioned yet. Dont put command line arguments if you dont use them in the code. It is just misleading since you dont use argc and argv. consider to use simply int main (void)

View answer
Displaying a menu
3 votes

Beside the answer already made. I have one more thing. Dont use std::endl if you just want a newline because it also flushes the stream. Consider using instead a simple newline \n.

View answer
Tetris game for Windows improved version
2 votes

No time to read through all the code for now. So just some random observations. In Coordinates.h: Include as less as poissible in headers: You include iostream but it is only needed in Coordinates....

View answer
First Program Tic-Tac-Toe
2 votes

Some little things not mentioned yet: If you are using C++11 or higher consider using the more safe enum class instead of the plain enum inherited from C. See: https://stackoverflow.com/questions/...

View answer
My second game (Hangman in C++)
2 votes

I just spotted some random things not mentioned yet. Make the wait portable Consider using a modern portable way to replace #include <windows.h> Sleep(1000); with #include <chrono> ...

View answer
Iterating over different Objects which are ordered by index number
Accepted answer
2 votes

As mentioned in a comment, I found std::variant to be a good solution for my issue: I also added a template visitor it can save writing a lot of visitors if in all data structures the same thing ...

View answer
Cleaning a file / Word Query
2 votes

While adding a GUI to this exercise, I found a logical error. These functions: std::optional<std::pair<Word, Occurences>> most_frequent_word(const std::map<Word, Occurences>& ...

View answer
Non generic Skip List implementation in C++
2 votes

Now that i try to implement all the mentioned improvements so far i found some additional points the presented code lacks which i want to share: Comments / Documentation I have to admit i wrote ...

View answer
Random password generator in C
1 votes

Coming back to the already mentioned recursively main logic. If you run the program logic to often with that you can generate a stack overflow and run out of memory. You can use a forever loop ...

View answer
C++ Snake game using Qt-framework
1 votes

Like hinted in the other answer there is a quite nasty bug which prevents the Game to restart after the Snake runs into the left wall. I hunted the bug und fixed it. Maybe its interesing whats the ...

View answer
Union based encoding of .csv file into a data table with different types
Accepted answer
1 votes

I don't have time to check all now but I found some things I want to share If you are using C++17 consider using std::variant instead of the weak union inherited from c. It will probaly also solve ...

View answer
Simply adding/removing/sorting data
1 votes

Don't use using namespace std. Its considered bad practice. See Why is “using namespace std” considered bad practice? Why pass std::string by pointer? In C++ we have references &. They safe you ...

View answer
Simple C++98 actor system (with event system) - think Doom or Unreal
1 votes

Defining constants with #define is only ok in c. In C++ there are better alternatives. Consider using instead const int or an enum for the states instead of #define in C++98. If C++11 would be ...

View answer
Encrypt PDF-Files
0 votes

Putting the suggestions from Ludisposed together we can improve the code with argparse, getpass and pathlib like this: def get_password_from_user() -> str: """ Asks the user to enter a ...

View answer
Excel Multiplication Table Maker
0 votes

Theres a bug which hides in the make_excel_table function. During refactoring I called by accident 2 times the column method and not the row method. it should be: def make_excel_table(): ... ...

View answer