Loading CMakeLists.txt 0 → 100644 +8 −0 Original line number Diff line number Diff line CMAKE_MINIMUM_REQUIRED(VERSION 3.0) PROJECT(factorial) SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra") # factorial library ADD_LIBRARY(fact STATIC fact.c) fact.c 0 → 100644 +9 −0 Original line number Diff line number Diff line #include "fact.h" unsigned long factorial(unsigned long number) { unsigned long acc = 1UL; for (unsigned long i = 0UL; i <= number; ++i) acc *= i; return acc; } fact.h 0 → 100644 +14 −0 Original line number Diff line number Diff line #ifndef FACT_H #define FACT_H #ifdef __cplusplus extern "C" { #endif // __cplusplus unsigned long factorial(unsigned long number); #ifdef __cplusplus } // extern "C" #endif // __cplusplus #endif // FACT_H Loading
CMakeLists.txt 0 → 100644 +8 −0 Original line number Diff line number Diff line CMAKE_MINIMUM_REQUIRED(VERSION 3.0) PROJECT(factorial) SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra") # factorial library ADD_LIBRARY(fact STATIC fact.c)
fact.c 0 → 100644 +9 −0 Original line number Diff line number Diff line #include "fact.h" unsigned long factorial(unsigned long number) { unsigned long acc = 1UL; for (unsigned long i = 0UL; i <= number; ++i) acc *= i; return acc; }
fact.h 0 → 100644 +14 −0 Original line number Diff line number Diff line #ifndef FACT_H #define FACT_H #ifdef __cplusplus extern "C" { #endif // __cplusplus unsigned long factorial(unsigned long number); #ifdef __cplusplus } // extern "C" #endif // __cplusplus #endif // FACT_H