Skip to content

Commit be8de01

Browse files
committed
mv H into its own class
1 parent 12895cb commit be8de01

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ include_directories(.)
55
add_executable(
66
${PROJECT_NAME}
77
main.cpp
8+
helloWorld.hpp
9+
helloWorld.cpp
810
beer.hpp
911
beer.cpp
1012
)

bootstrap.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -euo pipefail
33
IFS=$'\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

2121
elif [[ "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

2525
fi
2626

helloWorld.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "helloWorld.hpp"
2+
#include <iostream>
3+
4+
void helloWorld() {
5+
std::cout << "Hello, world!" << std::endl;
6+
}

helloWorld.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef HELLO_WORLD_HPP_
2+
#define HELLO_WORLD_HPP_
3+
4+
void helloWorld();
5+
6+
#endif // HELLO_WORLD_HPP_

main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
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') {

0 commit comments

Comments
 (0)