
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  CSCE 150A -- Problem Solving Using Computers
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[pdftex]{beamer}

\input{beamerPreamble}
\usepackage[T1]{fontenc}
%\usepackage{tikz}\text
%\usetikzlibrary{shapes.callout}

\title[CSCE150A]{Computer Science \& Engineering 150A\\
    Problem Solving Using Computers -- Laboratory}
\subtitle{Lecture 11 - Functions}

\author[~]{Shuai Xie\vskip 1\baselineskip (Adapted from Derrick Stolee, Lin Liu \& Shuai Xie )} %

\date{Spring 2010}
%\usepackage{listings}
\usepackage{multicol}
\begin{document}
%\lstset{language=C}
\begin{frame}
  \titlepage
  \begin{center}
     \vfill
     \email{sxie@cse.unl.edu}
  \end{center}
\end{frame}

\section{Assignment}

\begin{frame} %-----------------------------------------------------------|
  \frametitle{Announcement: CodeLab assignment}
  \framesubtitle{~}

\begin{itemize}
	\item The 6th CodeLab assignment\\
	\vskip 1\baselineskip
	 \qquad "CodeLab Assignment-6"\\
	 \qquad Due:  23:59 Apr 13\\
	      \vskip 1\baselineskip
\end{itemize}

\end{frame} %-------------------------------------------------------------|



\section{Debugging}

\begin{frame} %-----------------------------------------------------------|
  \frametitle{\texttt{Code::Blocks}}
  \framesubtitle{~}

\vspace{1em}

\textbf{Code::Blocks instruction}

\begin{itemize}
  \item Create a new project
     \begin{itemize}
     \item New project
     \item Console Application --> Go
     \item Select "c" not "c++"
     \item Project title and saving folder.
     \item GNU GCC Compiler
     \end{itemize}
  \item Copy your desired source code into main.c
\end{itemize}

\end{frame} %-------------------------------------------------------------|

\begin{frame} %-----------------------------------------------------------|
  \frametitle{\texttt{Code::Blocks}}
  \framesubtitle{~}

\vspace{1em}

\textbf{Code::Blocks instruction}

\begin{itemize}

  \item Save: \quad Ctrl + S
  \item Build: \quad Ctrl + F9
  \item Build and run: \quad F9

  \item Run to Cursor \quad F4
  \item Toggle breakpoint: \quad F5
  \item Next line: \quad F7
  \item Step into: \quad Ctrl + F7
  \item Step out: \quad Shift + Ctrl + F7
  \item Open "Watches Window" to view value of variables.
\end{itemize}

\end{frame} %-------------------------------------------------------------|




\section{Function}

\begin{frame} %-----------------------------------------------------------|
  \frametitle{Function}
  \framesubtitle{~}

\#include $<$stdio.h$>$\\
\vskip 1\baselineskip
\small
\texttt{void CountSum(int x, int y);} $\setminus$$\setminus$Prototype \\
\vskip 1\baselineskip
\texttt{int main(void)}\\
$\{$\\
\texttt{int a=9,b=6;}\\
\texttt{CountSum(a,b);} $\setminus$$\setminus$Call the function \\
\texttt{return 0;}\\
$\}$\\
\vskip 1\baselineskip
\texttt{void CountSum(int x, int y)} $\setminus$$\setminus$Definition \\
$\{$\\
   \texttt{int sum;}\\
   \texttt{sum = x + y;}\\
   \texttt{printf("The sum is $\%d$",sum);}\\
$\}$\\

 \normalsize
\vspace{2in}
\end{frame} %-----------------------------------------------------------|



\begin{frame} %-----------------------------------------------------------|
  \frametitle{Function with Output Parameters}
  \framesubtitle{~}

\#include $<$stdio.h$>$\\
\vskip 1\baselineskip
\small
\texttt{void CountSum(int x, int y, int $*$zp);} $\setminus$$\setminus$Prototype \\
\vskip 1\baselineskip
\texttt{int main(void)}\\
$\{$\\
\texttt{int a=9,b=6,c;}\\
\texttt{CountSum(a,b,\&c);} $\setminus$$\setminus$Call the function \\
\texttt{printf("The sum is $\%d$",c);}\\
\texttt{return 0;}\\
$\}$\\
\vskip 1\baselineskip
\texttt{void CountSum(int x, int y, int $*$zp)} $\setminus$$\setminus$Definition \\
$\{$\\
   \texttt{$*$zp = x + y;}\\
$\}$\\

 \normalsize
\vspace{2in}
\end{frame} %-----------------------------------------------------------|





\end{document} 