Lecture 2
int main()

Good programming practice:

- takes no argument

- return an integer

Efficiency
C++ more about efficnecy than safety, opposite of Java.
Index Card

#include <iostream>
#include "console.h";  //custom Stanford library
using namespace std;  //should come after everything else

int main() {

  cout<< "Hello, world." << endl;
  return 0;

}

cout<

- pushes into console (daisy chain)

Note
Read handout 6
References
Pass large data strucutres into functions via reference (putting &), but otherwise rarely pass simple ints, strings, etc. via reference
Globals and exceptions

Never use globals!

Make sure you thought out exceptions

Note
Description
Note
Description
   Login to remove ads X
Feedback | How-To