Skip to content
Snippets Groups Projects
Commit a94aea6f authored by Colbry, Dirk's avatar Colbry, Dirk
Browse files

Merge branch 'JessicaBranch' into 'main'

adding STL

See merge request !10
parents d064fa86 75bc7633
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id:fc73d74c tags:
``` python
##ANSWER##
#Install answercheck in current director
from urllib.request import urlretrieve
urlretrieve('https://raw.githubusercontent.com/colbrydi/jupytercheck/master/answercheck.py', filename='answercheck.py')
##ANSWER##
```
%% Output
('answercheck.py', <http.client.HTTPMessage at 0x7fd334327910>)
%% Cell type:markdown id:3c2a4f39 tags:
# C++ Standard Library
Allows us to store and manipulate data. The overarching library of C++
%% Cell type:markdown id:71e867d9 tags:
## Description
This is a broad library. As with any library (programming or not), it contains many topics with their own information. You will learn more about each of these parts and their implementation later. In the mean time, understand the Standard Library contains the following components:
- Algorithms
- including Functions
- Containers
- Iterators
This contains other, niche libraries within it. Just like in Python how you need to import packages, in C++ you need to import libraries.
- Python Importation example:
- import pandas as pd
- C++ Importation example:
- #include <vector.>
%% Cell type:markdown id:b2ddba57 tags:
**Note on Naming Convention** <br/>
You may hear the Standard Template Library, aka STL, used interchangeably with the C++ Standard Library. While these are technically not the same thing, it is beyond the scope of this content. Note that often in C++ you use **std::somethinghere**, for example:
``` bash
std::vector
std::string
```
the STD stands for **ST**andar**D** library. That is why STD is used instead of STL - again, beyond the scope of this content but now you know why STD is used in front of these statements.
%% Cell type:markdown id:58ec20e8 tags:
## Self Assessment
Questions that test for the learning goals and allows students to evaluate if they truly understand the topics.
%% Cell type:markdown id:4af35ce7 tags:
&#9989; **<span style="color:red">Question 1:</span>** Of the three parts that make up the library (container, algorithm, iterator), which would be used to loop through a vector, like a for-loop would do?
1. container
2. algorithm
3. iterator
%% Cell type:code id:15f43828 tags:
``` python
##ANSWER##
3
##ANSWER##
```
%% Output
3
%% Cell type:markdown id:3921c156 tags:
&#9989; **<span style="color:red">Question 2:</span>** Which of the following would a vector be an example of?
1. container
2. algorithm
3. iterator
%% Cell type:code id:c3dfd97d tags:
``` python
##ANSWER##
1
##ANSWER##
```
%% Output
1
%% Cell type:markdown id:975f2784 tags:
&#9989; **<span style="color:red">Question 3:</span>** Which of the following would a contain a function to reverse the values of a vector?
1. container
2. algorithm
3. iterator
%% Cell type:code id:77e8e9d9 tags:
``` python
##ANSWER##
2
##ANSWER##
```
%% Output
2
%% Cell type:markdown id:369d2119 tags:
&#9989; **<span style="color:red">Question 4:</span>** Which of the following would a for-loop be classified under?
1. container
2. algorithm
3. iterator
%% Cell type:code id:44341f6a tags:
``` python
##ANSWER##
2
##ANSWER##
```
%% Output
2
%% Cell type:markdown id:2a3fad10 tags:
## Training Materials
%% Cell type:markdown id:ea15c34b tags:
#### Introduction to the Standard Library and Primary Makeup
%% Cell type:markdown id:343e3b11 tags:
&#9989; **<span style="color:red">Read the following website:</span>** https://www.softwaretestinghelp.com/standard-template-library-stl/
<br/>
**Note:** You do not need to know everything in this website but your takeaways should be the following:
- Understand WHAT a container, algorithm and iterator are
- Understand what they DO
- You do not need to know the types of each (yet) but it is good to read through and famiiliarize yourself with them because they may be used in the future
%% Cell type:markdown id:b44650dd tags:
#### Other libraries within the Standard Library
%% Cell type:markdown id:e49bda54 tags:
&#9989; **<span style="color:red">Read the following website:</span>** https://en.cppreference.com/w/cpp/header <br/>
**Note:** Some of the names of the headers should be familiar to you! Keep this in mind when studying - you are not starting from scratch but can infer some information already.
- Vector
- String
- Random
- Cmath
<br/> <br/>
You will only use a fraction of these libraries in your coursework but it is good to see how they are organized.
%% Cell type:markdown id:44b461a0 tags:
---
Written by Jessica Parks, Michigan State University
As part of the Data Science Bridge Project
<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">Creative Commons Attribution-NonCommercial 4.0 International License</a>.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment