adding pieces
This commit is contained in:
parent
2f97bfa836
commit
96e3cbf8b1
36
cs161AReview/intro.org
Normal file
36
cs161AReview/intro.org
Normal file
@ -0,0 +1,36 @@
|
||||
* Introduction
|
||||
** A general overview of c++
|
||||
*** What is a programming language
|
||||
At its heart, a programming language is a way to specify computation[fn:1] in a very concrete, unambiguous, way that can be processed and execute by a computer.
|
||||
|
||||
Programming languages are ways of
|
||||
*** Why c++
|
||||
*** When don't c++
|
||||
* Rules of the language
|
||||
** General syntax
|
||||
So c++ has a few general rules we can discuss:
|
||||
|
||||
First off, most lines of code in c++ are /statements/. Statements are like the complete sentences of the programming world. They're read from the top of the file on down to the bottom of the file. Almost all statements are going to end in a =;=. The historical reason for this is that it makes it easier for the computer to under
|
||||
|
||||
The two kinds of lines of code that don't end in
|
||||
|
||||
For example, here's our "hello world" program and we'll break it down a little bit
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
cout << "hello world" << endl;
|
||||
return 0;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
* Footnotes
|
||||
|
||||
[fn:1] I'm pushing aside the question of "what is computation" for the moment but if you're curious about what it is here's my rough definition:
|
||||
A computation is set of instructions to carry out an operation such that:
|
||||
+ The set of instructions is finite (that is, you can count how many of them there are and write them down)
|
||||
+ Each instruction only uses a finite amount of resources to operate
|
||||
+ The instructions only take a finite amount of time to do their work
|
Loading…
Reference in New Issue
Block a user