Skip to content

Commit 4f4ee5e

Browse files
committed
Add C++ Header files
1 parent f4f17e9 commit 4f4ee5e

File tree

6 files changed

+54
-15
lines changed

6 files changed

+54
-15
lines changed

HelloWorld/Common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#include "Log.h"

HelloWorld/HelloWorld.vcxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@
1919
</ProjectConfiguration>
2020
</ItemGroup>
2121
<ItemGroup>
22+
<ClCompile Include="Log.cpp" />
2223
<ClCompile Include="Main.cpp" />
2324
</ItemGroup>
25+
<ItemGroup>
26+
<ClInclude Include="Common.h" />
27+
<ClInclude Include="Log.h" />
28+
</ItemGroup>
2429
<PropertyGroup Label="Globals">
2530
<VCProjectVersion>16.0</VCProjectVersion>
2631
<Keyword>Win32Proj</Keyword>

HelloWorld/HelloWorld.vcxproj.filters

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,16 @@
1818
<ClCompile Include="Main.cpp">
1919
<Filter>Fichiers sources</Filter>
2020
</ClCompile>
21+
<ClCompile Include="Log.cpp">
22+
<Filter>Fichiers sources</Filter>
23+
</ClCompile>
24+
</ItemGroup>
25+
<ItemGroup>
26+
<ClInclude Include="Log.h">
27+
<Filter>Fichiers d%27en-tête</Filter>
28+
</ClInclude>
29+
<ClInclude Include="Common.h">
30+
<Filter>Fichiers d%27en-tête</Filter>
31+
</ClInclude>
2132
</ItemGroup>
2233
</Project>

HelloWorld/Log.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <iostream>
2+
#include "Log.h"
3+
#include "Common.h"
4+
5+
#ifndef _LOG_H
6+
#define _LOG_H
7+
8+
void Log(const char* message);
9+
void InitLog();
10+
11+
struct Player {};
12+
13+
#endif
14+
15+
void InitLog()
16+
{
17+
Log("Initialize Log");
18+
}
19+
20+
void Log(const char* message)
21+
{
22+
std::cout << message << std::endl;
23+
}

HelloWorld/Log.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifndef _LOG_H
2+
#define _LOG_H
3+
4+
void Log(const char* message);
5+
void InitLog();
6+
7+
struct Player {};
8+
9+
#endif

HelloWorld/Main.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
#include <iostream>
2-
3-
int Multiply(int a, int b)
4-
{
5-
return a * b;
6-
}
7-
8-
void MultiplyAndLog(int a, int b)
9-
{
10-
int result = Multiply(a, b);
11-
std::cout << result << std::endl;
12-
}
2+
#include "Log.h"
133

144
int main()
155
{
16-
MultiplyAndLog(3, 2);
17-
MultiplyAndLog(8, 5);
18-
MultiplyAndLog(90, 45);
19-
6+
InitLog();
7+
Log("Hello World!");
208
std::cin.get();
219
}

0 commit comments

Comments
 (0)