Version comparison function

I have this version comparison function in java. Any cleaner way to write this without all the nested ‘if’ statements? Note that the suggestions must be in Java code only. @Override public int compareTo(Version o) { int result = this.major.compareTo(o.major); if (result == 0) { result = this.minor.compareTo(o.minor); if (result == 0) { result = … Read more

Simple C++ calculator which follows BOMDAS rules

This was my first attempt at making a C++ calculator. The user basically inputs an expression (I’ll use 1+1∗(9∗(11−1)) as an example) and the program searches for and creates a vector for parentheses (which is a class I made which records its position in the string). String: [1][+][1][*][(][9][*][(][11][-][1][)][)] 0 1 2 3 4 5 6 … Read more

RattleHiss (fizzbuzz in python)

This is an iterative review. The previous iteration can be found here. The next iteration can be found here I’ve now been programming in python for all of 4 hours. At 70 lines it’s rather verbose for a FizzBuzz. If you can suggest a more pythonic way to structure it, that would be awesome. … Read more

Random string of variable length generator

Below is my code for generating a random string of random length. I am using it in integration tests. Currently I have almost 2000 tests running each time a commit is made to master and a few of those tests are using this class. I would like to make sure the code is optimized so … Read more

Removing entries from a dictionary containing bad words

I have a dictionary with each item containing a quote in another dictionary: { ‘example1’: {‘quote’: ‘And it must follow, as the night the day, thou canst not then be false to any man.\n’}, ‘example2’: {‘quote’: ‘What a piece of work is man! how noble in reason!.\n’} } I need to completely remove each entry … Read more

strcat_new() function, not present in standard C library

strcat_new() function, not present in standard C library. Syntax: char *strcat_new(char *delim, long num_args, …); The code is below. Can someone please do the code review? UPDATE: This version of strcat_new() has a bug. This bug has been fixed in the newer version. The newer version is called str_join(). You can find the newer version … Read more