File tree Expand file tree Collapse file tree 5 files changed +19
-4
lines changed
Expand file tree Collapse file tree 5 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ include_directories(.)
55add_executable (
66 ${PROJECT_NAME}
77 main.cpp
8+ helloWorld.hpp
9+ helloWorld.cpp
810 beer.hpp
911 beer.cpp
1012)
Original file line number Diff line number Diff line change 1- #! /bin/bash
1+ #! /usr/ bin/env bash
22set -euo pipefail
33IFS=$' \n\t '
44
@@ -16,11 +16,11 @@ if [[ Darwin = "$platform" ]]; then
1616 -fdiagnostics-fixit-info -fdiagnostics-parseable-fixits \
1717 -fdiagnostics-print-source-range-info -fdiagnostics-show-option \
1818 -fno-builtin -fshow-column -fshow-source-location -fstandalone-debug \
19- -ftime-report main.cpp beer.cpp -o " HQ9+"
19+ -ftime-report main.cpp helloWorld.cpp beer.cpp -o " HQ9+"
2020
2121elif [[ " Linux" = " $platform " ]]; then
2222 g++ --verbose -Wall -Wextra -pedantic -save-temps -v -fgnu-tm -lm -latomic \
23- -lstdc++ -g -fgnat-encodings=all main.cpp beer.cpp -o " HQ9+"
23+ -lstdc++ -g -fgnat-encodings=all main.cpp helloWorld.cpp beer.cpp -o " HQ9+"
2424
2525fi
2626
Original file line number Diff line number Diff line change 1+ #include " helloWorld.hpp"
2+ #include < iostream>
3+
4+ void helloWorld () {
5+ std::cout << " Hello, world!" << std::endl;
6+ }
Original file line number Diff line number Diff line change 1+ #ifndef HELLO_WORLD_HPP_
2+ #define HELLO_WORLD_HPP_
3+
4+ void helloWorld ();
5+
6+ #endif // HELLO_WORLD_HPP_
Original file line number Diff line number Diff line change 33#include < iostream>
44#include < string>
55
6+ #include " helloWorld.hpp"
67#include " beer.hpp"
78#define BUFFER_SIZE INT_MAX / UCHAR_MAX - USHRT_MAX
89
@@ -21,7 +22,7 @@ int main() {
2122 for (unsigned long long index = 0 ; index < strnlen (input, BUFFER_SIZE);
2223 index++) {
2324 if (input[index] == ' H' ) {
24- printf ( " Hello, world! \n " );
25+ helloWorld ( );
2526 } else if (input[index] == ' Q' ) {
2627 printf (" %s\n " , input);
2728 } else if (input[index] == ' 9' ) {
You can’t perform that action at this time.
0 commit comments