initial commit

This commit is contained in:
Greg Gauthier 2023-07-20 19:36:44 +01:00
commit cce320f2a5
15 changed files with 116 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
cmake-build-debug/

8
.idea/.gitignore vendored Normal file
View File

@ -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

2
.idea/NewProject.iml Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/NewProject.iml" filepath="$PROJECT_DIR$/.idea/NewProject.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

6
CMakeLists.txt Normal file
View File

@ -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)

9
src/inc1/convo.cpp Normal file
View File

@ -0,0 +1,9 @@
void greet();
void respond();
void respond2();
void convo() {
greet();
respond();
respond2();
}

5
src/inc1/greet.cpp Normal file
View File

@ -0,0 +1,5 @@
#include<iostream>
void greet() {
std::cout << "Hello, there!" << std::endl;
}

5
src/inc1/respond.cpp Normal file
View File

@ -0,0 +1,5 @@
#include <iostream>
void respond() {
std::cout << "Nice to meet you!" << std::endl;
}

5
src/inc1/respond2.cpp Normal file
View File

@ -0,0 +1,5 @@
#include <iostream>
void respond2() {
std::cout << "Likewise, to be sure!" << std::endl;
}

8
src/inc2/fruit.cpp Normal file
View File

@ -0,0 +1,8 @@
//
// Created by gmgauthier on 20/07/23.
//
#include <iostream>
void fruit() {
std::cout << "Let's not mix apples and oranges, here!" << std::endl;
}

21
src/inc3/calculator.cpp Normal file
View File

@ -0,0 +1,21 @@
//
// Created by gmgauthier on 20/07/23.
//
#include <iostream>
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;
}

15
src/inc3/calculator.h Normal file
View File

@ -0,0 +1,15 @@
//
// Created by gmgauthier on 20/07/23.
//
#ifndef NEWPROJECT_CALCULATOR_H
#define NEWPROJECT_CALCULATOR_H
#include <iostream>
int sum(int, int);
int diff(int, int);
int prod(int, int);
void outmsg(const std::string&);
#endif //NEWPROJECT_CALCULATOR_H

13
src/main.cpp Normal file
View File

@ -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;
}