| @ -1,12 +1,12 @@ | |||
| This resource is intended for everyone. | |||
| \newline | |||
| \\ | |||
| \par | |||
| This resource is meant to be useful to programmers of all levels, those who have never programmed before, those who are just | |||
| getting started and even those who have been programming for years. | |||
| Since this resource will always be growing and changing as the industry changes the information should always be in some | |||
| way applicable for all developers. | |||
| \newline | |||
| \\ | |||
| \par | |||
| Those who are familiar with programming are most likely going to be able to skip the chapter "Getting Started" and in | |||
| some cases might not read the resource in sequential order, but rather skip around picking and choosing which sections are | |||
| applicable to them. | |||
| @ -1,7 +1,7 @@ | |||
| All code examples in this resource use a sudo language that is not meant to be run or compiled directly. | |||
| I have chosen to use this approach so that the concepts can be extracted and implemented in any language | |||
| on any platform. | |||
| \newline | |||
| \\ | |||
| \par | |||
| I will cover how to use the sudo language and how to translate it to a useable programming language | |||
| in the chapter "Getting Started" and section "Sudo Language". | |||
| @ -1,16 +1,14 @@ | |||
| Programming In General is meant to be used as a resource to learn the concepts of computer programming that can be applied to any | |||
| language or platform. | |||
| \newline | |||
| \\ | |||
| \par | |||
| This resource is and always will be provided for free. | |||
| \newline | |||
| \\ | |||
| \par | |||
| This resource is currently a work in progress so please bear with me if any particular sections or chapters are in complete or | |||
| if sections contain less than correct information. | |||
| If you have any comments, questions, suggestions or corrections please feel free to contact me by e-mail at: | |||
| \newline | |||
| brett@blangdon.com | |||
| \newline | |||
| If you have any comments, questions, suggestions or corrections please feel free to contact me by e-mail at: \emph{brett@blangdon.com} | |||
| \\ | |||
| \par | |||
| Thank you and enjoy. | |||
| \pagebreak | |||
| @ -1,12 +1,10 @@ | |||
| This resource is going to be laid out a little weird, more so for those who have already had some programming background. | |||
| \newline | |||
| \\ | |||
| \par | |||
| For those who are new to programming I strongly suggest reading through Chapters 3 and 4 thoroughly before continuing with the | |||
| rest of the resource. Those two chapters contain all of the core concepts needed in order to understand some of the higher level | |||
| concepts presented with Data Structures and Algorithms. | |||
| \newline | |||
| \\ | |||
| \par | |||
| Once you have completed chapters 3 and 4 please feel free to jump around a little between sections presented in chapters 5 and 6 as | |||
| some data structures or algorithms might interest you more than others. | |||
| @ -1,3 +1,2 @@ | |||
| This chapter will cover how to get started with programming, how to choose which language or platform to start with and how to go about | |||
| using this resource. | |||
| \pagebreak | |||
| @ -1,53 +1,30 @@ | |||
| For starters we are going to cover some basic usage of variables. Variables are used to store values to be read and manipulated. | |||
| For example we can create a variable named "name" and store the value of the string "Brett" in it. | |||
| \begin{lstlisting} | |||
| name = "Brett" | |||
| \end{lstlisting} | |||
| Fairly simple to start with. | |||
| \newline | |||
| \\ | |||
| So here we are storing a string into a variable but what about other types of data? Each programming language supports different data types | |||
| but for the most part they all support numbers, usaully various types, strings as well as booleans (true or false).So, we can store these | |||
| different data types in variables as well. | |||
| Variables are used to represent values by name and allow you to access the original value or manipulate the original value. | |||
| For example we would store the integer value 10 into a variable named "a" which would then allow us to refer to "10" by | |||
| using the name "a". | |||
| \begin{lstlisting} | |||
| name = "Brett" | |||
| number = 10 | |||
| boolean = false | |||
| a = 10 | |||
| print a | |||
| \end{lstlisting} | |||
| Great, we can store values into a variable to use, but what do you mean use them? Well we can either use the variable names to access | |||
| the values that we stored in them or we can manipulate the values stored in variables. | |||
| In the above example the output would be "10" because the value 10 is stored in the variable "a" and then we access the original value | |||
| 10 when we print a. | |||
| \begin{lstlisting} | |||
| name = "Brett" | |||
| print name | |||
| \end{lstlisting} | |||
| \subsection{Data Types} | |||
| Here we are storing the string "Brett" into the variable "name" and then printing the value stored in name. Here we are showing that | |||
| we can access the original string value "Brett" from the variable "name". | |||
| Programming languages support different types of data types or different types of values that they can represent in variables. | |||
| Some programming languages use multiple different types of values but most of them support the basic types: string, integer | |||
| and boolean (true or false). | |||
| \begin{lstlisting} | |||
| a = 10 | |||
| b = 5 | |||
| c = a + b | |||
| print c | |||
| string = "Brett" | |||
| integer = 10 | |||
| boolean = false | |||
| \end{lstlisting} | |||
| Ok, so here we are taking the number, or integer, value 10 and storing it into the variable "a", and the integer value 5 and storing it into | |||
| the variable "b". Then we are using the mathematical opperator for addition (+) to store the addition of the values stored by | |||
| "a" and "b" into the variable "c". Lastly, we are printing the value of "c" which if all works as we would like would print "15". | |||
| \newline | |||
| This is another example of showing how we can access the values stored within variables and act upon them. In this case we are accessing | |||
| the values 10, stored in "a", and 5, stored in "b", and performing mathematical opperations on them. | |||
| Please keep in mind that each programming language supports different data types and you should research those types to better | |||
| understand variables in that language. | |||
| \begin{lstlisting} | |||
| a = 10 | |||
| a = a + 5 | |||
| print a | |||
| \end{lstlisting} | |||
| \subsection{Operations} | |||
| In this example we are storing the integer value 10 into the variable "a" and then we are manipulating the value of a in such a way that we | |||
| are adding the integer value 5 to it. Lastly, we are printing the final value of "a", which will be "15". | |||
| \subsection{Conclusion} | |||
| @ -1,13 +1,93 @@ | |||
| \documentclass[10pt,a4paper,titlepage]{book} | |||
| \usepackage[width=7in, height=9.5in,papersize={8.5in,11in}]{geometry} | |||
| \usepackage[utf8]{inputenc} | |||
| \usepackage{amsmath} | |||
| \usepackage{amsfonts} | |||
| \usepackage{amssymb} | |||
| \usepackage{moreverb} | |||
| \usepackage{listings} | |||
| \usepackage{layout} | |||
| \usepackage{fancyhdr} | |||
| \usepackage{color} | |||
| \author{Brett Langdon} | |||
| \title{Programming In General} | |||
| \lstset{language=php,numbers=left,stepnumber=1} | |||
| \pagestyle{fancy} | |||
| \voffset=0.25in | |||
| \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} | |||
| \definecolor{lstkeyword}{rgb}{.2,.2,.7} | |||
| \definecolor{lstcomment}{rgb}{.7,.7,.7} | |||
| \definecolor{lstidentifier}{rgb}{0,0,0} | |||
| \definecolor{lststring}{rgb}{.4,.4,.4} | |||
| \lstset{ | |||
| numbers=left, | |||
| stepnumber=1, | |||
| numberstyle=\footnotesize, | |||
| frame=single, | |||
| showspaces=false, | |||
| showstringspaces=false, | |||
| basicstyle=\ttfamily, | |||
| linewidth=6.5in, | |||
| xleftmargin=0.5in, | |||
| keywordstyle=\bfseries\color{lstkeyword}, | |||
| commentstyle=\itshape\color{lstcomment}, | |||
| identifierstyle=\color{lstidentifier}, | |||
| stringstyle=\color{lststring}, | |||
| morekeywords={class,public,private,protected,$this,return,this,self,if,else,function,print}, | |||
| morestring=[b]', | |||
| morestring=[b]", | |||
| morecomment=[s]{/*}{*/}, | |||
| comment=[l]{//} | |||
| } | |||
| \lstdefinelanguage{javascript}{ | |||
| keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break}, | |||
| ndkeywords={class, export, boolean, throw, implements, import, this}, | |||
| sensitive=false, | |||
| comment=[l]{//}, | |||
| morecomment=[s]{/*}{*/}, | |||
| morestring=[b]', | |||
| morestring=[b]" | |||
| } | |||
| \lstdefinelanguage{php}{ | |||
| keywords={$this,class,public,private,protected,return,new,null,catch,try,switch,if,else,while,do,case,break,continue,true,false,function,boolean,throw,implements,inhrits,echo,print} | |||
| sensitive=false, | |||
| comment=[l]{//}, | |||
| morecomment=[s]{/*}{*/}, | |||
| morestring=[b]', | |||
| morestring=[b]" | |||
| } | |||
| \begin{document} | |||
| \maketitle | |||
| \begin{titlepage} | |||
| \begin{center} | |||
| \vspace*{3 in} | |||
| \HRule \\[0.4cm] | |||
| {\huge \bfseries Programming In General} | |||
| \HRule \\[0.4cm] | |||
| \emph{Author:}\\ | |||
| Brett \textsc{Langdon} | |||
| \vfill | |||
| {\large \today} | |||
| \end{center} | |||
| \end{titlepage} | |||
| \tableofcontents | |||