Skip to content

bast/fizz-buzz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License

fizz-buzz

Exercise to practice building projects with CMake.

Background

Inspired by a Project Euler exercise and based on the popular game and popular programming job interview question where you have to say/print "Fizz" if a natural number is divisible by 3 and "Buzz" if it is divisible by 5:

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
Fizz Buzz
...

We wish to build a code which computes the "Fizz-buzz sum" for a given natural number N, summing all natural numbers <= N which are multiples of 3 or 5. For N=10 the sum is 3+5+6+9+10 = 33.

The source code and unit tests are there:

.
|-- LICENSE.md
|-- README.md
|-- src
|   |-- divisible.f90
|   |-- fizz_buzz.f90
|   |-- fizz_buzz.h
|   `-- main.cpp
`-- test
    |-- fizz_buzz.cpp
    `-- main.cpp

Tasks

  • Build a shared library.
  • Build and link the main program.
  • Build the unit tests and link against Google Test.
  • Define a version number inside CMake and print it to the output of the executable.
  • Print the Git hash to the output of the executable.
  • Create an installer so the program can be installed properly (GNU standards).
  • Create a DEB or RPM package (if relevant for your distribution).