8000 Added a couple of new slides to first session · estimand/intro-to-cpp@f1de896 · GitHub
[go: up one dir, main page]

Skip to content

Commit f1de896

Browse files
committed
Added a couple of new slides to first session
1 parent 7c3e749 commit f1de896

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Binary file not shown.

01_intro_to_c_and_cpp/slides/intro_to_c_and_cpp.tex

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,72 @@
66

77
\maketitle
88

9+
\begin{frame}{Thinking like a Computer Scientist}
10+
\only<1>{%
11+
\begin{block}{Computer Scientists\ldots}
12+
\begin{itemize}
13+
\item Use formal languages to denote ideas
14+
\item Design things, assembling components into systems
15+
\item Observe the behaviour of complex systems, form hypotheses,
16+
and test predictions
17+
\end{itemize}
18+
\end{block}}
19+
\only<2>{%
20+
\begin{center}
21+
\Large%
22+
What's the most important skill \\
23+
for a Computer Scientist?
24+
\end{center}}
25+
\end{frame}
26+
27+
\begin{frame}{Algorithms}
28+
\begin{itemize}
29+
\setlength{\itemsep}{0.75em}
30+
\item Step\hyp{}by\hyp{}step lists of instructions to solve a problem
31+
\item Can be represented in a specific notation (programs)
32+
\item Can be executed automatically by a computer
33+
\end{itemize}
34+
\end{frame}
35+
36+
\begin{frame}{Programs}
37+
\begin{itemize}
38+
\setlength{\itemsep}{0.75em}
39+
\item Sequences of instructions that describes a computation
40+
\item Basic instructions include:
41+
\begin{itemize}
42+
\item Input/output
43+
\item Mathematical and logical operations
44+
\item Conditional execution (if\hyp{}then)
45+
\item Repetition
46+
\end{itemize}
47+
\end{itemize}
48+
\end{frame}
49+
50+
\begin{frame}{Let's write an algorithm!}
51+
\begin{center}
52+
\Large%
53+
Compute the sum \\
54+
of all even numbers \\
55+
in a given list
56+
\end{center}
57+
\end{frame}
58+
59+
\begin{frame}[fragile]{Our algorithm\ldots~in C++}
60+
\begin{cpp}
61+
const int n = 10;
62+
int x[n] = {0, 1, 1, 2, 3, 5, 8, 13, 21, 34};
63+
64+
int result = 0;
65+
for (int i = 0; i < n; i++)
66+
{
67+
if (x[i] % 2 == 0)
68+
{
69+
result += x[i];
70+
}
71+
}
72+
\end{cpp}
73+
\end{frame}
74+
975
\begin{frame}{What is C++?}
1076
\begin{block}{C++ is\ldots}
1177
\begin{itemize}

0 commit comments

Comments
 (0)
0