<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass{beamer}
\usepackage{verbatim}
\usepackage[english]{babel}


\usepackage{lmodern}
\usepackage{listings}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

\usepackage{textcomp}
\usepackage{xcolor,colortbl}
\usepackage[utf8]{inputenc}
\usepackage{flexisym}
\usepackage{comment}
\newcommand{\apostrophe}{{\quotefont\textquotesingle}} % or just use {\quotefont text}

\definecolor{Gray}{gray}{0.85}
\definecolor{LightCyan}{rgb}{0.88,1,1}

\newcolumntype{a}{&gt;{\columncolor{Gray}}c}
\newcolumntype{b}{&gt;{\columncolor{white}}c}

\newenvironment&lt;&gt;{varblock}[2][.9\textwidth]{%
  \setlength{\textwidth}{#1}
  \begin{actionenv}#3%
    \def\insertblocktitle{#2}%
    \par%
    \usebeamertemplate{block begin}}
  {\par%
    \usebeamertemplate{block end}%
  \end{actionenv}}
	
\usetheme{Frankfurt}
\usepackage{movie15}
\title{programming in C++}
\author{Jonas Vejlin}
\date{}

\begin{document}


\maketitle

\begin{frame}
\frametitle{Parts}

\begin{block}{Part 1}
Basic programming
\end{block}
\begin{block}{Part 2}
Control structure such as loops and if-else 
\end{block}
\begin{block}{Part 3}
Vector, Functions and Input/Ouput (Today)
\end{block}
\end{frame}
\section{Files}
\begin{frame}
\frametitle{Agenda}

 \frametitle{Table of Contents}
\tableofcontents[currentsection,hideallsubsections]

\end{frame}
\subsection{Write File}
\begin{frame}
\frametitle{Write File}

\begin{columns}[T]

\begin{column}{0.45\textwidth}
\begin{varblock}[6cm]{Source Code}
\setbeamercolor{alerted text}{fg=blue}
\setbeamerfont{alerted text}{series=\bfseries,family=\ttfamily}
\begin{semiverbatim} \small
\#include &lt;iostream&gt;\newline
\alert&lt;1&gt;{\#include &lt;fstream&gt;}\newline
using namespace std;\newline
int main()\newline
\{\newline
{\alert&lt;2&gt;{\hspace*{2em}ofstream myfile;}}\newline
{\alert&lt;3&gt;{\hspace*{2em}myfile.open ("C:\\\\example.txt");}}\newline
{\alert&lt;4&gt;{\hspace*{2em}myfile$&lt;&lt;$1$&lt;&lt;$\textquotesingle\\t\textquotesingle$&lt;&lt;$ 2$&lt;&lt;$endl;}}\newline
{\alert&lt;5&gt;{\hspace*{2em}myfile$&lt;&lt;$3$&lt;&lt;$\textquotesingle\\t\textquotesingle$&lt;&lt;$ 4$&lt;&lt;$endl;}}\newline
{\alert&lt;6&gt;{\hspace*{2em}myfile.close();}}\newline
	cin.get();\newline
\}
\end{semiverbatim} 
\end{varblock}
\end{column}

\begin{column}{0.45\textwidth}
\setbeamercolor{alerted text}{fg=blue}
\begin{varblock}[4cm]{File}
\alt&lt;1-3&gt;{ \hspace*{2em}\newline}{\alert&lt;4&gt;{1 \hspace*{2em} 2}\newline}
\alt&lt;1-4&gt;{ \hspace*{2em} \newline}{\alert&lt;5&gt;{3 \hspace*{2em} 4}\newline}
\end{varblock}
\setbeamercolor{alerted text}{fg=blue}
\begin{varblock}[4cm]{data}



\end{varblock}
\end{column}
\end{columns}
\end{frame}

\subsection{Read File}
\begin{frame}
\frametitle{Read File}

\begin{columns}[T]

\begin{column}{0.45\textwidth}
\begin{varblock}[6cm]{Source Code}
\setbeamercolor{alerted text}{fg=blue}
\setbeamerfont{alerted text}{series=\bfseries,family=\ttfamily}
\begin{semiverbatim} \small
\#include &lt;iostream&gt;\newline
\alert&lt;1&gt;{\#include &lt;fstream&gt;}\newline
\alert&lt;1&gt;{\#include &lt;string&gt;}\newline
using namespace std;\newline
int main()\newline
\{\newline
{\alert&lt;2&gt;{\hspace*{2em}ifstream \alert&lt;5&gt;{myfile};}}\newline
{\alert&lt;3&gt;{\hspace*{2em}myfile.open ("C:\\\\example.txt");}}\newline
{\alert&lt;4&gt;{\hspace*{2em}string \alert&lt;6&gt;{line};}}\newline
{					{\hspace*{2em}while(\alert&lt;9&gt;{\alert&lt;7&gt;{getline(\alert&lt;5&gt;{myfile},\alert&lt;6&gt;{line}))}}}}\newline
{					{\hspace*{2em}\{}}\newline
\alert&lt;10&gt;{\alert&lt;8&gt;{\hspace*{2em}cout$&lt;&lt;$line$&lt;&lt;$endl;}}\newline
{					{\hspace*{2em}\}}}\newline
{\alert&lt;11&gt;{\hspace*{2em}myfile.close();}}\newline
\}
\end{semiverbatim} 
\end{varblock}
\end{column}

\begin{column}{0.45\textwidth}
\setbeamercolor{alerted text}{fg=blue}
\begin{varblock}[4cm]{Output}
\alt&lt;1-7&gt;{ \hspace*{2em}\newline}{\alert&lt;8&gt;{1 \hspace*{2em} 2}\newline}
\alt&lt;1-9&gt;{ \hspace*{2em} \newline}{\alert&lt;10&gt;{3 \hspace*{2em} 4}\newline}
\end{varblock}
\setbeamercolor{alerted text}{fg=blue}
\begin{varblock}[4cm]{data}
\alt&lt;1-5&gt;{ \hspace*{2em}\newline}{\alt&lt;6-6&gt;{{\alert&lt;6&gt;{line}}\newline}{\alt&lt;7-8&gt;{\alert&lt;7&gt;{line= 1 \hspace*{2em} 2}}{\alert&lt;9&gt;{line= 3 \hspace*{2em} 4}}}}


\end{varblock}
\end{column}
\end{columns}
\end{frame}

\subsection{Splitting of a string}
\begin{frame}
\frametitle{Splitting of a string}

\begin{columns}[T]

\begin{column}{0.45\textwidth}
\begin{varblock}[6.35cm]{Source Code}
\setbeamercolor{alerted text}{fg=blue}
\setbeamerfont{alerted text}{series=\bfseries,family=\ttfamily}
\begin{semiverbatim} \small
\#include &lt;iostream&gt;\newline
\alert&lt;1&gt;{\#include &lt;sstream&gt;}\newline
using namespace std;\newline
int main()\newline
\{\newline
{\alert&lt;2&gt;{\hspace*{2em}string line="56.5,54.32";}}\newline
{\alert&lt;3&gt;{\hspace*{2em}string \alert&lt;6&gt;{ token};}}\newline
{\alert&lt;4&gt;{\hspace*{2em}stringstream \alert&lt;5&gt;{ss}(line);}}\newline
{					{\hspace*{2em}while(\alert&lt;11&gt;{\alert&lt;8&gt;{getline(\alert&lt;5&gt;{ss}, \alert&lt;6&gt;{token},\alert&lt;7&gt;{\textquotesingle,\textquotesingle }))}}}}\newline
{					{\hspace*{2em}\{}}\newline
								{\alert&lt;12&gt;{\alert&lt;10&gt;{double info=\alert&lt;9&gt;{atof(token.c_str());}}}}\newline
{					{\hspace*{2em}\}}}\newline
\}
\end{semiverbatim} 
\end{varblock}
\end{column}

\begin{column}{0.45\textwidth}
\setbeamercolor{alerted text}{fg=blue}
\begin{varblock}[4cm]{Output}

\end{varblock}

\setbeamercolor{alerted text}{fg=blue}
\begin{varblock}[4cm]{data}
\alt&lt;1-1&gt;{ \hspace*{2em}\newline}{\alert&lt;2&gt;{line="56.5,54.32"}\newline}
\alt&lt;1-2&gt;{ \hspace*{2em}\newline}{\alt&lt;3-7&gt;{\alert&lt;3&gt;{token}}{\alt&lt;8-10&gt;{\alert&lt;8&gt;{token=56.5}}{\alert&lt;11&gt;{token=54.32}}}\newline}
\alt&lt;1-9&gt;{ \hspace*{2em}\newline}{\alt&lt;10-11&gt;{\alert&lt;10&gt;{info=56.5}}{\alert&lt;12&gt;{info=54.32}}}
\end{varblock}
\end{column}
\end{columns}
\end{frame}
\section{Vector}
\begin{frame}
\frametitle{Agenda}

 \frametitle{Table of Contents}
\tableofcontents[currentsection,hideallsubsections]

\end{frame}

\subsection{Graphical Representation}
\begin{frame}
\frametitle{Graphical Representation}
\begin{center}
\includegraphics&lt;1&gt;[width=.60\textwidth]{array.png}
\end{center}
\end{frame}

\subsection{Vector example}

\begin{frame}
\frametitle{Vector example}

\begin{columns}[T]

\begin{column}{0.45\textwidth}
\begin{varblock}[6cm]{Source Code}
\setbeamercolor{alerted text}{fg=blue}
\setbeamerfont{alerted text}{series=\bfseries,family=\ttfamily}
\begin{semiverbatim} \small
\#include &lt;iostream&gt;\newline
\#include &lt;vector&gt;\newline
using namespace std;\newline
int main()\newline
\{\newline
{\alert&lt;1&gt;{\hspace*{2em}vector&lt;int&gt; MyList(2)}}\newline
{\alert&lt;2&gt;{\hspace*{2em} MyList[0]=1;}}\newline
{\alert&lt;3&gt;{\hspace*{2em} MyList[1]=2;}}\newline
{\alert&lt;4&gt;{\hspace*{2em}  MyList.push_back(5);}}\newline
{\alert&lt;5&gt;{\hspace*{2em} cout$&lt;&lt;$MyList[0]$&lt;&lt;$endl;}}\newline
{\alert&lt;6&gt;{\hspace*{2em} cout$&lt;&lt;$MyList[1]$&lt;&lt;$endl;}}\newline
{\alert&lt;7&gt;{\hspace*{2em} cout$&lt;&lt;$MyList[2]$&lt;&lt;$endl;}}\newline
\}
\end{semiverbatim} 
\end{varblock}
\end{column}

\begin{column}{0.45\textwidth}
\setbeamercolor{alerted text}{fg=blue}
\begin{varblock}[4cm]{Output}

\alt&lt;1-4&gt;{ \hspace*{2em} \newline}{\alert&lt;5&gt;{1}\newline}
\alt&lt;1-5&gt;{ \hspace*{2em} \newline}{\alert&lt;6&gt;{2}\newline}
\alt&lt;1-6&gt;{ \hspace*{2em} \newline}{\alert&lt;7&gt;{5}\newline}
\end{varblock}

\setbeamercolor{alerted text}{fg=blue}
\begin{varblock}[4cm]{data}
\alt&lt;1-1&gt;{ \alert&lt;1&gt;{array1[0]=0}}{\alert&lt;2&gt;{array1[0]=1}\newline}
\alt&lt;1-2&gt;{ \alert&lt;1&gt;{array1[1]=0}}{\alert&lt;3&gt;{array1[1]=2}\newline}
\alt&lt;0-3&gt;{ \hspace*{2em}\newline}{\alert&lt;4&gt;{array1[2]=5}\newline}

\end{varblock}
\end{column}
\end{columns}
\end{frame}



\begin{frame}
\frametitle{loops and vector example}

\begin{columns}[T]

\begin{column}{0.45\textwidth}
\begin{varblock}[6.7cm]{Source Code}
\setbeamercolor{alerted text}{fg=blue}
\setbeamerfont{alerted text}{series=\bfseries,family=\ttfamily}
\begin{semiverbatim} \small
\#include &lt;iostream&gt;\newline
\alert&lt;1&gt;{\#include &lt;vector&gt;}\newline
using namespace std;\newline
int main()\newline
\{\newline
{\alert&lt;2&gt;{\hspace*{2em}vector&lt;double&gt; MyList(2);}}\newline
{\alert&lt;3&gt;{\hspace*{2em}MyList[0]=1.2;}}\newline
{\alert&lt;4&gt;{\hspace*{2em}MyList[1]=2.2;}}\newline
{{for(\alert&lt;5&gt;{int i=0};{\alert&lt;12&gt;{\alert&lt;9&gt;{\alert&lt;6&gt;{i&lt;MyList.size()}}}};{\alert&lt;11&gt;{\alert&lt;8&gt;{i=i+1)}}}}}\newline
{					{\hspace*{2em}\{}}\newline
{\alert&lt;10&gt;{\alert&lt;7&gt;{\hspace*{2em}{cout$&lt;&lt;$"the value is " $&lt;&lt;$MyList[i]$&lt;&lt;$endl;}}}}\newline
{					{\hspace*{2em}\}}}\newline
\}
\end{semiverbatim} 
\end{varblock}
\end{column}

\begin{column}{0.45\textwidth}
\setbeamercolor{alerted text}{fg=blue}
\begin{varblock}[4cm]{Output}
\alt&lt;1-6&gt;{ \hspace*{2em} \newline}{\alert&lt;7&gt;{the value is 1.2}\newline}
\alt&lt;1-9&gt;{ \hspace*{2em} \newline}{\alert&lt;10&gt;{the value is 2.2}\newline}

\end{varblock}

\setbeamercolor{alerted text}{fg=blue}
\begin{varblock}[4cm]{data}
\alt&lt;0-1&gt;{ \hspace*{2em}\newline}{\alt&lt;2&gt;{\alert&lt;2&gt;{MyList[0]=0}}{\alert&lt;3&gt;{MyList[0]=1.2}}\newline}
\alt&lt;0-1&gt;{ \hspace*{2em}\newline}{\alt&lt;2-3&gt;{\alert&lt;2&gt;{MyList[1]=0}}{\alert&lt;4&gt;{MyList[0]=2.2}}\newline}

\alt&lt;1-4&gt;{ \hspace*{2em}\newline}{\alt&lt;5-7&gt;{\alert&lt;5&gt;{i=0}}{\alt&lt;8-10&gt;{\alert&lt;8&gt;{i=1}}{\alt&lt;11-13&gt;{\alert&lt;11&gt;{i=2}}{\alert&lt;15&gt;{i=3}}}}}\newline
\end{varblock}
\end{column}
\end{columns}
\end{frame}
\section{Functions}
\subsection{Intro to functions}
\begin{frame}
\frametitle{Intro to functions}
\begin{itemize}
\item Function description (done in the header (.h) file)
\item Function implementation (done in the c++ (.cpp) file)
\item Calling the function 
\end{itemize}
\end{frame}
\subsection{header file (.h-file)}
\begin{frame}

\frametitle{header file (.h-file)}
\begin{varblock}[6.7cm]{Source Code}
\setbeamercolor{alerted text}{fg=blue}
\setbeamerfont{alerted text}{series=\bfseries,family=\ttfamily}
\begin{semiverbatim} \small
\alert&lt;3&gt; {double} \alert&lt;1&gt;{mean}(\alert&lt;2&gt; {double a}, \alert&lt;2&gt;{ double b});
\end{semiverbatim} 
\end{varblock}
\end{frame}
\subsection{body file (.cpp-file)}
\begin{frame}

\frametitle{body file (.cpp-file)}
\begin{varblock}[6.7cm]{Source Code}
\setbeamercolor{alerted text}{fg=blue}
\setbeamerfont{alerted text}{series=\bfseries,family=\ttfamily}
\begin{semiverbatim} \small
\alert&lt;5&gt; {double} mean(double \alert&lt;2&gt; {a},  double \alert&lt;2&gt; {b})
\alert&lt;1&gt;{\{}
\hspace*{2em}\newline \alert&lt;3&gt; {double value=(\alert&lt;2&gt; {a}+\alert&lt;2&gt; {b})};
\hspace*{2em}\newline \alert&lt;4&gt; {return value};
\alert&lt;1&gt;{\}}
\end{semiverbatim} 
\end{varblock}
\end{frame}
\subsection{Using the function}
\begin{frame}

\frametitle{Using the function}
\begin{varblock}[6.7cm]{Source Code}
\setbeamercolor{alerted text}{fg=blue}
\setbeamerfont{alerted text}{series=\bfseries,family=\ttfamily}
\begin{semiverbatim} \small
\#include &lt;iostream&gt;\newline
\alert&lt;1&gt;{"function1.h"}\newline
using namespace std;\newline
int main()\newline
\{\newline
{\alert&lt;4&gt;{double result }=\alert&lt;2&gt;{mean}(\alert&lt;3&gt;2,\alert&lt;3&gt;2);}\newline

\}
\end{semiverbatim} 
\end{varblock}
\end{frame}
\end{document}</pre></body></html>