New test programs.

This commit is contained in:
Ernie Pasveer
2022-05-13 17:48:38 -05:00
parent 4796d562de
commit ca5b5a7608
7 changed files with 69 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
helloworld
+21
View File
@@ -0,0 +1,21 @@
# This is the default target, which will be built when
# you invoke make
.PHONY: all
all: helloworld
# This rule tells make how to build helloworld from helloworld.cpp
helloworld: helloworld.cpp
g++ -g -o helloworld helloworld.cpp function1.cpp
# This rule tells make to copy helloworld to the binaries subdirectory,
# creating it if necessary
.PHONY: install
install:
mkdir -p binaries
cp -p helloworld binaries
# This rule tells make to delete helloworld and helloworld.o
.PHONY: clean
clean:
rm -f helloworld helloworld.o function1.o
+1
View File
@@ -0,0 +1 @@
Simple Hello,World program.
+15
View File
@@ -0,0 +1,15 @@
#include "function1.h"
#include <iostream>
#include <unistd.h>
void function1 (const std::string& text) {
int i = 42;
sleep(2); // Simulate doing work.
std::cout << text << i << std::endl;
sleep(3); // Simulate doing work.
}
+6
View File
@@ -0,0 +1,6 @@
#pragma once
#include <string>
void function1 (const std::string& text);
+24
View File
@@ -0,0 +1,24 @@
#include <string>
#include <iostream>
void function1 (const std::string& message);
int main (int argc, char** argv) {
int j = 0;
for (int i=0; i<argc; i++) {
std::cout << "XX: " << i << " " << argv[i] << std::endl;
}
std::string message = "Hello, World!";
j++;
function1(message);
return 0;
}
+1
View File
@@ -0,0 +1 @@
hellostar