From cce320f2a5049ed9ebe51fe081af6044a5d11e1a Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Thu, 20 Jul 2023 19:36:44 +0100 Subject: [PATCH] initial commit --- .gitignore | 1 + .idea/.gitignore | 8 ++++++++ .idea/NewProject.iml | 2 ++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ CMakeLists.txt | 6 ++++++ src/inc1/convo.cpp | 9 +++++++++ src/inc1/greet.cpp | 5 +++++ src/inc1/respond.cpp | 5 +++++ src/inc1/respond2.cpp | 5 +++++ src/inc2/fruit.cpp | 8 ++++++++ src/inc3/calculator.cpp | 21 +++++++++++++++++++++ src/inc3/calculator.h | 15 +++++++++++++++ src/main.cpp | 13 +++++++++++++ 15 files changed, 116 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/NewProject.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 CMakeLists.txt create mode 100644 src/inc1/convo.cpp create mode 100644 src/inc1/greet.cpp create mode 100644 src/inc1/respond.cpp create mode 100644 src/inc1/respond2.cpp create mode 100644 src/inc2/fruit.cpp create mode 100644 src/inc3/calculator.cpp create mode 100644 src/inc3/calculator.h create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3f5dcf4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +cmake-build-debug/ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/NewProject.iml b/.idea/NewProject.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/NewProject.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..79b3c94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..c0690cd --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a8ded4a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.22) +project(NewProject) + +set(CMAKE_CXX_STANDARD 17) + +add_executable(NewProject src/main.cpp src/inc1/convo.cpp src/inc1/greet.cpp src/inc1/respond.cpp src/inc1/respond2.cpp src/inc3/calculator.cpp src/inc3/calculator.h) diff --git a/src/inc1/convo.cpp b/src/inc1/convo.cpp new file mode 100644 index 0000000..e899fd4 --- /dev/null +++ b/src/inc1/convo.cpp @@ -0,0 +1,9 @@ +void greet(); +void respond(); +void respond2(); + +void convo() { + greet(); + respond(); + respond2(); +} \ No newline at end of file diff --git a/src/inc1/greet.cpp b/src/inc1/greet.cpp new file mode 100644 index 0000000..4011475 --- /dev/null +++ b/src/inc1/greet.cpp @@ -0,0 +1,5 @@ +#include + +void greet() { + std::cout << "Hello, there!" << std::endl; +} \ No newline at end of file diff --git a/src/inc1/respond.cpp b/src/inc1/respond.cpp new file mode 100644 index 0000000..115cb53 --- /dev/null +++ b/src/inc1/respond.cpp @@ -0,0 +1,5 @@ +#include + +void respond() { + std::cout << "Nice to meet you!" << std::endl; +} \ No newline at end of file diff --git a/src/inc1/respond2.cpp b/src/inc1/respond2.cpp new file mode 100644 index 0000000..151a379 --- /dev/null +++ b/src/inc1/respond2.cpp @@ -0,0 +1,5 @@ +#include + +void respond2() { + std::cout << "Likewise, to be sure!" << std::endl; +} \ No newline at end of file diff --git a/src/inc2/fruit.cpp b/src/inc2/fruit.cpp new file mode 100644 index 0000000..6500402 --- /dev/null +++ b/src/inc2/fruit.cpp @@ -0,0 +1,8 @@ +// +// Created by gmgauthier on 20/07/23. +// +#include + +void fruit() { + std::cout << "Let's not mix apples and oranges, here!" << std::endl; +} \ No newline at end of file diff --git a/src/inc3/calculator.cpp b/src/inc3/calculator.cpp new file mode 100644 index 0000000..4deaa90 --- /dev/null +++ b/src/inc3/calculator.cpp @@ -0,0 +1,21 @@ +// +// Created by gmgauthier on 20/07/23. +// +#include + +int sum(int x, int y) { + return x+y; +} + +int diff(int x, int y) { + return x - y; +} + +int prod(int x, int y) { + return x*y; +} + +[[maybe_unused]] void outmsg(const std::string& message) { + std::cout << message << std::endl; +} + diff --git a/src/inc3/calculator.h b/src/inc3/calculator.h new file mode 100644 index 0000000..aecd9ed --- /dev/null +++ b/src/inc3/calculator.h @@ -0,0 +1,15 @@ +// +// Created by gmgauthier on 20/07/23. +// + +#ifndef NEWPROJECT_CALCULATOR_H +#define NEWPROJECT_CALCULATOR_H + +#include + +int sum(int, int); +int diff(int, int); +int prod(int, int); +void outmsg(const std::string&); + +#endif //NEWPROJECT_CALCULATOR_H diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..86ed401 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,13 @@ +#include "inc2/fruit.cpp" +#include "inc3/calculator.h" +void convo(); + +int main() { + convo(); + fruit(); + std::cout << sum(2, 2) << std::endl; + std::cout << diff(10, 4) << std::endl; + std::cout << prod(12, 4) << std::endl; + outmsg("Do you like my math?"); + return 0; +}