C / C++ Programming Challenges



Lowdown

Developed three seperate programs to fufill requirements set out for an assignment in my C module at University.

Key Technologies

  • C
  • Valgrind
  • Makefiles

More Information

The first program translated English to Pig Latin where the rules of Pig Latin involve adding consonants of a word to the end until you reach a vowel and then adding ‘ay’ (as well as a few exceptions). I implemented this by dynamically allocating memory and using an elegant pointer method to keep track of where in the inputted strings I was and what I was adding to the end of the string to be returned.

The second task was to develop a program to do a riffle shuffle and then run some analysis on the shuffle. Again I used pointers, this time two that started in the middle of the list representing the cards and then adding a card to the array representing the finished shuffle depending on some (pseudo)random chance.

The third task was to develop a card game using your riffle shuffle called Beggar your Neighbour. This involved passing lots of cards between players and adding them to the end of player lists, I decided the best data structure to use in this case would be a linked list, so I implemented a linked list from scratch using no external libraries that I then used within my game.

I achieved a score of 89% in this assignment and then overall in my C module I achieved an average of 79%.