Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
1319ed762a | |||
2721733888 | |||
815bd75dbd | |||
3386ea589a | |||
33d57b7474 | |||
56ffdf902c | |||
cf0dd37025 | |||
c40c2b4ae9 | |||
2b2613c101 | |||
a8d24e2f4d | |||
286258cc37 | |||
0849707d7b | |||
cdb3a5c556 | |||
441c2ab363 | |||
81891b741f |
34
ChangeLog
Normal file
34
ChangeLog
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
2024-07-26 hwpplayer1 <hwpplayer1@debian>
|
||||||
|
|
||||||
|
* src/decleration.cpp: decleration example
|
||||||
|
|
||||||
|
* src/namespace_decleration.cpp: namespace / decleration example
|
||||||
|
|
||||||
|
* C++ Primer (5th Edition).pdf: 3.2. Library string Type page 125
|
||||||
|
|
||||||
|
2024-07-03 hwpplayer1 <hwpplayer1@debian>
|
||||||
|
|
||||||
|
* README.md: Chapter 3. Strings, Vectors, and Arrays page 122
|
||||||
|
|
||||||
|
2024-07-01 hwpplayer1 <hwpplayer1@debian>
|
||||||
|
|
||||||
|
* src/local_j.cpp: local j value test code / 2.3. Compound Types page Page 82
|
||||||
|
|
||||||
|
2024-06-30 hwpplayer1 <hwpplayer1@debian>
|
||||||
|
|
||||||
|
* src/reused_scope.cpp: reused scope example writtenx
|
||||||
|
|
||||||
|
* src/scope_example.cpp: scope example sum of 1 to 10 inclusive is explained
|
||||||
|
|
||||||
|
* src/if_statement.cpp: if statement explained/code written
|
||||||
|
|
||||||
|
2024-06-24 hwpplayer1 <hwpplayer1@debian>
|
||||||
|
|
||||||
|
* src/for_example_2.cpp: another for example
|
||||||
|
|
||||||
|
* src/for_example.cpp: For example sum of 1 to 10 inclusive is ...
|
||||||
|
|
||||||
|
* src/sum_numbers.cpp (main): Sum of 50 to 100 inclusive is ...
|
||||||
|
|
||||||
|
* src/while_statement.cpp (main): While example written
|
||||||
|
|
20
README.md
20
README.md
|
@ -1,6 +1,6 @@
|
||||||
# cpp-dojo
|
# C++ Dojo
|
||||||
|
|
||||||
C++ Training with examples written by the cpp-dojo community
|
C++ Training
|
||||||
|
|
||||||
# Forge Platforms
|
# Forge Platforms
|
||||||
|
|
||||||
|
@ -22,13 +22,21 @@ C++ Training with examples written by the cpp-dojo community
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
C++ Training with examples written by the cpp-dojo community
|
C++ Training
|
||||||
|
|
||||||
Copyright (C) 2023-2024 Mert Gör and contributors
|
Copyright (C) 2024 QB Networks
|
||||||
|
|
||||||
Copyright (C) 2023-2024 Masscollabs Services
|
Copyright (C) 2017-2024 Masscollabs Services
|
||||||
|
|
||||||
Copyright (C) 2023-2024 Mass Collaboration Labs and contributors
|
Copyright (C) 2017-2024 Procyberian and contributors
|
||||||
|
|
||||||
|
Copyright (C) 2017-2024 Mass Collaboration Labs and contributors
|
||||||
|
|
||||||
|
Copyright (C) 2017-2024 amassivus and contributors
|
||||||
|
|
||||||
|
Copyright (C) 2024 godigitalist and contributors
|
||||||
|
|
||||||
|
Copyright (C) 2024 bilsege and contributors
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published
|
it under the terms of the GNU Affero General Public License as published
|
||||||
|
|
94
src/.gitignore
vendored
Normal file
94
src/.gitignore
vendored
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/emacs
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=emacs
|
||||||
|
|
||||||
|
### Emacs ###
|
||||||
|
# -*- mode: gitignore; -*-
|
||||||
|
*~
|
||||||
|
\#*\#
|
||||||
|
/.emacs.desktop
|
||||||
|
/.emacs.desktop.lock
|
||||||
|
*.elc
|
||||||
|
auto-save-list
|
||||||
|
tramp
|
||||||
|
.\#*
|
||||||
|
|
||||||
|
# Org-mode
|
||||||
|
.org-id-locations
|
||||||
|
*_archive
|
||||||
|
|
||||||
|
# flymake-mode
|
||||||
|
*_flymake.*
|
||||||
|
|
||||||
|
# eshell files
|
||||||
|
/eshell/history
|
||||||
|
/eshell/lastdir
|
||||||
|
|
||||||
|
# elpa packages
|
||||||
|
/elpa/
|
||||||
|
|
||||||
|
# reftex files
|
||||||
|
*.rel
|
||||||
|
|
||||||
|
# AUCTeX auto folder
|
||||||
|
/auto/
|
||||||
|
|
||||||
|
# cask packages
|
||||||
|
.cask/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# Flycheck
|
||||||
|
flycheck_*.el
|
||||||
|
|
||||||
|
# server auth directory
|
||||||
|
/server/
|
||||||
|
|
||||||
|
# projectiles files
|
||||||
|
.projectile
|
||||||
|
|
||||||
|
# directory configuration
|
||||||
|
.dir-locals.el
|
||||||
|
|
||||||
|
# network security
|
||||||
|
/network-security.data
|
||||||
|
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/emacs
|
||||||
|
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/c++
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=c++
|
||||||
|
|
||||||
|
### C++ ###
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
*.smod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/c++
|
12
src/calculate.cpp
Normal file
12
src/calculate.cpp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::cout << "enter two numbers:" << std::endl;
|
||||||
|
int value1 = 0, value2 = 0;
|
||||||
|
std::cin >> value1 >> value2;
|
||||||
|
std::cout << "The sum of " << value1 << " and " << value2
|
||||||
|
<< " is " << value1 + value2 << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
13
src/decleration.cpp
Normal file
13
src/decleration.cpp
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout; using std::endl;
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
cout << "Enter two numbers:" << endl;
|
||||||
|
int v1, v2;
|
||||||
|
cin >> v1 >> v2;
|
||||||
|
cout << "The sum of " << v1 << " and " << v2
|
||||||
|
<< " is " << v1 + v2 << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
14
src/for_example.cpp
Normal file
14
src/for_example.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int sum = 0;
|
||||||
|
|
||||||
|
for (int value = 1; value <= 10; ++value)
|
||||||
|
|
||||||
|
sum += value;
|
||||||
|
|
||||||
|
std::cout << "Sum of 1 to 10 inclusive is "
|
||||||
|
<< sum << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
15
src/for_example_2.cpp
Normal file
15
src/for_example_2.cpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int sum = 0;
|
||||||
|
|
||||||
|
for (int value = 1; value <= 5; ++value)
|
||||||
|
{
|
||||||
|
sum += value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Sum of 1 to 10 inclusive is "
|
||||||
|
<< sum << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
8
src/hello.cpp
Normal file
8
src/hello.cpp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::cout << "Hello World of C++\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
28
src/if_statement.cpp
Normal file
28
src/if_statement.cpp
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int currVal = 0, val = 0;
|
||||||
|
|
||||||
|
if (std::cin >> currVal)
|
||||||
|
{
|
||||||
|
int cnt = 1;
|
||||||
|
while (std::cin >> val)
|
||||||
|
{
|
||||||
|
if (val == currVal)
|
||||||
|
{
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << currVal << " occurs "
|
||||||
|
<< cnt << " times " << std::endl;
|
||||||
|
currVal = val;
|
||||||
|
cnt = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << currVal << " occurs "
|
||||||
|
<< cnt << " times " << std::endl;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
15
src/local_j.cpp
Normal file
15
src/local_j.cpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int i = 42;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int i = 100;
|
||||||
|
std::cout << "int i local i is "
|
||||||
|
<< i << std::endl;
|
||||||
|
int j = i;
|
||||||
|
std::cout << "int j local j is "
|
||||||
|
<< i << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
13
src/namespace_decleration.cpp
Normal file
13
src/namespace_decleration.cpp
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout; using std::endl;
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
cout << "Enter two numbers:" << endl;
|
||||||
|
int v1, v2;
|
||||||
|
cin >> v1 >> v2;
|
||||||
|
cout << "The sum of " << v1 << " and " << v2
|
||||||
|
<< " is " << v1 + v2 << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
18
src/reused_scope.cpp
Normal file
18
src/reused_scope.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int reused = 42;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int unique = 0;
|
||||||
|
|
||||||
|
std::cout << reused << " " << unique << std::endl;
|
||||||
|
|
||||||
|
int reused = 0;
|
||||||
|
|
||||||
|
std::cout << reused << " " << unique << std::endl;
|
||||||
|
|
||||||
|
std::cout << ::reused << " " << unique << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
14
src/scope_example.cpp
Normal file
14
src/scope_example.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int sum = 0;
|
||||||
|
for (int val = 0; val <= 10; ++val)
|
||||||
|
|
||||||
|
sum += val;
|
||||||
|
std::cout << "Sum of 1 to 10 inclusive is "
|
||||||
|
<< sum << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
16
src/sum_numbers.cpp
Normal file
16
src/sum_numbers.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int sum = 0, value = 50;
|
||||||
|
|
||||||
|
while(value <= 100)
|
||||||
|
{
|
||||||
|
sum += value;
|
||||||
|
++value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Sum of 50 to 100 inclusive is " << sum << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
16
src/while_statement.cpp
Normal file
16
src/while_statement.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int sum = 0, value = 1;
|
||||||
|
|
||||||
|
while(value <= 10)
|
||||||
|
{
|
||||||
|
sum += value;
|
||||||
|
++value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Sum of 1 to 10 inclusive is " << sum << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user