Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mgoullie
sp4_exercises
Commits
05d4bdb3
Commit
05d4bdb3
authored
Sep 30, 2020
by
Emil
Browse files
week 3 exercises added
parent
19faf5b5
Changes
6
Hide whitespace changes
Inline
Side-by-side
exercises/week3/stl/starting_point/CMakeLists.txt
0 → 100644
View file @
05d4bdb3
cmake_minimum_required
(
VERSION 2.6
)
add_executable
(
main main.cc
)
# add_executable(memory_first memory_first.cc)
# add_executable(memory_second memory_second.cc)
# add_executable(memory_third memory_third.cc)
exercises/week3/stl/starting_point/main.cc
0 → 100644
View file @
05d4bdb3
#include
<cstdlib>
#include
<string>
#include
<vector>
#include
<algorithm>
#include
<cmath>
#include
<fstream>
#include
<iomanip>
#include
<iostream>
/* -------------------------------------------------------------------------- */
int
main
(
int
argc
,
char
**
argv
){
return
EXIT_SUCCESS
;
}
exercises/week3/stl/starting_point/memory_first.cc
0 → 100644
View file @
05d4bdb3
#include
<vector>
#include
<array>
#include
<memory>
#include
<iostream>
int
main
()
{
int
values
;
for
(
int
&
v
:
values
)
v
=
0
;
for
(
int
i
=
0
;
i
<
10
;
++
i
)
std
::
cout
<<
values
[
i
]
<<
" "
;
std
::
cout
<<
std
::
endl
;
return
0
;
}
exercises/week3/stl/starting_point/memory_second.cc
0 → 100644
View file @
05d4bdb3
#include
<vector>
#include
<array>
#include
<memory>
#include
<iostream>
std
::
vector
<
int
>*
stack_allocation
(
int
n
)
{
return
nullptr
;
}
std
::
vector
<
int
>*
heap_allocation
(
int
n
)
{
return
nullptr
;
}
int
main
()
{
std
::
vector
<
int
>
*
stack_values
=
stack_allocation
(
10
);
std
::
vector
<
int
>
*
heap_values
=
heap_allocation
(
10
);
std
::
cout
<<
stack_values
->
size
()
<<
", "
<<
heap_values
->
size
()
<<
std
::
endl
;
return
0
;
}
exercises/week3/stl/starting_point/memory_third.cc
0 → 100644
View file @
05d4bdb3
#include
<vector>
#include
<array>
#include
<memory>
#include
<iostream>
int
main
()
{
auto
unique
=
std
::
make_unique
<
std
::
vector
<
int
>>
(
10
);
std
::
unique_ptr
<
std
::
vector
<
int
>>
other
=
nullptr
;
other
=
unique
;
}
exercises/week3/stl/sujet.pdf
0 → 100644
View file @
05d4bdb3
File added
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment