diff --git a/CMakeLists.txt b/CMakeLists.txt index ee6e962..a58241f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0) project(programmingquest LANGUAGES C) -SET(CHALLANGE namegen) +SET(CHALLANGE format) add_executable(binary src/${CHALLANGE}.c diff --git a/src/format.c b/src/format.c new file mode 100644 index 0000000..4adc2a7 --- /dev/null +++ b/src/format.c @@ -0,0 +1,21 @@ +#include +#include +#define COLIM 16 + +int main(int argc, char *argv[]) { + char c; + int count=0; + if (argc<1) { + fprintf(stderr, "No format provided!\n"); + return 1; + } + while ((c=getchar())!=EOF) { + printf(argv[1], c); + if (count++==COLIM) { + printf("\n"); + count=0; + } + } + printf("\n"); + return 0; +}