Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Tutorial Week 4 (02/01/12)
- --what does #include do?
- --to access the files included, like the codes inside them.
- --copy and paste files included into ur files
- --difference b/t <...> and "..."
- --<...> extended libraries, can be found in linux.
- --"..." look through the current directory.
- --why to include headers?
- --similar to "provide" in scheme.
- --Assignment 3
- --g++ -c my-func.cpp
- --.c allows you to compile
- --.o not ready to be compile yet
- --g++ main.cpp my-func.o -o solution
- --
- --multiple functions with the same names?
- --
- --#include <cassert> (in c++)----in c, "assert.h"
- #include <cstdlib> (in c++) ----in c, "stdlib.h"
- why to use assert? --
- --input -- cin
- -- cout << i << "Hello"; ok to do that;
- --cin >> i >> n; <=> cin >> i; cin >> n;
- --each cin will not include whitespace, but will at a whitespace;
- --strings
- --in c++, a string is an object;
- in c, A character array terminated with a null character '\0';
- --std::string?
- --int a;
- int main () {
- int a;
- ::a = 7; //:: assign 7 to the global a;
- }
- --int a;
- int main () {
- struct b {
- ...
- int a; };
- b::a=7; //assign 7 to the a inside b;
- }
- --use :: operator in header files;
- --use 'using namespace std' only in main.cpp files, not headers
- --in general, use std:: when not using namespace;
- --command line arguments:
- --int main (int argv, char* argc[])
- --argv: number of arguments, including command name
- --argc: array of pointers to character strings(C strings)
- --How to create the previous program
- --instead of using cin for input, use command line arguments
- string s; // s = hi
- s = argc[0];
- string s(argc[0])
Add Comment
Please, Sign In to add comment