Skip to content

Commit

Permalink
mv H into its own class
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasLarson committed Aug 19, 2020
1 parent 12895cb commit be8de01
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_directories(.)
add_executable(
${PROJECT_NAME}
main.cpp
helloWorld.hpp
helloWorld.cpp
beer.hpp
beer.cpp
)
6 changes: 3 additions & 3 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'

Expand All @@ -16,11 +16,11 @@ if [[ Darwin = "$platform" ]]; then
-fdiagnostics-fixit-info -fdiagnostics-parseable-fixits \
-fdiagnostics-print-source-range-info -fdiagnostics-show-option \
-fno-builtin -fshow-column -fshow-source-location -fstandalone-debug \
-ftime-report main.cpp beer.cpp -o "HQ9+"
-ftime-report main.cpp helloWorld.cpp beer.cpp -o "HQ9+"

elif [[ "Linux" = "$platform" ]]; then
g++ --verbose -Wall -Wextra -pedantic -save-temps -v -fgnu-tm -lm -latomic \
-lstdc++ -g -fgnat-encodings=all main.cpp beer.cpp -o "HQ9+"
-lstdc++ -g -fgnat-encodings=all main.cpp helloWorld.cpp beer.cpp -o "HQ9+"

fi

Expand Down
6 changes: 6 additions & 0 deletions helloWorld.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "helloWorld.hpp"
#include <iostream>

void helloWorld() {
std::cout << "Hello, world!" << std::endl;
}
6 changes: 6 additions & 0 deletions helloWorld.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef HELLO_WORLD_HPP_
#define HELLO_WORLD_HPP_

void helloWorld();

#endif // HELLO_WORLD_HPP_
3 changes: 2 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <iostream>
#include <string>

#include "helloWorld.hpp"
#include "beer.hpp"
#define BUFFER_SIZE INT_MAX / UCHAR_MAX - USHRT_MAX

Expand All @@ -21,7 +22,7 @@ int main() {
for (unsigned long long index = 0; index < strnlen(input, BUFFER_SIZE);
index++) {
if (input[index] == 'H') {
printf("Hello, world!\n");
helloWorld();
} else if (input[index] == 'Q') {
printf("%s\n", input);
} else if (input[index] == '9') {
Expand Down

0 comments on commit be8de01

Please sign in to comment.