Path: C++ : C++ programming :

Programming

How to author computer programs using the C++ programming language...

reference book: The C++ Programming Language 2nd edition by Bjarne Stroustrup
reference book: UNIX Network Programming: Stevens, W. Richard
reference book: Multithreaded Programming With Pthreads: Bil Lewis, Daniel J. Berg
reference site: Microsoft Win32/Win64 C API

Bajarne Stroustrup is the inventor of the C++ prgramming language.

This page lists the things you should know to program C++ on UNIX and Windows operating systems. If you wish to learn the C++ programming language and alreay know how ot porgram read Bjarne Stroustrup's book "The C++ Programming Language 2nd edition" and know all the terms listed. You should go to a university to learn computer science using standardized C++.

Learn how to begin programming in C++ for developing software for the modern world. This site shows how to program in C++ for client / server and application development for windows and BSD/Linux.

You should know a shell scripting language, an interpreted programming langauge and a pointer language. /bin/sh, perl and STL C++ are the three for me. /bin/sh is a shell scripting language. Perl is a practicle extraction and report language. C++ is hybrid function and object oriented pointer language. Other langugaes exist and are used to be succinct in programming make finding the solution quicker. Most of the languages exist becuase of C/C++.

C++98, C++11 and C++15 are standardized programming language; and it is not a designer programming laguage that changes over night.

Your C++ compiler choice is important:
  1. C++ Filter
  2. Borland C++ Builder
  3. Microsoft Visual C++
  4. MinGW C++
  5. EGCS C++
  6. CYGWIN C++

C++ APIs used to program:
  1. IOStreams
  2. APIs From Me
  3. STL (STLport)
  4. Berkely Sockets API
  5. Oracle Berkely DB API
  6. MySQL C API
  7. POSIX Threads API
  8. Win32/Win64 C API
  9. Boost C++ API
  10. OpenGL API

  C++ - Extended BNF grammar file for the C++ programming language

C++ in outline form:
  1. Compiler Explained
    1. Theory of Computation
    2. Finite Automa
    3. Computer Programma
    4. Macro C Pre-Processor
    5. C++ Compiler
    6. Assembly Language
    7. Object Code
    8. The Linker
      1. Shared Object File
      2. Executable
      3. Static Library
  2. Compiler Choice
  3. Operating System Choice
  4. How to Begin a Simple Program
  5. Main Entry Point
  6. Functions
  7. Statement
  8. Expression Syntax
  9. Variables
    1. Local Variables
    2. Global Variables
    3. Stack Variables
    4. Dynamic Variables
    5. Class Variables
    6. Primative Data Types
    7. Integer
    8. Floating Point
    9. Character
    10. Strings
    11. Array
    12. Pointers
    13. Class Variable
    14. new and delete
    15. auto_ptr
    16. casting or type conversion
    17. Pointer Functions
    18. References
  10. Enumerated Types
  11. Sequence
    1. Statement
    2. Compund Statement
  12. Selection
    1. if statement
    2. switch statement
    3. ?: operator
  13. Repitition
    1. while loop
    2. do while loop
    3. for loop
  14. Math
  15. Input and Output
    1. IOStreams Class Library
      1. Text File I/O
      2. Binary File I/O
      3. Terminal Output
      4. Keyboard Input
    2. Functions
    3. Operators
    4. Keywords
    5. Identifiers
    6. Struct
    7. Union
    8. Typedef
    9. Namespaces
    10. Classes
      1. inharatence
      2. encapsulation
      3. information hiding
      4. constructor
      5. deconstructor
      6. member operator
      7. member function
      8. data member
      9. templates class
      10. templates member function
      11. templates function
      12. default templates parameters
      13. virtual member function
      14. pure virtual member function
      15. run time type information
      16. exception handling
      17. strong data type
      18. abstract base class
      19. friend statement
      20. inline wrapper class
      21. coupling
      22. cohesion
      23. base classes
      24. derived classes
  16. extern
  17. static
  18. volatile
  19. explicit
  20. mutable
  21. register
  22. inline
  23. extern "C"
  24. default function parameter values
  25. overloaded functions
  26. overloaded operators
  27. template functions
  28. template operators
  29. STL
  30. IOStreams
  31. iostream
  32. fstream
  33. iomanip
  34. sstream
  35. list
  36. vector
  37. map
  38. mmap
  39. hashmap
  40. string
  41. stack
  42. valarray
  43. algorithm
  44. auto_ptr
  45. typeinfo
  46. Standard C APIs
    1. cstdlib
    2. cstdio
    3. cstring
    4. cctype
    5. cmath
    6. ctime
    7. climits
  47. Windows C APIs
    1. windows.h
    2. winsock2.h
  48. UNIX C APIs
    1. unistd.h
    2. signal.h
    3. sys/wait.h
    4. sys/types.h
    5. System V Inter-Process Communcation
    6. Daemon Processes
    7. POSIX Threads
    8. Berkely Sockets
      1. tcp_stream.h
      2. tcp_server.h
    9. Building Programs
    10. Testing Programs
    11. Optimizing Programs
    12. Bad Programming to Avoid
      1. return from the middle of a function
      2. goto
      3. one letter variable names
      4. repeating code should be an abstraction
      5. don't put all the code in one file
      6. don't make a function monalitic
      7. procedures should be named a verbs
      8. functions should be named a nouns
    13. Abstractions
    14. Polymorphism
    15. Recurshion
    16. Recipies
    17. Metaphors
    18. Functionoid
    19. Command Line User Interface
    20. Menu User Interface
    21. Command Shell User Interface
    22. ommon Gateway Interface (CGI) Programming
    23. Sockets Programming
    24. Mult-Threaded Programming
    25. IOStreams
      1. cout
      2. cin
      3. cerr
      4. fstream
      5. ios::in
      6. ios::out
      7. ios::ate
      8. ios::trunc
      9. ios::app
      10. ios::binary
      11. fstream::opean()
      12. fstream::seekg()
      13. fstream::tellg()
      14. fstream::get()
      15. fstream::getline()
      16. fstream::write()
      17. fstream::read()
      18. fstream::flush()
      19. fstream::clearerr()
      20. fstream::operator void*()
      21. fstream::operator <<()
      22. fstream::operator >>())
      23. endl
      24. flush
      25. fstream::open()
      26. fstream::close()
  49. STL - standard template library
    1. list< T > - linked list STL data structure template
    2. vector< T > - array STL data structure template
    3. stack< T > - stack STL data structure template
    4. map< Key , Data > - assiciative array STL data structure
    5. string - string STL data structure template
    6. stringstream - string stream STL data structure template
    7. sort() - quick sort STL function template
    8. binary_search() - binary search STL function template
    9. find() - linear search given a value STL function template
    10. find_if() - linear search given a function STL function template
  50. win32/win64 C API programming (understanding windows applications)
    1. WinMain()
    2. Create Window(s)
    3. Call Back Function (WinProc and DefWindowProc)
    4. Event Driven System
    5. The Message Loop
    6. MessageBox()
    7. Windows Events in C API
      1. WM_CHAR
      2. WM_SIZE
      3. WM_CREATE
      4. WM_DESTORY
      5. WM_PAINT
      6. WM_COMMAND
      7. WM_KEYDOWN
      8. WM_KEYUP
      9. DefWindowProc()
  51. How to make the File Menu
  52. How to compile a C++ program:
    1. #include <iostream>

      using namespace std;

      int
      main(int argc, char** argv)
      {
         cout << "Hello, world!" << endl;
         return 0;
      }
    2. On windows:
      c:\myproject> cl /O2 /EHsc /Femy_program.exe my_program.cpp mylib.cpp ws2_32.lib
      c:\myproject> my_program.exe
    3. On BSD and Linux (Application):
      $ c++ -static -O2 my_program.cpp mylib.cpp -o my_program
      $ strip ./my_program
      $ ./my_program
    4. On BSD and Linux (shared object file):
      $ c++ -shared -O2 mydll.cpp -o libmydll.so
      $ export "LD_LIBRARY_PATH=${LD_LIBRARY_PATH};."
      $ strip ./libmydll.so
      $ c++ -O2 mydll_use.cpp -o mydll_use -l mydll -L .
      $ strip ./mydll_use
      $ ./mydll_use
    1. How to build a windows application
    2. c:\myproject> cl /O2 /EHsc /Femyprogram.exe my_winprogram.cpp mylib.cpp use32.lib kernel32.lib gdi32.lib ws2_32.lib /link /SUBSYSTEM:WINDOWS
      c:\myproject> mywinprogram.exe
  53. Winsock2 Sockets API
  54. A listing of the win32/win64 C API functions
    1. CreateThread()
    2. CreateMutex()
    3. MutexLock()
    4. MutexUnlock()
    5. CreateProcess()
    6. CreatePipe()
    7. GetModuleFileName()
    8. LoadLibray()
    9. GetProcAddress()
    10. FreeLibrary()
    11. CloseHandle()
    12. WaitForSingleObject()
    13. ReadFile()
    14. WriteFile()
    15. ReadConsole()
    16. WriteConsole()
    17. AttachConsole()
    18. OpenFile()
    19. CreateWindow()
    20. DestroyWindow()
    21. ResizeWindow()
    22. SendMessage()
    23. MoveWindow()
    24. ShowWindow()
    25. SetFocus()
    26. MoveTo()
    27. LineTo()
    28. FillRect()
    29. BitBlit()
  55. matt_win.h - C++ inline wrapper classes for the win32/win64 C API
    1. Application
    2. Window
    3. Fram
    4. Panel
    5. Layout
    6. FlowLayout
    7. GridLayout
    8. CustomLayout
    9. ImageButton
    10. Button
    11. Image
    12. Label
    13. Canvas
    14. TabCtrl
    15. ScrollBar
    16. Slider
    17. Text
    18. ComboBox
    19. ListBox
    20. TreeCtrl
    21. ProgressBar
    22. StatusBar
    23. ButtonBar
    24. MenuBar
    25. Menu
    26. MenuItem
    27. IPAddress
  56. BSD/Linux/Windows C API Calls (syscalls and libc calls)
    1. fork() - UNIX
    2. alarm() - UNIX
    3. waitpid() - UNIX
    4. signal() - UNIX
    5. kill() - UNIX
    6. open()
    7. stat()
    8. read()
    9. write()
    10. close()
    11. flock()
    12. printf()
    13. puts()
    14. fopen()
    15. fclose()
    16. feof()
    17. srand()
    18. rand()
    19. dlopen()
    20. dlsym()
    21. dlclose()
    22. tempnam()
    23. fprintf()
    24. sprintf()
    25. sscanf()
    26. scanf()
    27. fscanf()
    28. getchar()
    29. fgetc()
    30. fputc()
    31. puts()
    32. fgets()
    33. getch()
    34. strlen()
    35. strcpy()
    36. strncpy()
    37. strcmp()
    38. strtok()
    39. strchr()
    40. strrchr()
    41. strstr()
    42. strrstr()
    43. strcasecmp() -- unix
    44. _stricmp() -- windows msvcrt.dll
    45. strncmp()
    46. strdup()
    47. memset()
    48. atoi()
    49. atof()
    50. atol()
    51. atod()
    52. socket() - Berkeley Sockets API
    53. listen()
    54. bind()
    55. accept()
    56. connect()
    57. recv()
    58. send()
    59. recvfrom()
    60. sendto()
    61. select()
    62. gethostbyname()
    63. gethostbyaddr()
    64. poll()
    65. setsocketopt()
    66. pipe()
    67. dup2()
    68. exec()
    69. getpid()
    70. getcwd()
    71. mkdir()
    72. rmdir()
    73. unlink()
    74. ftruncate()
    75. chdir()
    76. exit()
    77. mmap()
    78. system()
    79. popen()
    80. pclose()
    81. wait()
    82. malloc()
    83. free()
    84. time()
    85. strftime()
    86. daemon()
    87. pthread_create() - POSIX threads library
    88. pthread_destroy()
    89. pthread_yield()
    90. pthread_self()
    91. pthread_mutex_init()
    92. pthread_mutex_lock()
    93. pthread_mutex_unlock()
    94. pthread_mutex_destory()
    95. pthread_cond_init()
    96. pthread_cond_destroy()
    97. pthread_cond_wait()
    98. pthread_cond_signal()
    99. pthread_cond_broadcast()
  57. Object Oriented Database (BSD/Linux/Windows)
    1. sql_tools
    2. db_tools
    3. disk_tools
  58. Debugging Programs
    1. Compiling with Debugging Symbol
    2. Using the Debugger
    3. Print Statements
    4. Abort Function
    5. SIGKILL
    6. The "core" Dump File
    7. How to use gdb GNU debugger
      $ c++ -g myprogram.cpp -o myprogram
      $ gdb ./myprogram
      (gdb) run
      ... crash ...
      (gdb) where
      line 35 at strcpy()
      (gdb) quit
      $ vi +35 myprogram.cpp
  59. Levels of Abstraction
  60. Abstraction without Expens
  61. Cohesio
  62. Coupling
  63. Web Server Extention
  64. NT Service
  65. CGId
  66. CGI programming


programming recipies in outline form:
  1. counter
  2. accumulator
  3. sort
    1. quick sort algorithm
    2. bubble sort
    3. insertion sort
  4. linked list
  5. stack
  6. queue (priority queue)
  7. hash table (big O of 1)
  8. balanced search tree
    1. AVL
    2. red black
    3. splay tree
    4. general tree
    5. btree
  9. disk hashtable
  10. hash function
  11. mod
  12. the four counting problems
    1. order matters and replacement does not (multiply each choice)
    2. order matters with replacement (like factorially each chocce)
    3. order does not matter with without replacement (nCr)
    4. order does not matter with replacement (stars and bars)
  13. factorial
  14. prime numbers
  15. big O (number of comparisons used in an algorithm)
  16. disk list
  17. inline wrapper class
  18. reuse
  19. address of operator
  20. pointer
  21. while
  22. for
  23. do while
  24. if, else if, else
  25. switch statement
  26. array (multi-dimentional array)
  27. index variable
  28. linear search
  29. binary search
  30. linear algebra (matrix)
    1. 3d computer graphics
  31. calculous
  32. algebra
  33. probability and statistics
  34. boolean algebra
  35. descret math
  36. set math and logic
  37. trigonometry
  38. vectors
    1. vector sapce
    2. vector set
    3. rank
  39. parser (recrsive decent and parse matrix)
    1. interpreter
    2. compiler
    3. dynamic compiler (java hot spot)
  40. finite automa (program in structured programming language statements)
  41. computer programma (assembly language or interpreter codes)
  42. thery of computation (compiler)
    1. intermediate code
    2. peephole optimizer
  43. assembly language
  44. goto logic (goto hell)
  45. integer math
  46. floating point math
  47. bitwize operations
    1. left bit shift one is divide by two (quick)
  48. line bresenham
  49. line DDA (data drawing algorithm)
  50. buffer math (buffer overflow)
  51. string class
  52. sequence, selection, repetition
  53. operating systems
    1. single task (preemptive)
    2. mutli-task (preemptive)
  54. mercator map algorithm
  55. dakart sortest path algorithm
  56. dakart minimum spaning tree
  57. apha-beta pruning
  58. the eval() function
  59. the machineeval() function (dynamic machine code eval() function)
  60. scalar variable (number and string at once)
  61. strong data type (every operator overloaded for a class)
  62. parametrized data type (C++ template)
  63. operator overloading
  64. object oriented programming
    1. the class statement (first in simula 60)
    2. the method
      1. design by contract
    3. is-a, has-a, uses-a
  65. function oriented programming
    1. procedure
    2. function
    3. record
  66. dealership locator math (zip codes)
  67. POSIX threads API
  68. Berkeley sockets API
  69. Win32 C API
  70. linear programming (make all expressions add and multiply)
  71. a solve() function (linked lists)
  72. reverse the operators for N-th term
  73. imaginary numbers
  74. least squares for error reduction
  75. sinusoidal waves for sound
  76. fast furious transfer
  77. circumvent system to find answer
  78. use the compiler to answer a question
  79. flat file (CSV comma seperated values)
  80. binary file raw memory in a file
  81. object input output
    1. martial an object
  82. input output
  83. report to the screen
  84. regular expressions
  85. perl (practical extraction and report language)
  86. polymorpihic (qsort() a pointer function passed in)
  87. reference
  88. pass by value
  89. struct return
  90. struct
    1. aggregate data type
  91. stack memory
  92. dynamic memory
  93. virtual memory
  94. memory mapped files
  95. indirect goto (jmp edx, ret)
  96. c call interface
  97. recursion (repeat through function calling)
  98. local stack pointer
  99. buffer overrun
  100. cheat at writing a lot of code with advanced language features
  101. macro (expand)
  102. phreaking (DTMF, 2600 Hz)
  103. stack calculator
  104. relational database
    1. no real addresses (go throuh a data structure to get addresses)
    2. compactify and shrink file
    3. programmatic database (Berkeley DB)
    4. SQL database (oracle)
  105. worms (CodeRed)
  106. viruses (iloveyou)
  107. natural language parser
  108. natural language query
  109. artificial intelligence
    1. srai (stimulus response aritficial intelligence (ALICE BOT))
    2. question answer A.I. print(eval(rephrease(english_parse(read_question()))))
    3. neural net
  110. strict type checking
  111. lint C program checker
  112. array of int for indexes into another array
    1. sort() an array a different way without changing the array
  113. metaphor
  114. fuzzy logic (a maybe comparison in a program)
    1. spell check the soundex() function
  115. local reference to avoid repeated expressions
  116. do not divide by zero
  117. do not mod by zero
  118. do not have a return from the center of a block
  119. do not have repeated expressions
  120. do not have a single letter variable
  121. do not have junk pointer
  122. do not use a null pointer
  123. sort the finite automata
  124. peep hole optimizer (if "RTRIM" == opcode and next == "ASSIGN" then add_code "CHOMP" end)