<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-CA">
	<id>http://wiki.benargee.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Benargee</id>
	<title>Benargee's Wiki - User contributions [en-ca]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.benargee.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Benargee"/>
	<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Special:Contributions/Benargee"/>
	<updated>2026-05-02T15:23:55Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=397</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=397"/>
		<updated>2016-08-11T01:42:03Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Other */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
**Xamarin&lt;br /&gt;
**Cordova&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
*[https://notepad-plus-plus.org/ Notepad++]&lt;br /&gt;
*[https://atom.io/ Atom]&lt;br /&gt;
*[https://www.arduino.cc/en/Main/Software Arduino IDE]&lt;br /&gt;
*MySQL&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
*[https://www.blender.org/ Blender]&lt;br /&gt;
*[http://www.sketchup.com/ SketchUp]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
===Chat===&lt;br /&gt;
*[https://discordapp.com/ Discord]&lt;br /&gt;
*[https://www.teamspeak.com/ TeamSpeak]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY] (ssh)&lt;br /&gt;
*[http://www.tightvnc.com/ TightVNC]&lt;br /&gt;
*[http://www.cpuid.com/softwares/hwmonitor.html HWMonitor]&lt;br /&gt;
*[https://www.wireshark.org/ Wireshark]&lt;br /&gt;
*Virtualbox vm&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=396</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=396"/>
		<updated>2016-08-11T01:15:10Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Dev */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
**Xamarin&lt;br /&gt;
**Cordova&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
*[https://notepad-plus-plus.org/ Notepad++]&lt;br /&gt;
*[https://atom.io/ Atom]&lt;br /&gt;
*[https://www.arduino.cc/en/Main/Software Arduino IDE]&lt;br /&gt;
*MySQL&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
*[https://www.blender.org/ Blender]&lt;br /&gt;
*[http://www.sketchup.com/ SketchUp]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
===Chat===&lt;br /&gt;
*[https://discordapp.com/ Discord]&lt;br /&gt;
*[https://www.teamspeak.com/ TeamSpeak]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY] (ssh)&lt;br /&gt;
*[http://www.tightvnc.com/ TightVNC]&lt;br /&gt;
*[http://www.cpuid.com/softwares/hwmonitor.html HWMonitor]&lt;br /&gt;
*[https://www.wireshark.org/ Wireshark]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=395</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=395"/>
		<updated>2016-08-11T01:12:20Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Dev */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
**Xamarin&lt;br /&gt;
**Cordova&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
*[https://notepad-plus-plus.org/ Notepad++]&lt;br /&gt;
*[https://atom.io/ Atom]&lt;br /&gt;
*[https://www.arduino.cc/en/Main/Software Arduino IDE]&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
*[https://www.blender.org/ Blender]&lt;br /&gt;
*[http://www.sketchup.com/ SketchUp]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
===Chat===&lt;br /&gt;
*[https://discordapp.com/ Discord]&lt;br /&gt;
*[https://www.teamspeak.com/ TeamSpeak]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY] (ssh)&lt;br /&gt;
*[http://www.tightvnc.com/ TightVNC]&lt;br /&gt;
*[http://www.cpuid.com/softwares/hwmonitor.html HWMonitor]&lt;br /&gt;
*[https://www.wireshark.org/ Wireshark]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=394</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=394"/>
		<updated>2016-08-09T00:34:05Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Dev */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
*[https://notepad-plus-plus.org/ Notepad++]&lt;br /&gt;
*[https://atom.io/ Atom]&lt;br /&gt;
*[https://www.arduino.cc/en/Main/Software Arduino IDE]&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
*[https://www.blender.org/ Blender]&lt;br /&gt;
*[http://www.sketchup.com/ SketchUp]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
===Chat===&lt;br /&gt;
*[https://discordapp.com/ Discord]&lt;br /&gt;
*[https://www.teamspeak.com/ TeamSpeak]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY] (ssh)&lt;br /&gt;
*[http://www.tightvnc.com/ TightVNC]&lt;br /&gt;
*[http://www.cpuid.com/softwares/hwmonitor.html HWMonitor]&lt;br /&gt;
*[https://www.wireshark.org/ Wireshark]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=393</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=393"/>
		<updated>2016-08-09T00:23:33Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Other */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
*[https://notepad-plus-plus.org/ Notepad++]&lt;br /&gt;
*[https://atom.io/ Atom]&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
*[https://www.blender.org/ Blender]&lt;br /&gt;
*[http://www.sketchup.com/ SketchUp]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
===Chat===&lt;br /&gt;
*[https://discordapp.com/ Discord]&lt;br /&gt;
*[https://www.teamspeak.com/ TeamSpeak]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY] (ssh)&lt;br /&gt;
*[http://www.tightvnc.com/ TightVNC]&lt;br /&gt;
*[http://www.cpuid.com/softwares/hwmonitor.html HWMonitor]&lt;br /&gt;
*[https://www.wireshark.org/ Wireshark]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=392</id>
		<title>KSP - Mods</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=392"/>
		<updated>2016-04-24T16:11:09Z</updated>

		<summary type="html">&lt;p&gt;Benargee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Tools=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/index.php?/topic/90246-the-comprehensive-kerbal-archive-network-ckan-package-manager-v1161-13-mar-2016/ CKAN]&lt;br /&gt;
&lt;br /&gt;
{{ksp}}&lt;br /&gt;
=Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/18230 KerbalEngineer Redux] {{Ksppartlopt}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/113111 Kerbal Inventory System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92514 Kerbal Attachment System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/47863 Precise Node] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/86677 Stage Recovery] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/104758 Waypoint Manager] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/68089 kOS]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/83305 RemoteTech] {{Ksppartlopt}}&lt;br /&gt;
**[http://forum.kerbalspaceprogram.com/threads/108669 RemoteTech XF]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/80369 SCANsat]&lt;br /&gt;
----&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/40667 TAC Life Support]&lt;br /&gt;
=Not Installed=&lt;br /&gt;
(but interesting)&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92324 Chatterer]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/24786 Kerbal Alarm Clock]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/43901 Docking Port Alignment Indicator]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/96497 PlanetShine]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/20451 Ferram Aerospace Research]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/74195 Action Groups Extended]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/117471 RasterPropMonitor]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/50736  Automate Vertical Velocity and Altitude Control]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/50524 Enhanced Navball ]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/104694 Trajectories]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/index.php?/topic/103963-wip11-scatterer-atmospheric-scattering-v00241-02042016-11-compatible-faster-loading/ Scatterer]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Template:Ksppartlopt&amp;diff=391</id>
		<title>Template:Ksppartlopt</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Template:Ksppartlopt&amp;diff=391"/>
		<updated>2016-04-24T16:07:45Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Created page with &amp;quot;&amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;'''(Parts Optional)'''&amp;lt;/span&amp;gt;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;'''(Parts Optional)'''&amp;lt;/span&amp;gt;&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=390</id>
		<title>KSP - Mods</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=390"/>
		<updated>2016-04-05T03:39:00Z</updated>

		<summary type="html">&lt;p&gt;Benargee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ksp}}&lt;br /&gt;
=Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/18230 KerbalEngineer Redux] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/113111 Kerbal Inventory System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92514 Kerbal Attachment System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/47863 Precise Node] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/86677 Stage Recovery] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/104758 Waypoint Manager] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/68089 kOS]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/83305 RemoteTech]&lt;br /&gt;
**[http://forum.kerbalspaceprogram.com/threads/108669 RemoteTech XF]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/80369 SCANsat]&lt;br /&gt;
----&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/40667 TAC Life Support]&lt;br /&gt;
=Not Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92324 Chatterer]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/24786 Kerbal Alarm Clock]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/43901 Docking Port Alignment Indicator]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/96497 PlanetShine]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/20451 Ferram Aerospace Research]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/74195 Action Groups Extended]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/117471 RasterPropMonitor]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/50736  Automate Vertical Velocity and Altitude Control]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/50524 Enhanced Navball ]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/104694 Trajectories]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/index.php?/topic/103963-wip11-scatterer-atmospheric-scattering-v00241-02042016-11-compatible-faster-loading/ Scatterer]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=389</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=389"/>
		<updated>2016-02-21T16:46:58Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /*Chat*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
*[https://notepad-plus-plus.org/ Notepad++]&lt;br /&gt;
*[https://atom.io/ Atom]&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
*[https://www.blender.org/ Blender]&lt;br /&gt;
*[http://www.sketchup.com/ SketchUp]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
===Chat===&lt;br /&gt;
*[https://discordapp.com/ Discord]&lt;br /&gt;
*[https://www.teamspeak.com/ TeamSpeak]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY] (ssh)&lt;br /&gt;
*[http://www.tightvnc.com/ TightVNC]&lt;br /&gt;
*[http://www.cpuid.com/softwares/hwmonitor.html HWMonitor]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=388</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=388"/>
		<updated>2016-02-14T21:12:12Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Modelling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
*[https://notepad-plus-plus.org/ Notepad++]&lt;br /&gt;
*[https://atom.io/ Atom]&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
*[https://www.blender.org/ Blender]&lt;br /&gt;
*[http://www.sketchup.com/ SketchUp]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY] (ssh)&lt;br /&gt;
*[http://www.tightvnc.com/ TightVNC]&lt;br /&gt;
*[http://www.cpuid.com/softwares/hwmonitor.html HWMonitor]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=387</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=387"/>
		<updated>2016-02-14T21:08:30Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Other */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
*[https://notepad-plus-plus.org/ Notepad++]&lt;br /&gt;
*[https://atom.io/ Atom]&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY] (ssh)&lt;br /&gt;
*[http://www.tightvnc.com/ TightVNC]&lt;br /&gt;
*[http://www.cpuid.com/softwares/hwmonitor.html HWMonitor]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=386</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=386"/>
		<updated>2016-02-07T01:30:24Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Other */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
*[https://notepad-plus-plus.org/ Notepad++]&lt;br /&gt;
*[https://atom.io/ Atom]&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY] (ssh)&lt;br /&gt;
*[http://www.tightvnc.com/ TightVNC]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=385</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=385"/>
		<updated>2016-02-07T01:28:18Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Dev */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
*[https://notepad-plus-plus.org/ Notepad++]&lt;br /&gt;
*[https://atom.io/ Atom]&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=C%2B%2B_Libraries_Tutorials_and_Documentation&amp;diff=384</id>
		<title>C++ Libraries Tutorials and Documentation</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=C%2B%2B_Libraries_Tutorials_and_Documentation&amp;diff=384"/>
		<updated>2015-11-06T23:04:17Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Tutorials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
[[Category:programming]]&lt;br /&gt;
This page mostly covers libraries that I have had experience with.&lt;br /&gt;
&lt;br /&gt;
=Non Standard=&lt;br /&gt;
==Curses/PDCurses==&lt;br /&gt;
Text user interface (TUI)&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Curses_(programming_library) Wikipedia]&lt;br /&gt;
===Tutorials===&lt;br /&gt;
NCURSES Programming HOWTO[http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/] [http://www.faqs.org/docs/Linux-HOWTO/NCURSES-Programming-HOWTO.html]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=C%2B%2B_Libraries_Tutorials_and_Documentation&amp;diff=383</id>
		<title>C++ Libraries Tutorials and Documentation</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=C%2B%2B_Libraries_Tutorials_and_Documentation&amp;diff=383"/>
		<updated>2015-10-23T00:47:16Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Created page with &amp;quot;{{stub}} Category:programming This page mostly covers libraries that I have had experience with.  =Non Standard= ==Curses/PDCurses== Text user interface (TUI)&amp;lt;br&amp;gt; [https:/...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
[[Category:programming]]&lt;br /&gt;
This page mostly covers libraries that I have had experience with.&lt;br /&gt;
&lt;br /&gt;
=Non Standard=&lt;br /&gt;
==Curses/PDCurses==&lt;br /&gt;
Text user interface (TUI)&amp;lt;br&amp;gt;&lt;br /&gt;
[https://en.wikipedia.org/wiki/Curses_(programming_library) Wikipedia]&lt;br /&gt;
===Tutorials===&lt;br /&gt;
[http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/ NCURSES Programming HOWTO]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Category:Programming&amp;diff=382</id>
		<title>Category:Programming</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Category:Programming&amp;diff=382"/>
		<updated>2015-10-23T00:25:03Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Created page with &amp;quot;&amp;lt;br&amp;gt;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=How_to_Program_in_C%2B%2B_(by_Matt_Mahoney)&amp;diff=381</id>
		<title>How to Program in C++ (by Matt Mahoney)</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=How_to_Program_in_C%2B%2B_(by_Matt_Mahoney)&amp;diff=381"/>
		<updated>2015-10-23T00:24:38Z</updated>

		<summary type="html">&lt;p&gt;Benargee: +cat&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
{{Warning|Page needs to be converted from HTML to MediaWiki format http://pandoc.org/ https://github.com/jgm/pandoc/releases/tag/1.15.0.6}}&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
&lt;br /&gt;
http://benargee.com/bnrg/cpp/how2cpp.html &amp;lt;br&amp;gt;&lt;br /&gt;
http://cs.fit.edu/~mmahoney/cse2050/how2cpp.html&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=How_to_Program_in_C%2B%2B_(by_Matt_Mahoney)&amp;diff=380</id>
		<title>How to Program in C++ (by Matt Mahoney)</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=How_to_Program_in_C%2B%2B_(by_Matt_Mahoney)&amp;diff=380"/>
		<updated>2015-10-23T00:22:46Z</updated>

		<summary type="html">&lt;p&gt;Benargee: moved to html page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
{{Warning|Page needs to be converted from HTML to MediaWiki format http://pandoc.org/ https://github.com/jgm/pandoc/releases/tag/1.15.0.6}}&lt;br /&gt;
&lt;br /&gt;
http://benargee.com/bnrg/cpp/how2cpp.html &amp;lt;br&amp;gt;&lt;br /&gt;
http://cs.fit.edu/~mmahoney/cse2050/how2cpp.html&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=379</id>
		<title>Programming Tutorials</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=379"/>
		<updated>2015-10-22T23:43:34Z</updated>

		<summary type="html">&lt;p&gt;Benargee: +cat&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
[[Category:Programming]] &lt;br /&gt;
=Android=&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL2F07DBCDCC01493A Android Application Development Tutorials] - by [https://www.youtube.com/user/thenewboston thenewboston] - 200 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL6gx4Cwl9DGBsvRxJJOzG4r4k_zLKrnxl Android App Development for Beginners Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 77 videos - Last updated on Mar 4, 2015&lt;br /&gt;
&lt;br /&gt;
=C++=&lt;br /&gt;
* [http://alumni.cs.ucr.edu/~pdiloren/C++_Pointers/Learning C++ Pointers for REAL Dummies]&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79Cu5MYkyJ-u4SyQmMhFeC1C &amp;lt;nowiki&amp;gt;C++ Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79DLA5K3GLbIwf3baNVFO2Lq &amp;lt;nowiki&amp;gt;C++ Object Oriented Programming Video Tutorials For Beginners [Completed Series] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 91 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79AxxmZwARAh3J9SHNGarty8 Advanced C++ Programming Video Tutorials] by [https://www.youtube.com/user/LearningLad LearningLad] - 58 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL5jc9xFGsL8E12so1wlMS0r0hTQoJL74M Concurrent Programming with C++ 11] - by [https://www.youtube.com/user/BoQianTheProgrammer Bo Qian] - 10 videos - Last updated on Jun 25, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLAE85DE8440AA6B83 C++ Programming Tutorials Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 73 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLF541C2C1F671AEF6 C++ Programming Tutorials from thenewboston] - by [https://www.youtube.com/user/thenewboston thenewboston] - 29 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLD0D54219E5F2544D C++ GUI with Qt Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 14 videos - Last updated on Jun 30, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLZMkqlPED79zA8mDuijmhNK5Zg9PkREvS C++ Series] - by [https://www.youtube.com/user/Whiplashx86 Nathan Biefeld] - 8 videos - Last updated on Mar 28, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL318629B5E7919639 C++ Programming] - by [https://www.youtube.com/user/cgermany77 cgermany77] - 31 videos - Last updated on Jun 8, 2014&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=C=&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79CZ5kHTiQHcm-l2q8j06ofd &amp;lt;nowiki&amp;gt;C Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 28, 2015&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Creating_How_to_Program_in_C%2B%2B_(by_Matt_Mahoney)&amp;diff=378</id>
		<title>Creating How to Program in C++ (by Matt Mahoney)</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Creating_How_to_Program_in_C%2B%2B_(by_Matt_Mahoney)&amp;diff=378"/>
		<updated>2015-10-22T23:33:52Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Benargee moved page Creating How to Program in C++ (by Matt Mahoney) to How to Program in C++ (by Matt Mahoney): bad title&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[How to Program in C++ (by Matt Mahoney)]]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=How_to_Program_in_C%2B%2B_(by_Matt_Mahoney)&amp;diff=377</id>
		<title>How to Program in C++ (by Matt Mahoney)</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=How_to_Program_in_C%2B%2B_(by_Matt_Mahoney)&amp;diff=377"/>
		<updated>2015-10-22T23:33:52Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Benargee moved page Creating How to Program in C++ (by Matt Mahoney) to How to Program in C++ (by Matt Mahoney): bad title&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
{{Warning|Page needs to be converted from HTML to MediaWiki format http://pandoc.org/ https://github.com/jgm/pandoc/releases/tag/1.15.0.6}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;How to Program in C++&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body bgcolor=white&amp;gt;&lt;br /&gt;
&amp;lt;h1 align=center&amp;gt;How to Program in C++&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;You may copy this file for noncommercial use.  The latest version&lt;br /&gt;
is located at &amp;lt;a href=http://cs.fit.edu/~mmahoney/cse2050/how2cpp.html&amp;gt;&lt;br /&gt;
cs.fit.edu/~mmahoney/cse2050/how2cpp.html&amp;lt;/a&amp;gt; updated&lt;br /&gt;
Apr. 14, 2010.  Please report errors to Matt Mahoney at&lt;br /&gt;
&amp;lt;a href=mailto:mmahoney@cs.fit.edu&amp;gt;mmahoney@cs.fit.edu&amp;lt;/a&amp;gt;.&lt;br /&gt;
Seldom-used features have been deliberately omitted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=languagesummary&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Language Summary&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a href=#basics&amp;gt;Basic Concepts&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a href=#statements&amp;gt;Statements&amp;lt;/a&amp;gt; if, for, while, return, break...&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a href=#expressions&amp;gt;Expressions&amp;lt;/a&amp;gt; arithmetic, comparison, assignment...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The most important types are&lt;br /&gt;
&amp;lt;tt&amp;gt;int, char, bool, double&amp;lt;/tt&amp;gt;, and the containers &amp;lt;tt&amp;gt;string, vector,&amp;lt;/tt&amp;gt;&lt;br /&gt;
and &amp;lt;tt&amp;gt;map&amp;lt;/tt&amp;gt;.  Summary of common types:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;a href=#builtin&amp;gt;Built-in&amp;lt;/a&amp;gt;        Description&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;a href=#integer&amp;gt;int&amp;lt;/a&amp;gt; x;          Fastest integer type (16-32 bits), also short, long, unsigned&lt;br /&gt;
&amp;lt;a href=#char&amp;gt;char&amp;lt;/a&amp;gt; x;         8-bit character, '\0' to '\xFF' or -128 to 127&lt;br /&gt;
&amp;lt;a href=#floating&amp;gt;double&amp;lt;/a&amp;gt; x;       64 bit real + or - 1.8e308, 14 significant digits, also float&lt;br /&gt;
bool x;         true or false                     &lt;br /&gt;
               &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;a href=#modifiers&amp;gt;Modifiers&amp;lt;/a&amp;gt;       Description&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;a href=#const&amp;gt;const&amp;lt;/a&amp;gt; T x;      Non-modifiable object&lt;br /&gt;
T&amp;amp;amp; y=x;         &amp;lt;a href=#references&amp;gt;Reference&amp;lt;/a&amp;gt;, y is an alias for x, which both have type T&lt;br /&gt;
T f(...) {...}  Defines f as a &amp;lt;a href=#functions&amp;gt;function&amp;lt;/a&amp;gt; returning T&lt;br /&gt;
T* p;           &amp;lt;a href=#pointers&amp;gt;Pointer&amp;lt;/a&amp;gt; to T (*p is a T object)&lt;br /&gt;
T a[N];         &amp;lt;a href=#arrays&amp;gt;Array&amp;lt;/a&amp;gt; of N elements of T, a[0] to a[N-1]&lt;br /&gt;
&amp;lt;a href=#static&amp;gt;static&amp;lt;/a&amp;gt; T x;     Place x in data segment&lt;br /&gt;
&amp;lt;a href=#register&amp;gt;register&amp;lt;/a&amp;gt; T x;   (rare) Hint to optimize for speed&lt;br /&gt;
&amp;lt;a href=#volatile&amp;gt;volatile&amp;lt;/a&amp;gt; T x;   (rare) x may be modified externally&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following standard library types and functions require at the&lt;br /&gt;
beginning of the program:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #include &amp;amp;lt;&amp;lt;i&amp;gt;header&amp;lt;/i&amp;gt;&amp;gt;&lt;br /&gt;
  using namespace std;&lt;br /&gt;
               &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;a href=#standardlibrarytypes&amp;gt;Library Type&amp;lt;/a&amp;gt;    Description                             Header&amp;lt;/b&amp;gt;&lt;br /&gt;
istream         Standard input (cin)                    &amp;lt;a href=#iostream&amp;gt;iostream&amp;lt;/a&amp;gt;&lt;br /&gt;
ostream         Output (cout, cerr, clog)               iostream&lt;br /&gt;
ifstream        Input file                              &amp;lt;a href=#fstream&amp;gt;fstream&amp;lt;/a&amp;gt;&lt;br /&gt;
ofstream        Output file                             fstream&lt;br /&gt;
string          Sequence of char                        &amp;lt;a href=#string&amp;gt;string&amp;lt;/a&amp;gt;&lt;br /&gt;
vector&amp;amp;lt;T&amp;gt;       Expandable array/stack of T             &amp;lt;a href=#vector&amp;gt;vector&amp;lt;/a&amp;gt;&lt;br /&gt;
deque&amp;amp;lt;T&amp;gt;        Array/double ended queue                &amp;lt;a href=#deque&amp;gt;deque&amp;lt;/a&amp;gt;&lt;br /&gt;
list&amp;amp;lt;T&amp;gt;         List/stack/queue of T                   &amp;lt;a href=#list&amp;gt;list&amp;lt;/a&amp;gt;&lt;br /&gt;
map&amp;amp;lt;T1,T2&amp;gt;      Associative mapping of T1 to T2         &amp;lt;a href=#map&amp;gt;map&amp;lt;/a&amp;gt;&lt;br /&gt;
set&amp;amp;lt;T1&amp;gt;         A map with keys only                    &amp;lt;a href=#set&amp;gt;set&amp;lt;/a&amp;gt;&lt;br /&gt;
pair&amp;amp;lt;T1,T2&amp;gt;     Two objects of type T1 and T2           map or utility&lt;br /&gt;
priority_queue&amp;amp;lt;T&amp;gt;  Sorted queue                         &amp;lt;a href=#queue&amp;gt;queue&amp;lt;/a&amp;gt;&lt;br /&gt;
stack&amp;amp;lt;T&amp;gt;        Stack                                   &amp;lt;a href=#stack&amp;gt;stack&amp;lt;/a&amp;gt;&lt;br /&gt;
bitset&amp;amp;lt;N&amp;gt;       Array of N bool with logical operations &amp;lt;a href=#bitset&amp;gt;bitset&amp;lt;/a&amp;gt;&lt;br /&gt;
valarray&amp;amp;lt;T&amp;gt;     Array with arithmetic operations        &amp;lt;a href=#valarray&amp;gt;valarray&amp;lt;/a&amp;gt;&lt;br /&gt;
complex&amp;amp;lt;T&amp;gt;      Complex number                          &amp;lt;a href=#complex&amp;gt;complex&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;a href=#cpplibrary&amp;gt;iterator&amp;lt;/a&amp;gt;        Pointer into a container                (Included with container)&lt;br /&gt;
const_iterator  Pointer not allowing element assignment (Included with container)&lt;br /&gt;
exception       Hierarchy of exception types            &amp;lt;a href=#stdexcept&amp;gt;stdexcept, exception&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;a href=#cpplibrary&amp;gt;C++ Standard Library Functions&amp;lt;/a&amp;gt;                          Header&amp;lt;/b&amp;gt;&lt;br /&gt;
min(), max(), swap(), sort(), copy(), equal()           &amp;lt;a href=#algorithm&amp;gt;algorithm&amp;lt;/a&amp;gt;&lt;br /&gt;
accumulate(), inner_product()                           &amp;lt;a href=#numeric&amp;gt;numeric&amp;lt;/a&amp;gt;&lt;br /&gt;
back_inserter()                                         &amp;lt;a href=#iterator&amp;gt;iterator&amp;lt;/a&amp;gt;&lt;br /&gt;
equal_to(), less(), bind2nd()                           &amp;lt;a href=#functional&amp;gt;functional&amp;lt;/a&amp;gt;&lt;br /&gt;
set_new_handler()                                       &amp;lt;a href=#new&amp;gt;new&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;a href=#clibrary&amp;gt;C Library Functions&amp;lt;/a&amp;gt;                                     Header&amp;lt;/b&amp;gt;&lt;br /&gt;
atoi(), atof(), abs(), rand(), system(), exit()         &amp;lt;a href=#cstdlib&amp;gt;cstdlib&amp;lt;/a&amp;gt;&lt;br /&gt;
isalpha(), isdigit(), tolower(), toupper()              &amp;lt;a href=#cctype&amp;gt;cctype&amp;lt;/a&amp;gt;&lt;br /&gt;
sqrt(), log(), exp(), pow(), sin(), cos(), atan()       &amp;lt;a href=#cmath&amp;gt;cmath&amp;lt;/a&amp;gt;&lt;br /&gt;
clock(), time()                                         &amp;lt;a href=#ctime&amp;gt;ctime&amp;lt;/a&amp;gt;&lt;br /&gt;
strlen(), memset(), memmove(), memcmp()                 &amp;lt;a href=#cstring&amp;gt;cstring&amp;lt;/a&amp;gt;&lt;br /&gt;
printf(), fopen(), getc(), perror()                     &amp;lt;a href=#cstdio&amp;gt;cstdio&amp;lt;/a&amp;gt;&lt;br /&gt;
assert()                                                &amp;lt;a href=#cassert&amp;gt;cassert&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;C++ allows you to create your own types and libraries.  The most&lt;br /&gt;
important type is a &amp;lt;a href=#classes&amp;gt;&amp;lt;tt&amp;gt;class&amp;lt;/tt&amp;gt;&amp;lt;/a&amp;gt;, allowing object oriented&lt;br /&gt;
programming.  A class is an abstract data type with a hidden&lt;br /&gt;
representation and a set of public member functions and types.&lt;br /&gt;
Classes can be organized into a hierarchy (&amp;lt;a href=#inheritance&amp;gt;inheritance&amp;lt;/a&amp;gt;), and you&lt;br /&gt;
can write code that accepts any type in this hierarchy (&amp;lt;a href=#polymorphism&amp;gt;polymorphism&amp;lt;/a&amp;gt;).&lt;br /&gt;
Functions and classes can be parameterized by type (templated).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;a href=#classes&amp;gt;class&amp;lt;/a&amp;gt; T {...};  Defines T as a collection of types, objects, and member functions&lt;br /&gt;
template &amp;amp;lt;class T&amp;gt; ... Defines a set of &amp;lt;a href=#templatefunction&amp;gt;functions&amp;lt;/a&amp;gt; or &amp;lt;a href=#templateclass&amp;gt;classes&amp;lt;/a&amp;gt; over all T&lt;br /&gt;
&amp;lt;a href=#typedef&amp;gt;typedef&amp;lt;/a&amp;gt; T U;    Defines type U is a synonym for T&lt;br /&gt;
&amp;lt;a href=#enum&amp;gt;enum&amp;lt;/a&amp;gt; T {...};   Defines T as an int, and set of int constants&lt;br /&gt;
&amp;lt;a href=#struct&amp;gt;struct&amp;lt;/a&amp;gt; T {...}; Like a class, except default scope of members is public&lt;br /&gt;
&amp;lt;a href=#union&amp;gt;union&amp;lt;/a&amp;gt; T {...};  A struct with object members overlapping in memory&lt;br /&gt;
&amp;lt;a href=#namespaces&amp;gt;namespace&amp;lt;/a&amp;gt; N {...};  Defines a scope for a collection of types, objects, and functions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a href=#programorganization&amp;gt;Program Organization&amp;lt;/a&amp;gt; (compiling, linking, make)&lt;br /&gt;
&amp;lt;a href=#history&amp;gt;History of C++&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;a href=#furtherreading&amp;gt;Further Reading&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=basics&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Basics&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;C++ is a compiled language, an upward compatible superset of C&lt;br /&gt;
and an (incompatible) predecessor to Java.  C++ compiles C programs but&lt;br /&gt;
adds object oriented (OO) features (classes, inheritance, polymorphism),&lt;br /&gt;
templates (generic functions and classes), function and operator&lt;br /&gt;
overloading, namespaces (packages), exception handling, a library of&lt;br /&gt;
standard data structures (string, vector, map, etc.) and formatted text I/O&lt;br /&gt;
(istream, ostream).  Unlike Java, C++ lacks a standard graphical user&lt;br /&gt;
interface (GUI), network interface, garbage collection, and threads,&lt;br /&gt;
and allows non-OO programming and unchecked low-level machine operations&lt;br /&gt;
with pointers.  However, C++ executes faster than Java and requires&lt;br /&gt;
no run-time support.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A C++ program is a collection of function, object, and type declarations.&lt;br /&gt;
Every program must have a function &amp;lt;tt&amp;gt;int main() { ... }&amp;lt;/tt&amp;gt;&lt;br /&gt;
where the curly braces enclose a block, a sequence of declarations&lt;br /&gt;
and statements ending in semicolons which are executed in order.&lt;br /&gt;
A statement is an expression, block,&lt;br /&gt;
or control statement that alters the order of execution, such as&lt;br /&gt;
&amp;lt;tt&amp;gt;if, while, for, break, return&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Some types (&amp;lt;tt&amp;gt;std::string&amp;lt;/tt&amp;gt;), objects (&amp;lt;tt&amp;gt;std::cout&amp;lt;/tt&amp;gt;),&lt;br /&gt;
and functions are defined in header files, requiring the line&lt;br /&gt;
&amp;lt;tt&amp;gt;#include &amp;amp;lt;&amp;lt;i&amp;gt;header&amp;lt;/i&amp;gt;&amp;amp;gt;&amp;lt;/tt&amp;gt; before use.  Items&lt;br /&gt;
defined in the standard headers are in the namespace &amp;lt;tt&amp;gt;std&amp;lt;/tt&amp;gt;.&lt;br /&gt;
The &amp;lt;tt&amp;gt;std::&amp;lt;/tt&amp;gt; prefix may be dropped after the statement&lt;br /&gt;
&amp;lt;tt&amp;gt;using namespace std;&amp;lt;/tt&amp;gt;.  For instance,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Comment: prints &amp;quot;Hello world!&amp;quot; and an OS-independent newline&lt;br /&gt;
  #include &amp;amp;lt;string&amp;gt;    // Defines type std::string&lt;br /&gt;
  #include &amp;amp;lt;iostream&amp;gt;  // Defines global object std::cout&lt;br /&gt;
  using namespace std; // Allow std:: to be dropped&lt;br /&gt;
  int main() {         // Execution starts here&lt;br /&gt;
    string s=&amp;quot;Hello world!\n&amp;quot;; // Declares object s of type string&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; s;         // An expression as a statement, &amp;amp;lt;&amp;amp;lt; is the output operator&lt;br /&gt;
    return 0;          // Execution ends here&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The symbol &amp;lt;tt&amp;gt;//&amp;lt;/tt&amp;gt; denotes a comment to the end of the line.  You may also&lt;br /&gt;
use &amp;lt;tt&amp;gt;/* ... */&amp;lt;/tt&amp;gt; for multiline comments.  Spacing and indentation is&lt;br /&gt;
used for readability.  C++ is mostly free-form, except that&lt;br /&gt;
the end of line is significant after &amp;lt;tt&amp;gt;# &amp;lt;/tt&amp;gt;and &amp;lt;tt&amp;gt;//&amp;lt;/tt&amp;gt;.&lt;br /&gt;
C++ is case sensitive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;C++ source code files should be created with a text editor and&lt;br /&gt;
have the extension &amp;lt;tt&amp;gt;.cpp&amp;lt;/tt&amp;gt;.  If the above is called &amp;lt;tt&amp;gt;hello.cpp&amp;lt;/tt&amp;gt;,&lt;br /&gt;
it may be compiled  and run as follows in a UNIX shell window:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  g++ hello.cpp -o hello -Wall -O&lt;br /&gt;
  ./hello&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;lt;tt&amp;gt;-o&amp;lt;/tt&amp;gt; option renames the executable file, by default&lt;br /&gt;
&amp;lt;tt&amp;gt;a.out&amp;lt;/tt&amp;gt;.  &amp;lt;tt&amp;gt;-Wall&amp;lt;/tt&amp;gt; turns on all warnings (recommended).&lt;br /&gt;
&amp;lt;tt&amp;gt;-O&amp;lt;/tt&amp;gt; optimizes (compiles slower but runs faster).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In Windows, the GNU C++ compiler is called DJGPP.  To compile and&lt;br /&gt;
run from an MS-DOS box:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  gxx hello.cpp -o hello.exe&lt;br /&gt;
  hello&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The output file must have a .EXE extension (default is A.EXE).  There is&lt;br /&gt;
also a .OBJ file which you can delete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;To use the network or GUI interface in UNIX, you must use the X&lt;br /&gt;
and socket libraries, which don't work in Windows.  In Windows, you&lt;br /&gt;
must use the Windows API and a compiler that supports them, such&lt;br /&gt;
as from Microsoft, Borland, or Symantec.  GUI/network programming is&lt;br /&gt;
nonportable and outside the scope of this document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Links to free and commercial C++ compilers can be found at&lt;br /&gt;
&amp;lt;a href=http://cplusplus.com/&amp;gt;cplusplus.com&amp;lt;/a&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=statements&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Statements&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A program consists of a collection of functions (one of which must&lt;br /&gt;
be &amp;lt;tt&amp;gt;int main() {...}&amp;lt;/tt&amp;gt;) and type and object&lt;br /&gt;
declarations.  A function may contain declarations and statements.&lt;br /&gt;
Statements have the following forms, where&lt;br /&gt;
&amp;lt;tt&amp;gt;s&amp;lt;/tt&amp;gt; is a statement, and&lt;br /&gt;
&amp;lt;tt&amp;gt;t&amp;lt;/tt&amp;gt; is a true/false expression.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
s;                             // &amp;lt;a href=#expressions&amp;gt;Expression&amp;lt;/a&amp;gt; or &amp;lt;a href=#declarations&amp;gt;declaration&amp;lt;/a&amp;gt;&lt;br /&gt;
;                              // Empty statement&lt;br /&gt;
{s; s;}                        // A &amp;lt;a href=#statements&amp;gt;block&amp;lt;/a&amp;gt; of 0 or more statements is a statement&lt;br /&gt;
&amp;lt;a href=#if&amp;gt;if&amp;lt;/a&amp;gt; (t) s;                      // If t is true then s&lt;br /&gt;
if (t) s; else s;              // else is optional&lt;br /&gt;
&amp;lt;a href=#while&amp;gt;while&amp;lt;/a&amp;gt; (t) s;                   // Loop 0 or more times&lt;br /&gt;
&amp;lt;a href=#for&amp;gt;for&amp;lt;/a&amp;gt; (s1; t; s2) s;             // s1; while (t) {s; s2;}&lt;br /&gt;
break;                         // Jump from while, for, do, switch&lt;br /&gt;
&amp;lt;a href=#return&amp;gt;return&amp;lt;/a&amp;gt; x;                      // Return x to calling function&lt;br /&gt;
&amp;lt;a href=#try&amp;gt;try&amp;lt;/a&amp;gt; {throw x;}                 // Throw exception, abort if not caught, x has any type&lt;br /&gt;
  catch (T y) {s;}               // if x has type T then y=x, jump to s&lt;br /&gt;
  catch (...) {s;}               // else jump here (optional)&lt;br /&gt;
do s; while (t);               // (uncommon) s; while (t) s;&lt;br /&gt;
continue;                      // (uncommon) Start next loop of while, for, do&lt;br /&gt;
switch (i) {                   // (uncommon) Test int expression i to const C&lt;br /&gt;
  case C: s; break;              // if (i==C) go here&lt;br /&gt;
  default: s;                    // optional, else go here&lt;br /&gt;
}&lt;br /&gt;
label: goto label;             // (rare) Jump to label within a function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A statement may be a declaration or an expression.  Objects and&lt;br /&gt;
types declared in a block are local to that block.&lt;br /&gt;
(Functions cannot be defined locally).  It is normal (but not required) to&lt;br /&gt;
show statements on separate lines and to indent&lt;br /&gt;
statements enclosed in a block.  If braces are optional, we indent anyway.&lt;br /&gt;
For instance,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{                     // start of block&lt;br /&gt;
  int a[10], i=0, j;  // declaration&lt;br /&gt;
  a[i+2]=3;           // expression&lt;br /&gt;
}                     // end of block, a, i, and j are destroyed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
declares the array of int &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; with elements &amp;lt;tt&amp;gt;a[0]&amp;lt;/tt&amp;gt;&lt;br /&gt;
through &amp;lt;tt&amp;gt;a[9]&amp;lt;/tt&amp;gt; (whose values are initially undefined), &lt;br /&gt;
&amp;lt;tt&amp;gt;i&amp;lt;/tt&amp;gt; with initial value 0, and &amp;lt;tt&amp;gt;j&amp;lt;/tt&amp;gt;&lt;br /&gt;
with an undefined initial value.  These names can only be used in scope,&lt;br /&gt;
which is from the declaration to the closing brace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;a name=while&amp;gt;&amp;lt;a name=for&amp;gt;&lt;br /&gt;
The &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop is normally used for iteration.  For &lt;br /&gt;
instance, the following both exit the loop with &amp;lt;tt&amp;gt;i&amp;lt;/tt&amp;gt; set to the index of&lt;br /&gt;
the first element of &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; such that &amp;lt;tt&amp;gt;a[i]&amp;lt;/tt&amp;gt; is 0, or to 10 if not found.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for (i=0; i&amp;amp;lt;10; i=i+1) {    i=0;&lt;br /&gt;
    if (a[i]==0) {            while (i&amp;amp;lt;10) {&lt;br /&gt;
      break;                    if (a[i]==0)&lt;br /&gt;
    }                             break;&lt;br /&gt;
  }                             i=i+1;&lt;br /&gt;
                              }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The braces in the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop are optional because they each enclose&lt;br /&gt;
a single statement.  In the &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loop, the outer braces are&lt;br /&gt;
required because they enclose 2 statements.&lt;br /&gt;
All statements are optional: &amp;lt;tt&amp;gt;for (;;)&amp;lt;/tt&amp;gt; loops forever.&lt;br /&gt;
The first statement in&lt;br /&gt;
a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop may declare a variable local to the loop.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for (int i=0; i&amp;amp;lt;10; i=i+1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;It is only possible to &amp;lt;tt&amp;gt;break&amp;lt;/tt&amp;gt; from the innermost loop&lt;br /&gt;
of a nested loop.  &amp;lt;tt&amp;gt;continue&amp;lt;/tt&amp;gt; in a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop&lt;br /&gt;
skips the rest of the block but executes the iteration (s2) and&lt;br /&gt;
test before starting the next loop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=return&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;return x;&amp;lt;/tt&amp;gt; causes the current function to return to&lt;br /&gt;
the caller, evaluating to x.  It is required except in functions&lt;br /&gt;
returning void, in which case &amp;lt;tt&amp;gt;return;&amp;lt;/tt&amp;gt; returns without a&lt;br /&gt;
value.  The value returned by &amp;lt;tt&amp;gt;main()&amp;lt;/tt&amp;gt; has no effect on&lt;br /&gt;
program behavior and is normally discarded.  However it is available&lt;br /&gt;
as the $status in a UNIX csh script or ERRORLEVEL in a Windows .BAT file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int sum(int x, int y) {  // Function definition&lt;br /&gt;
    return x+y;&lt;br /&gt;
  }&lt;br /&gt;
  int main() {&lt;br /&gt;
    int a=sum(1,2);        // a=3;&lt;br /&gt;
    return 0;              // By convention, nonzero indicates an error&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=if&amp;gt;&lt;br /&gt;
&amp;lt;a name=switch&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;A test of several alternatives usually has the form &amp;lt;tt&amp;gt;&lt;br /&gt;
if (t) s; else if (t) s; else if (t) s; ... else s;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
A &amp;lt;tt&amp;gt;switch&amp;lt;/tt&amp;gt; statement is an optimization&lt;br /&gt;
for the special case where an int expression is tested against a&lt;br /&gt;
small range of constant values.  The following are equivalent:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  switch (i) {                if (i==1)&lt;br /&gt;
    case 1: j=1; break;         j=1;&lt;br /&gt;
    case 2: // fall thru      else if (i==2 || i==3) // || means &amp;quot;or else&amp;quot;&lt;br /&gt;
    case 3: j=23; break;        j=23;&lt;br /&gt;
    default: j=0;             else&lt;br /&gt;
  }                             j=0;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=try&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;throw x&amp;lt;/tt&amp;gt; jumps to the first &amp;lt;tt&amp;gt;catch&amp;lt;/tt&amp;gt; statement of the&lt;br /&gt;
most recently executed &amp;lt;tt&amp;gt;try&amp;lt;/tt&amp;gt; block where the parameter declaration&lt;br /&gt;
matches the type of x, or a type that x can be converted to, or is&lt;br /&gt;
&amp;lt;tt&amp;gt;...&amp;lt;/tt&amp;gt;.  At most one catch block is executed.&lt;br /&gt;
If no matching &amp;lt;tt&amp;gt;catch&amp;lt;/tt&amp;gt; block is found, the program aborts&lt;br /&gt;
(Unexpected exception).&lt;br /&gt;
&amp;lt;tt&amp;gt;throw;&amp;lt;/tt&amp;gt; with no expression in a &amp;lt;tt&amp;gt;catch&amp;lt;/tt&amp;gt; block throws&lt;br /&gt;
the exception just caught.  Exceptions are generally&lt;br /&gt;
used when it is inconvenient to detect and handle an error in the&lt;br /&gt;
same place.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  void f() {&lt;br /&gt;
    throw 3;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  int main() {&lt;br /&gt;
    try {&lt;br /&gt;
      f();&lt;br /&gt;
    }&lt;br /&gt;
    catch(int i) {  // Execute this block with i = 3&lt;br /&gt;
      throw;        // throw 3 (not caught, so program aborts)&lt;br /&gt;
    }&lt;br /&gt;
    catch(...) {    // Catch any other type&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=expressions&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Expressions&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;There are 18 levels of operator precedence, listed highest to lowest.&lt;br /&gt;
Operators at the same level are evaluated left to right unless indicted,&lt;br /&gt;
Thus, a=b+c means a=(b+c) because + is higher than =, and a-b-c means&lt;br /&gt;
(a-b)-c.  Order of evaluation is undefined, e.g. for &amp;lt;tt&amp;gt;sin(x)+cos(x)&amp;lt;/tt&amp;gt;&lt;br /&gt;
we cannot say whether sin() or cos() is called first.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The meaning of an expression depends on the types of the operands.&lt;br /&gt;
&amp;lt;tt&amp;gt;(x,y)&amp;lt;/tt&amp;gt; denotes a comma separated list of 0 or more objects,&lt;br /&gt;
e.g. &amp;lt;tt&amp;gt;()&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;(x)&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;(1,2,3,4)&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1&lt;br /&gt;
X::m           Member m of namespace or class X&lt;br /&gt;
::m            Global name m when otherwise hidden by a local declaration&lt;br /&gt;
&lt;br /&gt;
2&lt;br /&gt;
p[i]           i'th element of container p (array, vector, string)&lt;br /&gt;
x.m            Member m of object x&lt;br /&gt;
p-&amp;gt;m           Member m of object pointed to by p&lt;br /&gt;
f(x,y)         Call function f with 0 or more arguments&lt;br /&gt;
i++            Add 1 to i, result is original value of i&lt;br /&gt;
i--            Subtract 1 from i, result is original value of i&lt;br /&gt;
&amp;lt;a href=#static_cast&amp;gt;static_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/a&amp;gt;       Convert x to type T using defined conversions&lt;br /&gt;
&amp;lt;a href=#const_cast&amp;gt;const_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/a&amp;gt;        (rare) Convert x to equivalent but non-const T&lt;br /&gt;
&amp;lt;a href=#reinterpret_cast&amp;gt;reinterpret_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/a&amp;gt;  (rare, dangerous) Pretend x has type T&lt;br /&gt;
&amp;lt;a href=#runtimetype&amp;gt;dynamic_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/a&amp;gt;      (rare) Convert base pointer or reference to derived if possible&lt;br /&gt;
&amp;lt;a href=#runtimetype&amp;gt;typeid(x)&amp;lt;/a&amp;gt;      (rare) If x is type T, then typeid(x)==typeid(T) (in &amp;amp;lt;typeinfo&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
3 (right to left)&lt;br /&gt;
*p             Contents of pointer p, or p[0].  If p is type T*, *p is T&lt;br /&gt;
&amp;amp;amp;x             Address of (pointer to) x.  If x is type T, &amp;amp;x is T*&lt;br /&gt;
-a             Negative of numeric a&lt;br /&gt;
!i             Not i, true if i is false or 0&lt;br /&gt;
~i             Bitwise compliment of i, -1 - i&lt;br /&gt;
(T)x           Convert (cast) object x to type T (by static, const, or reinterpret)&lt;br /&gt;
T(x,y)         Convert, initializing with 0 or more arguments&lt;br /&gt;
new T          Create a T object on heap, return its address as T*&lt;br /&gt;
new T(x,y)     Create, initializing with 0 or more arguments&lt;br /&gt;
new(p) T       (rare) Initialize T at address p without allocating from heap&lt;br /&gt;
new(p) T(x,y)  (rare) Initialize T with 0 or more arguments at p&lt;br /&gt;
new T[i]       Create array of i objects of type T, return T* pointing to first element&lt;br /&gt;
delete p       Destroy object pointed to by p obtained with new T or new T()&lt;br /&gt;
delete[] p     Destroy array obtained with new T[]&lt;br /&gt;
++i            Add 1 to i, result is the new i&lt;br /&gt;
--i            Subtract 1 from i, result is the new i&lt;br /&gt;
sizeof x       Size of object x in bytes&lt;br /&gt;
sizeof(T)      Size of objects of type T in bytes&lt;br /&gt;
&lt;br /&gt;
4&lt;br /&gt;
x.*p           (rare) Object in x pointed to by pointer to member p&lt;br /&gt;
q-&amp;gt;*p          (rare) Object in *q pointed to by pointer to member p&lt;br /&gt;
&lt;br /&gt;
5&lt;br /&gt;
a*b            Multiply numeric a and b&lt;br /&gt;
a/b            Divide numeric a and b, round toward 0 if both are integer&lt;br /&gt;
i%j            Integer remainder i-(i/j)*j&lt;br /&gt;
&lt;br /&gt;
6&lt;br /&gt;
a+b            Addition, string concatenation&lt;br /&gt;
a-b            Subtraction&lt;br /&gt;
&lt;br /&gt;
7&lt;br /&gt;
x&amp;amp;lt;&amp;amp;lt;y           Integer x shifted y bits to left, or output y to ostream x&lt;br /&gt;
x&amp;gt;&amp;gt;y           Integer x shifted y bits to right, or input y from istream x&lt;br /&gt;
&lt;br /&gt;
8&lt;br /&gt;
x&amp;amp;lt;y            Less than&lt;br /&gt;
x&amp;gt;y            Greater than&lt;br /&gt;
x&amp;amp;lt;=y           Less than or equal to&lt;br /&gt;
x&amp;gt;=y           Greater than or equal to&lt;br /&gt;
&lt;br /&gt;
9&lt;br /&gt;
x==y           Equals&lt;br /&gt;
x!=y           Not equals&lt;br /&gt;
&lt;br /&gt;
10&lt;br /&gt;
i&amp;amp;amp;j            Bitwise AND of integers i and j&lt;br /&gt;
&lt;br /&gt;
11&lt;br /&gt;
i^j            Bitwise XOR of integers i and j&lt;br /&gt;
&lt;br /&gt;
12&lt;br /&gt;
i|j            Bitwise OR of integers i and j&lt;br /&gt;
&lt;br /&gt;
13&lt;br /&gt;
i&amp;amp;amp;&amp;amp;amp;j           i and then j (evaluate j only if i is true/nonzero)&lt;br /&gt;
&lt;br /&gt;
14&lt;br /&gt;
i||j           i or else j (evaluate j only if i is false/zero)&lt;br /&gt;
&lt;br /&gt;
15 (right to left)&lt;br /&gt;
x=y            Assign y to x, result is new value of x&lt;br /&gt;
x+=y           x=x+y, also -= *= /= %= &amp;amp;amp;= |= ^= &amp;amp;lt;&amp;amp;lt;= &amp;gt;&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
16&lt;br /&gt;
i?x:y          If i is true/nonzero then x else y&lt;br /&gt;
&lt;br /&gt;
17&lt;br /&gt;
throw x        Throw exception x (any type)&lt;br /&gt;
&lt;br /&gt;
18&lt;br /&gt;
x,y            Evaluate x and y (any types), result is y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expressions that don't require creating a new object, such as &amp;lt;tt&amp;gt;a=b, ++a,&lt;br /&gt;
p[i], p-&amp;gt;m, x.m, a?b:c, a,b&amp;lt;/tt&amp;gt; etc. are &amp;lt;i&amp;gt;lvalues&amp;lt;/i&amp;gt;, meaning they&lt;br /&gt;
may appear on the left side of an assignment.&lt;br /&gt;
Other expressions and conversions create temporary objects to hold the&lt;br /&gt;
result, which are &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt; (constant).  An expression used as a&lt;br /&gt;
statement discards the final result.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a, b, c;&lt;br /&gt;
  a+b;         // Legal, add a and b, discard the sum&lt;br /&gt;
  a=b=c;       // Legal, assign c to b, then assign the new b to a&lt;br /&gt;
  (a+=b)+=c;   // Legal, add b to a, then add c to a&lt;br /&gt;
  a+b=c;       // Error, a+b is const&lt;br /&gt;
  double(a)=b; // Error, double(a) is const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a name=static_cast&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;static_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt; converts x to type T if a conversion&lt;br /&gt;
is defined.  Usually the value of x is preserved if possible.  Conversions&lt;br /&gt;
are defined between all numeric types (including char and bool), from&lt;br /&gt;
0 to pointer, pointer to bool or void*, istream to bool, ostream to bool,&lt;br /&gt;
char* to string, from a derived class to base class (including&lt;br /&gt;
pointers or references), and from type T to type U if class U has a&lt;br /&gt;
constructor taking T or class T has&lt;br /&gt;
a member &amp;lt;tt&amp;gt;operator U()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
A conversion will be implicit (automatically applied) whenever an&lt;br /&gt;
otherwise invalid expression, assignment, or function argument can be&lt;br /&gt;
made legal by applying one, except for T to U where U's constructor&lt;br /&gt;
taking T is declared &amp;lt;tt&amp;gt;explicit&amp;lt;/tt&amp;gt;, for example, the constructor&lt;br /&gt;
for &amp;lt;tt&amp;gt;vector&amp;lt;/tt&amp;gt; taking &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  double d; d=static_cast&amp;amp;lt;double&amp;gt;(3);  // Explicit 3 to 3.0&lt;br /&gt;
  d=3;                                 // Implicit conversion&lt;br /&gt;
  d=sqrt(3);                           // Implicit 3.0, sqrt() expects double&lt;br /&gt;
  vector&amp;amp;lt;int&amp;gt; v(5);                    // This constructor is explicit&lt;br /&gt;
  v=5;                                 // Error, no implicit conversion&lt;br /&gt;
  v=static_cast&amp;amp;lt;vector&amp;amp;lt;int&amp;gt; &amp;gt;(5);      // OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a name=const_cast&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;const_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; allows an object to be modified through&lt;br /&gt;
a const pointer or reference.  It must always be explicit.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int x=3;&lt;br /&gt;
  const int&amp;amp; r=x; r=4;     // Error, r is const&lt;br /&gt;
  const_cast&amp;amp;lt;int&amp;amp;&amp;gt;(r)=4;   // OK, x=4&lt;br /&gt;
  const int* p=&amp;amp;x; *p=5;   // Error, *p is const&lt;br /&gt;
  *const_cast&amp;amp;lt;int*&amp;gt;(p)=5;  // OK, x=5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If x were const, then this code would still be allowed but it is&lt;br /&gt;
undefined whether x actually changes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a name=reinterpret_cast&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;reinterpret_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; turns off normal type checking between&lt;br /&gt;
int and different pointer types, which are normally incompatible.  The only&lt;br /&gt;
safe conversion is to convert a pointer back to its original type.&lt;br /&gt;
Conversion is always explicit.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int x=3, *p=&amp;amp;x; *p=5;             // OK, x=5&lt;br /&gt;
  *reinterpret_cast&amp;amp;lt;double*&amp;gt;(p)=5;  // Crash, writing 8 bytes into 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The expression &amp;lt;tt&amp;gt;(T)x&amp;lt;/tt&amp;gt; applies whatever combination&lt;br /&gt;
of static, const, and reinterpret casts are needed to convert x to&lt;br /&gt;
type T. &amp;lt;tt&amp;gt;T(x)&amp;lt;/tt&amp;gt; is a static_cast.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const char* s=&amp;quot;hello&amp;quot;;&lt;br /&gt;
  int(*s);                 // static_cast&lt;br /&gt;
  (char*)s;                // const_cast&lt;br /&gt;
  (const int*)s;           // reinterpret_cast&lt;br /&gt;
  (int*)s;                 // reinterpret_cast and const_cast&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=declarations&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Declarations&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A declaration creates a type, object, or function and gives it a name.&lt;br /&gt;
The syntax is a type name followed by a list of objects with possible&lt;br /&gt;
modifiers and initializers applying to each object.  A name consists of&lt;br /&gt;
upper or lowercase letters, digits, and underscores (_) with a leading&lt;br /&gt;
letter.  (Leading underscores are allowed but may be reserved).&lt;br /&gt;
An initializer appends the form &amp;lt;tt&amp;gt;=x&amp;lt;/tt&amp;gt; where x is an expression,&lt;br /&gt;
or (x,y) for a list of &amp;lt;i&amp;gt;one&amp;lt;/i&amp;gt; or more expressions.&lt;br /&gt;
For instance,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string s1, s2=&amp;quot;xxx&amp;quot;, s3(&amp;quot;xxx&amp;quot;), s4(3,'x'), *p, a[5], next_Word();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
declares s1 to be a string with initial value &amp;quot;&amp;quot;, s2, s3, and s4&lt;br /&gt;
to be strings with initial value &amp;quot;xxx&amp;quot;, p to be a pointer to string,&lt;br /&gt;
a to be an array of 5 strings (a[0] to a[4] with initial values &amp;quot;&amp;quot;),&lt;br /&gt;
and &amp;lt;tt&amp;gt;next_Word&amp;lt;/tt&amp;gt; to be a function that takes no parameters and&lt;br /&gt;
returns a string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=builtin&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Built-in Types&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All built-in types are numeric.  They are not automatically initialized&lt;br /&gt;
to 0 unless global or static.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a, b=0;       // a's value is undefined&lt;br /&gt;
  static double x;  // 0.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Types and their usual ranges are listed below.  Actual ranges could be&lt;br /&gt;
&amp;lt;a href=http://home.att.net/~jackklein/c/inttypes.html&amp;gt;different&amp;lt;/a&amp;gt;.&lt;br /&gt;
The most important types are int,&lt;br /&gt;
bool, char, and double.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;b&amp;gt;Integer types           Bits   Range&amp;lt;/b&amp;gt;&lt;br /&gt;
  bool                     1     false (0) or true (1)&lt;br /&gt;
  signed char              8     '\x80' to '\x7f' (-128 to 127)&lt;br /&gt;
  unsigned char            8     '\x00' to '\XFF' (0 to 255)&lt;br /&gt;
  char                     8     Usually signed&lt;br /&gt;
  short                   16     -32768 to 32767&lt;br /&gt;
  unsigned short          16     0u to 65535U&lt;br /&gt;
  int                     32     Usually -2147483648 to 2147483647&lt;br /&gt;
  unsigned int            32     Usually 0 to 4294967295U&lt;br /&gt;
  long                    32-64  At least -2147483648l to 2147483647L&lt;br /&gt;
  unsigned long           32-64  0ul to at least 4294967295LU&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;b&amp;gt;Floating point types    Bits   Range&amp;lt;/b&amp;gt;&lt;br /&gt;
  float                   32     -1.7e38f to 1.7E38F, 6 significant digits&lt;br /&gt;
  double                  64     -1.8e308 to 1.8E308, 14 significant digits&lt;br /&gt;
  long double             64-80  At least double&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are implicit conversions between all types.  When types are&lt;br /&gt;
mixed in an expression, both operands are converted to the type&lt;br /&gt;
that has the higher upper bound, but at least to int.  This conversion&lt;br /&gt;
only loses representation when mixing signed and unsigned types.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  7/4                     // 1, int division rounds toward 0&lt;br /&gt;
  7.0/4                   // 1.75, implicit double(4) = 4.0&lt;br /&gt;
  '\x05'+true             // 6, implicit int('\x05') = 5, int(true) = 1&lt;br /&gt;
  3U &amp;gt; -1                 // false, implicit (unsigned int)(-1) = 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Conversion from a floating point type to an integer type drops the&lt;br /&gt;
decimal part and rounds toward 0.  If the value is outside the range&lt;br /&gt;
of the target, then the result is undefined.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int(-3.8)               // -3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Conversion of one integer type to another is performed modulo the&lt;br /&gt;
range of the target.  For a B-bit number (except bool), we add or&lt;br /&gt;
subtract 2&amp;lt;sup&amp;gt;B&amp;lt;/sup&amp;gt; to bring the value within range.  (In terms&lt;br /&gt;
of a 2's complement number, we drop the most significant bits and&lt;br /&gt;
reinterpret the sign bit without changing any bits).  For bool,&lt;br /&gt;
any nonzero value is true.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  (unsigned char)(-1)     // '\xff' (255)&lt;br /&gt;
  bool(3)                 // true&lt;br /&gt;
  short a=x12345678;      // x5678 hex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=integer&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Integer Types&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int is the most common integer type, normally the underlying word size&lt;br /&gt;
of the computer or 32 bits, representing numbers&lt;br /&gt;
from -2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt; to 2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;-1 (-2147483648 to 2147483647).&lt;br /&gt;
On some older systems such as real mode DOS, it may be 16 bits (-32768 to&lt;br /&gt;
32767).  You should use int unless you need the range of some other type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An int value may be written in decimal (e.g. 255), hexadecimal&lt;br /&gt;
with a leading X (e.g. xff or XFF) or octal (base 8) with a leading 0&lt;br /&gt;
(e.g. 0377).  A trailing L denotes long (e.g. 255L or 255l), and U denotes&lt;br /&gt;
unsigned.  These may be combined (e.g. 255lu or 255UL is unsigned long).&lt;br /&gt;
&lt;br /&gt;
Most integer operations translate to a single machine instruction&lt;br /&gt;
and are very fast.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  + - * / % -i      Add, subtract, multiply, divide, mod, unary negation&lt;br /&gt;
  =                 Assignment&lt;br /&gt;
  == != &amp;amp;lt; &amp;amp;lt;= &amp;gt; &amp;gt;=   Comparison, returns true or false&lt;br /&gt;
  ++i i++ --i i--   Pre/post increment and decrement&lt;br /&gt;
  &amp;amp; | ^ ~i &amp;amp;lt;&amp;amp;lt; &amp;gt;&amp;gt;    Bitwise and, or, xor, not, left shift, right shift&lt;br /&gt;
  += -= *= /= %= &amp;amp;= |= ^= &amp;amp;lt;&amp;amp;lt;= &amp;gt;&amp;gt;=    Operate and assign, e.g. x+=y means x=x+y&lt;br /&gt;
  &amp;amp;&amp;amp; || !i          Logical and then, or else, not&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Division rounds toward 0, e.g. 7/4 is 1, -7/4 is -1.  x%y is the remainder&lt;br /&gt;
with the sign of x, e.g. -7%4 is -3.  Division or mod by 0 is a run time&lt;br /&gt;
error and should be avoided.  Operations that yield results outside&lt;br /&gt;
the range of an int are converted modulo 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;, or more generally,&lt;br /&gt;
2&amp;lt;sup&amp;gt;B&amp;lt;/sup&amp;gt; for a B bit number.  For instance, 65535*65537 is -1, not&lt;br /&gt;
2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Assignment returns the value assigned, e.g. x=y=0 assigns 0 to y and&lt;br /&gt;
the new y to x.  The result is an lvalue, e.g. (x=y)=0 is also legal&lt;br /&gt;
(but useless).  It assigns y to x, then 0 to x.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;++i and i++ both add 1 to i.  However, ++i returns the new value,&lt;br /&gt;
and i++ returns the old value.  Likewise for decrement, --i and i--, which&lt;br /&gt;
subtracts 1.  The &amp;lt;i&amp;gt;pre&amp;lt;/i&amp;gt; forms, ++i, --i, are lvalues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Bitwise operators treat an int as a 2's compliment B-bit binary&lt;br /&gt;
number (B=32) with weights -2&amp;lt;sup&amp;gt;B-1&amp;lt;/sup&amp;gt;, 2&amp;lt;sup&amp;gt;B-2&amp;lt;/sup&amp;gt;,&lt;br /&gt;
2&amp;lt;sup&amp;gt;B-3&amp;lt;/sup&amp;gt;, ...&lt;br /&gt;
8, 4, 2, 1.  The leftmost bit is negative, and serves as the sign&lt;br /&gt;
bit.  Thus, 0 is all zero bits and -1 is all 1 bits.  Bitwise&lt;br /&gt;
operators x&amp;amp;y x|y x^y and ~x perform B simultaneous logical operations&lt;br /&gt;
on the bits of x and y.  For instance, if y is a power of 2, then&lt;br /&gt;
x&amp;amp;(y-1) has the effect x%y, but is usually faster, and the result is always&lt;br /&gt;
positive in the range 0 to y-1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;x&amp;amp;lt;&amp;amp;lt;y returns x shifted left by y places, shifting in zeros.&lt;br /&gt;
The result is x*2&amp;lt;sup&amp;gt;y&amp;lt;/sup&amp;gt;.  x&amp;gt;&amp;gt;y returns x shifted right by y places,&lt;br /&gt;
shifting in copies of the sign bit (or zeros if unsigned).&lt;br /&gt;
The result is x/2&amp;lt;sup&amp;gt;y&amp;lt;/sup&amp;gt; but&lt;br /&gt;
rounding negative instead of toward 0.  For instance, -100&amp;gt;&amp;gt;3 is -13.&lt;br /&gt;
y must be in the range 0 to B-1 (0 to 31).  Shifting is usually faster&lt;br /&gt;
than * and /.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Any binary arithmetic or bitwise operator may be combined with&lt;br /&gt;
assignment.  The result&lt;br /&gt;
is an lvalue.  e.g. &amp;lt;tt&amp;gt;(x+=2)*=3;&amp;lt;/tt&amp;gt; has the effect x=x+2; x=x*3;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Logical operators treat 0 as false and any other value as true.&lt;br /&gt;
They return true (1) or false (0), as do comparisons.  The &amp;amp;&amp;amp; and ||&lt;br /&gt;
operators do not evaluate the right operand if the result is known from&lt;br /&gt;
the left operand.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  if (i&amp;gt;=0 &amp;amp;&amp;amp; i&amp;amp;lt;n &amp;amp;&amp;amp; a[i]==x)  // Do bounds check on i before indexing array a&lt;br /&gt;
  if (x=3)                     // Legal but probably wrong, assign 3 to x and test true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=char&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A &amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt; is a one byte value.  Unlike other numeric types,&lt;br /&gt;
it prints as a character, although it can be used in arithmetic expressions.&lt;br /&gt;
Character constants are enclosed in single quotes, as &amp;lt;tt&amp;gt;'a'&amp;lt;/tt&amp;gt;.&lt;br /&gt;
A backslash has special meaning.  '\n' is a newline,&lt;br /&gt;
'\\' is a single backslash, '\'' is a single&lt;br /&gt;
quote, '\&amp;quot;' is a double quote.  A backslash may be followed by 3 octal&lt;br /&gt;
digits ('\377') or an X and 2 hex digits ('\xFF') (but not decimal).&lt;br /&gt;
Most computers use ASCII conversion as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  8-13:   \b\t\n\v\f\r  (bell, tab, newline, vertical tab, formfeed, return)&lt;br /&gt;
  32-47:   !\&amp;quot;#$%&amp;amp;amp;\'()*+,-./                 (32=space, \' and \&amp;quot; are one char)&lt;br /&gt;
  48-63:  0123456789:;&amp;amp;lt;=&amp;gt;\?                  (\? is one char)&lt;br /&gt;
  64-95:  @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_  (\\ is one char)&lt;br /&gt;
  96-126: `abcdefghijklmnopqrstuvwxyz{|}~&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=floating&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Floating Point Types&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A number with a decimal point is double (e.g. 3.7) unless a trailing&lt;br /&gt;
F is appended (e.g. 3.7f or 3.7F), in which case it is float.  Double&lt;br /&gt;
is preferred.  A double may be written in the form xey meaning&lt;br /&gt;
x*10&amp;lt;sup&amp;gt;y&amp;lt;/sup&amp;gt;, e.g. 3.7E-2 (0.037) or 1e4 (10000.0).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A double is usually represented as a 64 bit number with a sign bit,&lt;br /&gt;
an 11 bit exponent, and 52 bit mantissa.  Therefore it can only represent&lt;br /&gt;
numbers of the form M*2&amp;lt;sup&amp;gt;E&amp;lt;/sup&amp;gt; exactly, where -2&amp;lt;sup&amp;gt;52&amp;lt;/sup&amp;gt; &amp;amp;lt;&lt;br /&gt;
M &amp;amp;lt; 2&amp;lt;sup&amp;gt;52&amp;lt;/sup&amp;gt; and 2&amp;lt;sup&amp;gt;-10&amp;lt;/sup&amp;gt; &amp;amp;lt; E &amp;amp;lt; 2&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;.&lt;br /&gt;
This is about + or - 1.797e308 with about 15 decimal digits of precision.&lt;br /&gt;
Therefore, numbers like 1e14 and 0.5 have exact representations, but 1e20&lt;br /&gt;
and 0.1 do not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  0.1 * 10 == 1    // false, they differ by about 10&amp;lt;sup&amp;gt;-15&amp;lt;/sup&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There are no bitwise or logical operators, %, ++, or --&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  + - * / -x        Add, subtract, multiply, divide, unary negation (no %)&lt;br /&gt;
  = += -= *= /=     Assignment, may be combined with operators&lt;br /&gt;
  == != &amp;amp;lt; &amp;amp;lt;= &amp;gt; &amp;gt;=   Comparison, however only &amp;amp;lt; and &amp;gt; are meaningful&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Operations may produce values outside the range of a double resulting&lt;br /&gt;
in infinity, -infinity or NaN (not a number).  These values cannot&lt;br /&gt;
be written in C++.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Additional mathematical functions (sqrt(), log(), pow(), etc.) can&lt;br /&gt;
be found in &amp;amp;lt;&amp;lt;a href=#cmath&amp;gt;cmath&amp;lt;/a&amp;gt;&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=modifiers&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Modifiers&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In a declaration, modifiers before the type name apply to&lt;br /&gt;
all objects in the list.  Otherwise they apply to single objects.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int* p, q;           // p is a pointer, q is an int&lt;br /&gt;
  const int a=0, b=0;  // a and b are both const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=const&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;const&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt; objects cannot be modified once created.  They must&lt;br /&gt;
be initialized in the declaration.  By convention, const objects are&lt;br /&gt;
UPPERCASE when used globally or as parameters.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const double PI=3.14159265359;  // Assignment to PI not allowed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=references&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;References&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A reference creates an alias for an object that already exists.&lt;br /&gt;
It must be initialized.  A reference to a const object must also be const.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int i=3;&lt;br /&gt;
  int&amp;amp;amp; r=i;         // r is an alias for i&lt;br /&gt;
  r=4;              // i=4;&lt;br /&gt;
  double&amp;amp;amp; pi=PI;    // Error, would allow PI to be modified&lt;br /&gt;
  const double&amp;amp; pi=PI;  // OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=functions&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Functions&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A function has a list of parameter declarations, a return type,&lt;br /&gt;
and a block of statements.  Execution must end with a return statement&lt;br /&gt;
returning an expression that can be converted to the return type,&lt;br /&gt;
unless void, in which case there is an implied &amp;lt;tt&amp;gt;return;&amp;lt;/tt&amp;gt; at&lt;br /&gt;
the end.  Arguments passed to a function must match the parameters&lt;br /&gt;
or allow implicit conversion (such as int to double).&lt;br /&gt;
Functions must be defined before use, or&lt;br /&gt;
have a matching declaration that replaces the block with a semicolon&lt;br /&gt;
and may optionally omit parameter names.&lt;br /&gt;
Functions are always global (not defined in other functions).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  void f(double x, double); // Declaration&lt;br /&gt;
  double g() {              // Definition&lt;br /&gt;
    return 3;               // Implied conversion to double (3.0)&lt;br /&gt;
  }&lt;br /&gt;
  int main() {              // Execution starts with function main&lt;br /&gt;
    f(g(), 5);              // Calls g, then f with implicit 5.0&lt;br /&gt;
    return 0;               // Return UNIX $status or Windows ERRORLEVEL&lt;br /&gt;
  }&lt;br /&gt;
  void f(double x, double y) { // Definition must match declaration&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; x+y;&lt;br /&gt;
    return;                 // Optional&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Command line arguments may be passed to&lt;br /&gt;
&amp;lt;tt&amp;gt;main(int argc, char** argv)&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;argv&amp;lt;/tt&amp;gt; is&lt;br /&gt;
an array of &amp;lt;tt&amp;gt;argc&amp;lt;/tt&amp;gt; elements of type char* ('\0' terminated array&lt;br /&gt;
of char), one element for each word (separated by white spaces).&lt;br /&gt;
In UNIX, the command line is expanded before being passed (* becomes&lt;br /&gt;
a directory listing, etc).  The following program prints the command&lt;br /&gt;
line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // echo.cpp&lt;br /&gt;
  #include &amp;amp;lt;iostream&amp;gt;&lt;br /&gt;
  using namespace std;&lt;br /&gt;
  int main(int argc, char** argv) {&lt;br /&gt;
    for (int i=0; i&amp;amp;lt;argc; ++i)&lt;br /&gt;
      cout &amp;amp;lt;&amp;amp;lt; argv[i] &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;b&amp;gt;g++ echo.cpp&lt;br /&gt;
  ./a.out hello world&amp;lt;/b&amp;gt;&lt;br /&gt;
  ./a.out&lt;br /&gt;
  hello&lt;br /&gt;
  world&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Function parameters have local scope.  They are initialized by&lt;br /&gt;
copying the argument, which may be an expression.  Reference parameters&lt;br /&gt;
are not copied; they become references to the arguments passed, which&lt;br /&gt;
must be objects that the function may modify.  If the reference is&lt;br /&gt;
const, then the argument may be an expression.  Const reference is&lt;br /&gt;
the most common for passing large objects because it avoids the run&lt;br /&gt;
time overhead of copying.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  void assign_if(bool cond, string&amp;amp; to,  const string&amp;amp; from) {&lt;br /&gt;
              // value      reference    const reference&lt;br /&gt;
    if (cond)&lt;br /&gt;
      to=from;&lt;br /&gt;
  }&lt;br /&gt;
  int main() {&lt;br /&gt;
    string s;&lt;br /&gt;
    assign_if(true, s, &amp;quot;a&amp;quot;);   // OK, s=&amp;quot;a&amp;quot;&lt;br /&gt;
    assign_if(false, &amp;quot;b&amp;quot;, s);  // Error: to refers to a const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions returning a reference must return an object which&lt;br /&gt;
can be assigned to, and that object must exist after returning&lt;br /&gt;
(global or static, but not local).  The function may be called&lt;br /&gt;
on the left side of an assignment.  Functions returning by value&lt;br /&gt;
make a temporary copy which is const.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int  a=1;                           // Global&lt;br /&gt;
  int  f() {return a;}                // OK, returns copy of a&lt;br /&gt;
  int&amp;amp; g() {return a;}                // OK, g() is alias for a&lt;br /&gt;
  int&amp;amp; h() {return a+1;}              // Error, reference to const&lt;br /&gt;
  int&amp;amp; i() {int b; return b;}         // Error, b destroyed after return&lt;br /&gt;
  int&amp;amp; j() {static int b; return b;}  // OK, static has global lifespan&lt;br /&gt;
  int main() {&lt;br /&gt;
    f()=2;    // Error, assignment to const&lt;br /&gt;
    g()=f();  // OK, a=1;&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions with the same name may be overloaded by matching the&lt;br /&gt;
arguments to the parameters.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int abs(int);&lt;br /&gt;
  double abs(double);&lt;br /&gt;
  int main() {&lt;br /&gt;
    abs(3);    // int&lt;br /&gt;
    abs(3.0);  // double&lt;br /&gt;
    abs(&amp;quot;3&amp;quot;);  // Error, no match&lt;br /&gt;
    abs('a');  // Error, ambiguous, could convert char to int or double&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most operators X can be overloaded by defining a function named&lt;br /&gt;
&amp;lt;tt&amp;gt;operator X()&amp;lt;/tt&amp;gt; taking the operands as arguments.  At least one&lt;br /&gt;
argument has to be a class type.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string operator - (const string&amp;amp; s, int i);  // Defines s-i&lt;br /&gt;
  string operator - (const string&amp;amp; s);         // Defines -s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Operators &amp;lt;tt&amp;gt;. :: ?:&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;sizeof&amp;lt;/tt&amp;gt; cannot be overloaded.&lt;br /&gt;
Operators &amp;lt;tt&amp;gt;= [] -&amp;gt;&amp;lt;/tt&amp;gt; cannot be overloaded except as class members.&lt;br /&gt;
Postfix &amp;lt;tt&amp;gt;++ --&amp;lt;/tt&amp;gt;&lt;br /&gt;
are overloaded as binary operators with a second dummy &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;&lt;br /&gt;
parameter to distinguish from the prefix form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string&amp;amp; operator++(const string&amp;amp; s);      // defines ++s&lt;br /&gt;
  string  operator++(const string&amp;amp; s, int); // defines s++&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions may have default arguments by initializing the parameters.&lt;br /&gt;
Defaults should be specified only once.  Defaulted parameters must&lt;br /&gt;
appear after all non-default parameters.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  void f(int i, int j=0, int k=0);  // OK&lt;br /&gt;
  void g(int i=0, int j);           // Error&lt;br /&gt;
  int main() {&lt;br /&gt;
    f(1, 2);  // f(1, 2, 0);&lt;br /&gt;
    f(1);     // f(1, 0, 0);&lt;br /&gt;
    f();      // Error&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
  void f(int i, int j, int k) {}    // Defaults not specified again&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=templatefunction&amp;gt;&lt;br /&gt;
A &amp;lt;b&amp;gt;template&amp;lt;/b&amp;gt; overloads a function for all types.  The declaration&lt;br /&gt;
&amp;lt;tt&amp;gt;template &amp;amp;lt;class T, class U&amp;gt;&amp;lt;/tt&amp;gt; before a function definition&lt;br /&gt;
allows T and U to be used in the code as types.&lt;br /&gt;
The compiler will figure out appropriate substitutions&lt;br /&gt;
from the arguments.  A non-templated overloaded function takes&lt;br /&gt;
precedence over a template.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt;&lt;br /&gt;
  void swap(T&amp;amp; a, T&amp;amp; b) {&lt;br /&gt;
    T tmp=a;&lt;br /&gt;
    a=b;&lt;br /&gt;
    b=tmp;&lt;br /&gt;
  }&lt;br /&gt;
  void swap(string&amp;amp; a, string&amp;amp; b);  // Overrides the case T=string&lt;br /&gt;
  int main() {&lt;br /&gt;
    int i=1, j=2;&lt;br /&gt;
    string a, b;&lt;br /&gt;
    swap(i, j);        // OK, T is int&lt;br /&gt;
    swap(a, b);        // OK, calls non-templated swap&lt;br /&gt;
    swap(i, a);        // Error, cannot resolve T&lt;br /&gt;
    swap(cout, cerr);  // Error, ostream does not allow =&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;inline&amp;lt;/tt&amp;gt; is a hint to the compiler to optimize for speed&lt;br /&gt;
by expanding the code where it is called, saving a call and return&lt;br /&gt;
instruction.  Unlike a macro, semantics are preserved.&lt;br /&gt;
Only short functions should be inlined.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  inline int min1(int a, int b) {return a&amp;amp;ltb?a:b;}&lt;br /&gt;
  #define min2(a,b) ((a)&amp;amp;lt;(b)?(a):(b))&lt;br /&gt;
  int main() {&lt;br /&gt;
    min1(f(), 0);  // calls f() once&lt;br /&gt;
    min2(f(), 0);  // calls f() twice, expands to ((f())&amp;amp;lt;(0)?(f()):(0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=pointers&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Pointers&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A pointer stores the address of another object, and unlike a reference,&lt;br /&gt;
may be moved to point elsewhere.  The expression &amp;lt;tt&amp;gt;&amp;amp;amp;x&amp;lt;/tt&amp;gt; means &amp;quot;address of&lt;br /&gt;
x&amp;quot; and has type &amp;quot;pointer to x&amp;quot;.  If &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; has type &amp;lt;tt&amp;gt;T&amp;lt;/tt&amp;gt;,&lt;br /&gt;
then &amp;lt;tt&amp;gt;&amp;amp;x&amp;lt;/tt&amp;gt; has type &amp;lt;tt&amp;gt;T*&amp;lt;/tt&amp;gt;.&lt;br /&gt;
If &amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt; has type &amp;lt;tt&amp;gt;T*&amp;lt;/tt&amp;gt;, then &amp;lt;tt&amp;gt;*p&amp;lt;/tt&amp;gt; is the object&lt;br /&gt;
to which it points, which has type &amp;lt;tt&amp;gt;T&amp;lt;/tt&amp;gt;.&lt;br /&gt;
The * and &amp;amp; operators are inverses, e.g. &amp;lt;tt&amp;gt;*&amp;amp;x == x&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Two pointers are equal if they point to the same object.&lt;br /&gt;
All pointer types are distinct,&lt;br /&gt;
and can only be assigned pointers of the same type or 0 (NULL).&lt;br /&gt;
There are no run time checks against reading or writing the contents&lt;br /&gt;
of a pointer to invalid memory.  This usually causes a segmentation&lt;br /&gt;
fault or general protection fault.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int i=3, *p=&amp;amp;amp;i;    // p points to i, *p == 3&lt;br /&gt;
  *p=5;              // i=5&lt;br /&gt;
  p=new int(6);      // OK, p points to an int with value 6&lt;br /&gt;
  p=new char('a');   // Error, even though char converts to int&lt;br /&gt;
  p=6;               // Error, no conversion from int to pointer&lt;br /&gt;
  p=0;               // OK&lt;br /&gt;
  p=i-5;             // Error, compiler can't know this is 0&lt;br /&gt;
  *p=7;              // Segmentation fault: writing to address 0&lt;br /&gt;
  int *q; *q;        // Segmentation fault: q is not initialized, reading random memory&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A pointer to a const object of type T must also be const, of&lt;br /&gt;
type &amp;lt;tt&amp;gt;const T*&amp;lt;/tt&amp;gt;, meaning that the pointer may be assigned to&lt;br /&gt;
but its contents may not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const double PI=3.1415926535898;&lt;br /&gt;
  double* p=&amp;amp;amp;PI;              // Error, would allow *p=4 to change PI&lt;br /&gt;
  const double* p=&amp;amp;amp;PI;        // OK, can't assign to *p (but may assign to p)&lt;br /&gt;
  double* const p=&amp;amp;amp;PI;        // Error, may assign to *p (but not to p)&lt;br /&gt;
  const double* const p=&amp;amp;amp;PI;  // OK, both *p and p are const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A function name used without parenthesis is a pointer to a function.&lt;br /&gt;
Function pointers can be assigned values and called.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int f(double);     // functions f and g take double and return int&lt;br /&gt;
  int g(double);&lt;br /&gt;
  int *h(double);    // function h takes double and returns pointer to int&lt;br /&gt;
  int (*p)(double);  // p is a pointer to a function that takes double and returns int&lt;br /&gt;
  int main() {&lt;br /&gt;
    p=f; p(3.0);     // calls f(3.0)&lt;br /&gt;
    p=g; p(3.0);     // calls g(3.0)&lt;br /&gt;
    p=h;             // Error, type mismatch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Explicit pointer conversions are allowed but usually unsafe.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int i, *p=&amp;amp;i;&lt;br /&gt;
  i=int(3.0);        // OK, rounds 3.0&lt;br /&gt;
  *(double*)p = 3.0; // Crash, writes beyond end of i&lt;br /&gt;
  *(double*)&amp;amp;PI = 4; // Overwrites a const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
These may also be written (with the same results):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  i=static_cast&amp;amp;lt;int&amp;gt;(3.0);            // Apply standard conversions&lt;br /&gt;
  *reinterpret_cast&amp;amp;lt;double*&amp;gt;p = 3.0;  // Pretend p has type double*&lt;br /&gt;
  *const_cast&amp;amp;lt;double*&amp;gt;&amp;amp;amp;PI = 4;        // Same type except for const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=arrays&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Arrays&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The size of an array must be specified by a constant, and may be left&lt;br /&gt;
blank if the array is initialized from a list.  Array bounds&lt;br /&gt;
start at 0.  There are no run time checks on array bounds.&lt;br /&gt;
Multi-dimensional arrays use a separate bracket for each dimension.&lt;br /&gt;
An array name used without brackets is a pointer to the first element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a[]={0,1,2,3,4};    // Array with elements a[0] to a[4]&lt;br /&gt;
  int b[5]={6,7};         // Implied ={6,7,0,0,0};&lt;br /&gt;
  int c[5];               // Not initialized, c[0] to c[4] could have any values&lt;br /&gt;
  int d[2][3]={{1,2,3},{4,5,6}};  // Initialized 2-D array&lt;br /&gt;
  int i=d[1][2];          // 6&lt;br /&gt;
  d[-1][7]=0;             // Not checked, program may crash&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The bare name of an array is a const pointer to the first element.  If&lt;br /&gt;
p is a pointer to an array element, then p+i points i elements ahead,&lt;br /&gt;
to p[i].  By definition, p[i] is *(p+i).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a[5];               // a[0] through a[4]&lt;br /&gt;
  int* p=a+2;             // *p is a[2]&lt;br /&gt;
  p[1];                   // a[3]&lt;br /&gt;
  p-a;                    // 2&lt;br /&gt;
  p&amp;gt;a;                    // true because p-a &amp;gt; 0&lt;br /&gt;
  p-1 == a+1              // true, both are &amp;amp;a[1]&lt;br /&gt;
  *a;                     // a[0] or p[-2]&lt;br /&gt;
  a=p;                    // Error, a is const (but not *a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A literal string enclosed in double quotes is an unnamed static array of&lt;br /&gt;
const char with an implied '\0' as the last element.  It may be used either to&lt;br /&gt;
initialize an array of char, or in an expression as a pointer to the&lt;br /&gt;
first char.  Special chars in literals may be escaped with a  backslash&lt;br /&gt;
as before.  Literal strings are concatenated without a + operator&lt;br /&gt;
(convenient to span lines).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  char s[]=&amp;quot;abc&amp;quot;;                       // char s[4]={'a','b','c','\0'};&lt;br /&gt;
  const char* p=&amp;quot;a&amp;quot; &amp;quot;b\n&amp;quot;;              // Points to the 'a' in the 4 element array &amp;quot;ab\n\0&amp;quot;&lt;br /&gt;
  const char* answers[2]={&amp;quot;no&amp;quot;,&amp;quot;yes&amp;quot;};  // Array of pointers to char&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; answers[1];                   // prints yes (type const char*)&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; answers[1][0];                // prints y (type const char)&lt;br /&gt;
  &amp;quot;abc&amp;quot;[1]                              // 'b'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays do not support copying, assignment, or comparison.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a[5], b[5]=a;       // Error: can't initialize b this way&lt;br /&gt;
  b=a;                    // Error: can't assign arrays&lt;br /&gt;
  b==a;                   // false, comparing pointers, not contents&lt;br /&gt;
  &amp;quot;abc&amp;quot;==&amp;quot;abc&amp;quot;            // false, comparing pointers to 2 different locations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size of an array created with &amp;lt;tt&amp;gt;new[]&amp;lt;/tt&amp;gt; may be an expression.  The&lt;br /&gt;
elements cannot be initialized with a list.  There is no run time check&lt;br /&gt;
against accessing deleted elements.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int n, *p;&lt;br /&gt;
  cin &amp;gt;&amp;gt; n;&lt;br /&gt;
  p=new int[n];  // Elements p[0] to p[n-1] with values initially undefined&lt;br /&gt;
  delete[] p;    // Use delete with new or new(), delete[] with new[]&lt;br /&gt;
  p[0] = 1;      // May crash&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=static&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;static&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Normally, objects are placed on the stack.  Memory is allocated&lt;br /&gt;
by growing the stack at the top; thus objects are destroyed in&lt;br /&gt;
the reverse order in which they are created.  An object's life span&lt;br /&gt;
is the same as its scope.  If an object comes into scope more than once,&lt;br /&gt;
then it is reinitialized each time, and destroyed when leaving its scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  +----------+&lt;br /&gt;
  |          |&lt;br /&gt;
  |   Heap   |  Allocated with &amp;lt;i&amp;gt;new&amp;lt;/i&amp;gt; until deleted or program exits.&lt;br /&gt;
  |          |&lt;br /&gt;
  +^^^^^^^^^^+  &lt;br /&gt;
  |   Stack  |  Local objects, parameters, temporaries, function return addresses.&lt;br /&gt;
  +----------+     +---------+&lt;br /&gt;
  |   Data   | &amp;amp;lt;-- |  Data   |  Initial values for static and global objects.&lt;br /&gt;
  +----------+     +---------+&lt;br /&gt;
  |   Code   | &amp;amp;lt;-- |  Code   |  Executable machine instructions.&lt;br /&gt;
  +----------+     +---------+  (Cannot be read or written by program.)&lt;br /&gt;
  | Reserved |    a.out on disk&lt;br /&gt;
  | for OS   |&lt;br /&gt;
  | and other|  Cannot be read or written by program, will cause segmentation&lt;br /&gt;
  | programs |  fault or general protection fault.&lt;br /&gt;
  +----------+&lt;br /&gt;
     Memory&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;static&amp;lt;/tt&amp;gt; objects are placed in the data segment.  They are&lt;br /&gt;
initialized from values stored in the executable file, and therefore&lt;br /&gt;
these values must be known at compile time.  Initialization occurs only&lt;br /&gt;
once.  Values are maintained when the object is out of scope (e.g.&lt;br /&gt;
between function calls), and it is safe to return a pointer or reference&lt;br /&gt;
to them.  Numeric values not explicitly initialized are set to 0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int&amp;amp; f() {        // Return by reference, f() is an alias for s, not a temporary copy&lt;br /&gt;
    static int s=1; // Initialized only once&lt;br /&gt;
    ++s;&lt;br /&gt;
    return s;       // Safe to return by reference&lt;br /&gt;
  }&lt;br /&gt;
  int main() {&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; f();    // 2&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; f();    // 3&lt;br /&gt;
    f()=5;          // OK, s=5;&lt;br /&gt;
    s=6;            // Error, s is not in scope&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=register&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;lt;tt&amp;gt;register&amp;lt;/tt&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
(Rare) A hint to the compiler to optimize an int or pointer for speed.&lt;br /&gt;
It is no longer used because most optimizers can do a better job.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  register int x;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=volatile&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;lt;tt&amp;gt;volatile&amp;lt;/tt&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
(Rare) Indicates that an object might be modified from outside the&lt;br /&gt;
program (e.g. a hardware input port) and that the optimizer should not&lt;br /&gt;
make copies of it.  Its use is machine dependent.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const volatile unsigned short&amp;amp; port=*(const short*)0xfffe; // 16 bit port at address xfffe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=standardlibrarytypes&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Standard Library Types&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Standard library types (string, vector, map...) and objects&lt;br /&gt;
(cin, cout...) require a&lt;br /&gt;
&amp;lt;tt&amp;gt;#include &amp;amp;lt;&amp;lt;i&amp;gt;header&amp;lt;/i&amp;gt;&amp;amp;gt;&amp;lt;/tt&amp;gt; and must be extracted from&lt;br /&gt;
namespace &amp;lt;tt&amp;gt;std&amp;lt;/tt&amp;gt;, either with a &amp;lt;tt&amp;gt;using namespace std;&amp;lt;/tt&amp;gt;&lt;br /&gt;
statement or by using the fully qualified names preceded with &amp;lt;tt&amp;gt;std::&amp;lt;/tt&amp;gt;,&lt;br /&gt;
as in &amp;lt;tt&amp;gt;std::cout&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #include &amp;amp;lt;iostream&amp;gt;                    #include &amp;amp;lt;iostream&amp;gt;&lt;br /&gt;
  int main() {                           using namespace std;&lt;br /&gt;
    std::cout &amp;amp;lt;&amp;amp;lt; &amp;quot;Hello\n&amp;quot;;              int main() {&lt;br /&gt;
    return 0;                              cout &amp;amp;lt;&amp;amp;lt; &amp;quot;Hello\n&amp;quot;;&lt;br /&gt;
  }                                        return 0;&lt;br /&gt;
                                        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=iostream&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;iostream&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The header &amp;amp;lt;iostream&amp;gt; defines global object &amp;lt;tt&amp;gt;cin&amp;lt;/tt&amp;gt; of&lt;br /&gt;
type &amp;lt;tt&amp;gt;istream&amp;lt;/tt&amp;gt;, and global objects &amp;lt;tt&amp;gt;cout, cerr, clog&amp;lt;/tt&amp;gt;&lt;br /&gt;
of type &amp;lt;tt&amp;gt;ostream&amp;lt;/tt&amp;gt;.  &amp;lt;tt&amp;gt;cin&amp;lt;/tt&amp;gt; represents standard input,&lt;br /&gt;
normally the keyboard, unless redirected to a file or piped on the&lt;br /&gt;
command line.  &amp;lt;tt&amp;gt;cout&amp;lt;/tt&amp;gt; represents standard output, which is&lt;br /&gt;
normally the screen unless redirected or piped.  Writing to&lt;br /&gt;
&amp;lt;tt&amp;gt;cerr&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;clog&amp;lt;/tt&amp;gt; both write to the screen even if output&lt;br /&gt;
is redirected.  The difference is that writing a newline ('\n') flushes&lt;br /&gt;
any buffered output to &amp;lt;tt&amp;gt;cerr&amp;lt;/tt&amp;gt; but not to &amp;lt;tt&amp;gt;cout&amp;lt;/tt&amp;gt; or&lt;br /&gt;
&amp;lt;tt&amp;gt;clog&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In the following, &amp;lt;tt&amp;gt;in&amp;lt;/tt&amp;gt; is an istream (cin),&lt;br /&gt;
&amp;lt;tt&amp;gt;out&amp;lt;/tt&amp;gt; is an ostream (cout, cerr, clog), i is int, c is char, and cp is char*.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  in &amp;gt;&amp;gt; x;               // Read 1 word to numeric, string, or char* x, return in&lt;br /&gt;
  in.get();              // Read 1 char (0-255) or EOF (-1) as an int&lt;br /&gt;
  in.get(c);             // Read 1 char into c, return in&lt;br /&gt;
  in.unget();            // Put back last char read, return in&lt;br /&gt;
  in.getline(cp, i);     // Read up to i chars into char cp[i] or until '\n', return in&lt;br /&gt;
  in.getline(cp, i, c);  // Read to c instead of '\n', return in&lt;br /&gt;
  getline(in, s);        // Read up to '\n' into string s, return in&lt;br /&gt;
  in.good();             // true if no error or EOF&lt;br /&gt;
  bool(in);              // in.good();&lt;br /&gt;
  in.bad();              // true if unexpected char in formatted input&lt;br /&gt;
  in.clear();            // Allow more input after bad, or throw an ios::failure&lt;br /&gt;
  in.eof();              // true if end of file&lt;br /&gt;
  in.fail();             // true if system input error&lt;br /&gt;
&lt;br /&gt;
  out &amp;amp;lt;&amp;amp;lt; x;                // Formatted output, redirected with &amp;gt;&lt;br /&gt;
  out &amp;amp;lt;&amp;amp;lt; endl;             // Print '\n' and flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Input with &amp;amp;gt;&amp;amp;gt; reads a contiguous sequence of non-whitespace&lt;br /&gt;
characters.  If x is numeric and the next word contains invalid&lt;br /&gt;
characters (such as &amp;quot;1.5&amp;quot; or &amp;quot;foo&amp;quot; for an int), then the first&lt;br /&gt;
offending character remains unread, in.bad() is set, and no further&lt;br /&gt;
input can occur until in.clear() is called.  Input into a char*&lt;br /&gt;
array is not bounds checked.  Input returns the istream to allow&lt;br /&gt;
chaining, and has a conversion to bool to test for success.  Output&lt;br /&gt;
also returns the ostream to allow chaining.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Read and print pairs of strings and ints until something goes wrong&lt;br /&gt;
  // Input:  hi 3 there 5 this is 1 test&lt;br /&gt;
  // Output: hi 3&lt;br /&gt;
             there 5&lt;br /&gt;
&lt;br /&gt;
  string s; int i;&lt;br /&gt;
  while (cin &amp;gt;&amp;gt; s &amp;gt;&amp;gt; i)&lt;br /&gt;
    cout &amp;lt;&amp;lt; s &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cin.clear();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The get() methods read one character&lt;br /&gt;
including whitespace.  The various getline() functions read up through&lt;br /&gt;
the next newline character and discard the newline.&lt;br /&gt;
The methods &amp;lt;tt&amp;gt;good(), bad(), eof(), fail(), clear()&amp;lt;/tt&amp;gt;, and&lt;br /&gt;
implicit conversion to bool are available in &amp;lt;tt&amp;gt;ostream&amp;lt;/tt&amp;gt;,&lt;br /&gt;
just as in &amp;lt;tt&amp;gt;istream&amp;lt;/tt&amp;gt;, but are seldom used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=iomanip&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;iomanip&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Defines manipulators for formatted output of numeric types.&lt;br /&gt;
They have no effect on strings.  &amp;lt;tt&amp;gt;setw()&amp;lt;/tt&amp;gt; applies only to the&lt;br /&gt;
next object printed, but the others remain in effect until changed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  out &amp;amp;lt;&amp;amp;lt; setw(i);          // Pad next output to i chars, then back to 0&lt;br /&gt;
  out &amp;amp;lt;&amp;amp;lt; setfill(c);       // Pad with c (default ' ')&lt;br /&gt;
  out &amp;amp;lt;&amp;amp;lt; setprecision(i);  // Use i significant digits for all float, double&lt;br /&gt;
&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; setw(6) &amp;amp;lt;&amp;amp;lt; setprecision(3) &amp;amp;lt;&amp;amp;lt; setfill('0') &amp;amp;lt;&amp;amp;lt; 3.1; // print &amp;quot;003.10&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=fstream&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;fstream&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Defines types &amp;lt;tt&amp;gt;ifstream&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;ofstream&amp;lt;/tt&amp;gt; representing&lt;br /&gt;
input and output files respectively.&lt;br /&gt;
&amp;lt;tt&amp;gt;ifstream&amp;lt;/tt&amp;gt; is derived from &amp;lt;tt&amp;gt;istream&amp;lt;/tt&amp;gt;,&lt;br /&gt;
inheriting all its operations (such as &amp;gt;&amp;gt;).  In addition,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ifstream in(cp);          // Open file named cp for reading&lt;br /&gt;
  ifstream in(cp, ios::in | ios::binary);  // Open in binary mode&lt;br /&gt;
  bool(in);                 // true if open successful&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;cp&amp;lt;/tt&amp;gt; is the file name.  It must be a char*, not string (use&lt;br /&gt;
&amp;lt;tt&amp;gt;s.c_str()&amp;lt;/tt&amp;gt; to convert string &amp;lt;tt&amp;gt;s&amp;lt;/tt&amp;gt;).&lt;br /&gt;
Input is normally in text mode.  In Windows, carriage returns ('\r') are&lt;br /&gt;
discarded, and an ASCII 26 ('\032') signals end of file.  In binary&lt;br /&gt;
mode and in UNIX, no such translation occurs.  The file is closed&lt;br /&gt;
when the ifstream is destroyed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  {&lt;br /&gt;
    ifstream f(&amp;quot;input.dat&amp;quot;, ios::in | ios::binary);&lt;br /&gt;
    if (!f)&lt;br /&gt;
      cerr &amp;amp;lt;&amp;amp;lt; &amp;quot;File not found\n&amp;quot;;&lt;br /&gt;
    else {&lt;br /&gt;
      int i=f.get();  // First byte or EOF if empty&lt;br /&gt;
    }&lt;br /&gt;
  } // f closed here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;ofstream&amp;lt;/tt&amp;gt; is derived from &amp;lt;tt&amp;gt;ostream&amp;lt;/tt&amp;gt;,&lt;br /&gt;
inheriting all its operations (such as &amp;amp;lt;&amp;amp;lt;).  In addition,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ofstream os(cp);          // Open file named cp for writing&lt;br /&gt;
  ofstream os(cp, ios::out | ios::binary);  // Open in binary mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;In text mode in Windows, writing '\n' actually writes &amp;quot;\r\n&amp;quot;.&lt;br /&gt;
The file named cp is overwritten if it exists, or created otherwise.&lt;br /&gt;
The file is flushed and closed when the ofstream is destroyed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=string&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;string&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt; is like an array of char, but it also supports&lt;br /&gt;
copying, assignment, and comparison, and its size may be set or changed&lt;br /&gt;
at run time.&lt;br /&gt;
'\0' has no special meaning.  There is implicit conversion from char*&lt;br /&gt;
to string in mixed type expressions.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string()           // Empty string&lt;br /&gt;
  string(cp)         // Convert char* cp to string&lt;br /&gt;
  string(n, c)       // string of n copies of char c&lt;br /&gt;
  s=s2               // Assign char* or string s2 to string s&lt;br /&gt;
  s1&amp;amp;lt;s2              // Also ==, !=, &amp;gt;, &amp;amp;lt;=, &amp;amp;gt;=, either s1 or s2 may be char*&lt;br /&gt;
  s.size()           // Length of string s&lt;br /&gt;
  string::size_type  // Type of s.size(), usually unsigned int&lt;br /&gt;
  s.empty()          // True if s.size() == 0&lt;br /&gt;
  s[i]               // i'th char, 0 &amp;lt;= i &amp;lt; s.size() (unchecked), may be assigned to&lt;br /&gt;
  s.at(i)            // s[i] with bounds check, throws out_of_range&lt;br /&gt;
  s1+s2              // Concatenate strings, either s1 or s2 may be char or char*&lt;br /&gt;
  s+=s2              // Append string, char, or char* s2 to string s&lt;br /&gt;
  s.c_str()          // string s as a const char* with trailing '\0'&lt;br /&gt;
  s.substr(i, j)     // Substring of string s of length j starting at s[i]&lt;br /&gt;
  s.substr(i)        // Substring from s[i] to the end&lt;br /&gt;
  s.find(s2)         // Index of char, char*, or string s2 in s, or string::npos if not found&lt;br /&gt;
  s.rfind(s2)        // Index of last occurrence of s2 in s&lt;br /&gt;
  s.find_first_of(s2)     // Index of first char in s that occurs in s2&lt;br /&gt;
  s.find_last_of(s2)      // Index of last char in s that occurs in s2&lt;br /&gt;
  s.find_first_not_of(s2) // Index of first char in s not found in s2&lt;br /&gt;
  s.find_last_not_of(s2)  // Index of last char in s not found in s2&lt;br /&gt;
  s.replace(i, j, s2)     // Replace s.substr(i, j) with s2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;s.size()&amp;lt;/tt&amp;gt; should be converted to &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;&lt;br /&gt;
to avoid unsigned comparison.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string s(3,'a');   // &amp;quot;aaa&amp;quot;&lt;br /&gt;
  s += &amp;quot;b&amp;quot;+s;        // &amp;quot;aaabaaa&amp;quot;&lt;br /&gt;
  for (int i=0; i!=int(s.size()); ++i) {  // print s one char at a time&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; s[i];&lt;br /&gt;
  s.size() &amp;gt; -1;     // false!  -1 is converted to unsigned&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt; supports standard container operations with regard to&lt;br /&gt;
iterators.  &amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt; iterators are random, supporting all the&lt;br /&gt;
pointer operators of &amp;lt;tt&amp;gt;char*&amp;lt;/tt&amp;gt;.  The notation &amp;lt;tt&amp;gt;[b,e)&amp;lt;/tt&amp;gt; means&lt;br /&gt;
the sequence such that pointer or iterator b points to the first element&lt;br /&gt;
and e points one past the last element.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  s.begin()          // Iterator pointing to s[0]&lt;br /&gt;
  s.end()            // Iterator pointing 1 past last char&lt;br /&gt;
  string::iterator   // Iterator type, like char*&lt;br /&gt;
  string::const_iterator  // Type if s is const, like const char*&lt;br /&gt;
  string(b, e)       // string initialized from sequence [b,e)&lt;br /&gt;
  s.erase(b)         // Remove char in s pointed to by b&lt;br /&gt;
  s.erase(b, e)      // Remove substring [b,e) from s&lt;br /&gt;
  s.replace(b, e, s2)  // Replace substring [b,e) with string s2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Conversion from &amp;lt;tt&amp;gt;iterator&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;const_iterator&amp;lt;/tt&amp;gt; is&lt;br /&gt;
allowed, but not the other way.  &amp;lt;tt&amp;gt;const_iterator&amp;lt;/tt&amp;gt; should be&lt;br /&gt;
used if the string is not going to be modified.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  char* cp=&amp;quot;ABCDE&amp;quot;;&lt;br /&gt;
  string s(cp, cp+5); // &amp;quot;ABCDE&amp;quot;&lt;br /&gt;
  string s2(s.begin()+1, s.end()-1);  // &amp;quot;BCD&amp;quot;&lt;br /&gt;
  for (string::const_iterator p=s.begin(); p!=s.end(); ++p)  // Print s one char at a time&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; *p;       // or p[0] &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As with arrays and pointers, indexing and iterator dereferencing are&lt;br /&gt;
not checked at run time.  Creating a string with a negative or very&lt;br /&gt;
large size is also trouble.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string s(-1, 'x');              // Crash, negative size&lt;br /&gt;
  string s2(s.end(), s.begin());  // Crash, negative size&lt;br /&gt;
  s[-1]='x';                      // Crash, out of bounds&lt;br /&gt;
  *s.end()='x';                   // Crash, out of bounds&lt;br /&gt;
  string::iterator p; *p='x';     // Crash, dereferencing uninitialized iterator&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=vector&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;vector&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;vector&amp;amp;lt;T&amp;gt;&amp;lt;/tt&amp;gt; is like an array of T, but supports copying,&lt;br /&gt;
assignment, and comparison.  Its size can be set and changed at run&lt;br /&gt;
time, and it can efficiently implement a stack (O(1) time to push or pop).&lt;br /&gt;
It has random iterators like &amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt;, which behave like type T*&lt;br /&gt;
(or const T* if the vector is const).  If T is numeric, elements are&lt;br /&gt;
initialized to 0.  It is not possible to have an initialization list&lt;br /&gt;
such as {1,2,3}.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;()            // Empty vector, elements of type T&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;(n)           // n elements, default initialized&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;(n, x)        // n elements each initialized to x&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt; v2=v;        // Copy v to v2&lt;br /&gt;
  v2=v;                  // Assignment&lt;br /&gt;
  v2&amp;amp;lt;v                   // Also &amp;gt;, ==, !=, &amp;amp;lt;=, &amp;amp;gt;= if defined for T&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;(b, e)        // Initialize to sequence [b, e)&lt;br /&gt;
  v.size()               // n&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;::size_type   // Type of v.size(), usually unsigned int&lt;br /&gt;
  v.empty()              // true if v.size() == 0&lt;br /&gt;
  v[i]                   // i'th element, 0 &amp;lt;= i &amp;lt; v.size() (unchecked), may be assigned to&lt;br /&gt;
  v.at(i)                // v[i] with bounds check, throws out_of_range&lt;br /&gt;
  v.begin(), v.end()     // Iterators [b, e)&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;::iterator    // Iterator type, also const_iterator&lt;br /&gt;
  v.back()               // v[v.size()-1] (unchecked if empty)&lt;br /&gt;
  v.push_back(x)         // Increase size by 1, copy x to last element&lt;br /&gt;
  v.pop_back()           // Decrease size by 1 (unchecked if empty)&lt;br /&gt;
  v.front()              // v[0] (unchecked)&lt;br /&gt;
  v.resize(n)            // Change size to n &amp;gt;= 0 (unchecked)&lt;br /&gt;
  v.insert(d, x)         // Insert x in front of iterator d, shift, increase size by 1&lt;br /&gt;
  v.insert(d, n, x)      // Insert n copies of x in front of d&lt;br /&gt;
  v.insert(d, b, e)      // Insert copy of [b, e) in front of d&lt;br /&gt;
  v.erase(d)             // Remove *d, shift, decrease size by 1&lt;br /&gt;
  v.erase(d, e)          // Remove subsequence [d, e)&lt;br /&gt;
  v.clear()              // v.erase(v.begin(), v.end())&lt;br /&gt;
  v.reserve(n)           // Anticipate that v will grow to size n &amp;gt;= v.size()&lt;br /&gt;
  v.capacity()           // Reserved size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For insert and erase, d and e must point into v (and d &amp;amp;lt;= e) or&lt;br /&gt;
the program may crash.  Elements from *d to the end are shifted and&lt;br /&gt;
the size is changed as needed.  Saved copies of iterators may become invalid&lt;br /&gt;
after any change of size or capacity (not checked).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;To implement &amp;lt;tt&amp;gt;push_back()&amp;lt;/tt&amp;gt; efficiently, a vector typically&lt;br /&gt;
doubles the reserved space when it runs out in order to minimize&lt;br /&gt;
memory reallocation and copying.  &amp;lt;tt&amp;gt;reserve()&amp;lt;/tt&amp;gt; allows this&lt;br /&gt;
strategy to be optimized.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Read words from input into a stack, print in reverse order&lt;br /&gt;
  string s;&lt;br /&gt;
  vector&amp;amp;lt;string&amp;gt; v;&lt;br /&gt;
  while (cin &amp;gt;&amp;gt; s)&lt;br /&gt;
    v.push_back(s);&lt;br /&gt;
  while (!v.empty()) {&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; v.back() &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
    v.pop_back();&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=deque&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;deque&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;deque&amp;lt;/tt&amp;gt; (double ended queue) is just like a vector, but&lt;br /&gt;
optimized for adding and removing elements at either end in O(1) time.&lt;br /&gt;
It lacks &amp;lt;tt&amp;gt;reserve()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;capacity()&amp;lt;/tt&amp;gt; and adds&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  v.push_front(x)        // v.insert(v.begin(), x)&lt;br /&gt;
  v.pop_front()          // v.erase(v.begin())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=list&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;list&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt; is like a deque but optimized for insert and erase at&lt;br /&gt;
any point at the cost of random access.  It lacks [] (indexing),&lt;br /&gt;
and its iterators are &amp;lt;i&amp;gt;bidirectional&amp;lt;/i&amp;gt;, not supporting [], +, -,&lt;br /&gt;
&amp;amp;lt;, &amp;gt;, &amp;amp;lt;=, or &amp;gt;=.  &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt; adds&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  v.splice(d, v2, b);  // Move *b from list v2 to in front of d in v&lt;br /&gt;
  v.splice(d, v2);     // Move all elements of list v2 to in front of d in v&lt;br /&gt;
  v.splice(d, v2, b, e); // Move [b,e) in v2 to in front of d at v&lt;br /&gt;
  v.remove(x);         // Remove all elements equal to x&lt;br /&gt;
  v.remove_if(f);      // Remove elements x where f(x) is true&lt;br /&gt;
  v.sort();            // Sort list&lt;br /&gt;
  v.sort(f);           // Sort list using function bool f(x,y) instead of x &amp;amp;lt; y&lt;br /&gt;
  v.merge(v2);         // Merge sorted list v2 into sorted list v&lt;br /&gt;
  v.merge(v2, f);      // Merge using f(x,y) instead of x &amp;amp;lt; y to sort v&lt;br /&gt;
  v.unique();          // Remove duplicates from sorted list&lt;br /&gt;
  v.unique(f);         // Use f(x,y) instead of x == y&lt;br /&gt;
  v.reverse();         // Reverse order of elements&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Iterators can only be moved one element at a time using ++ or --, and&lt;br /&gt;
compared using == or !=.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  char* cp=&amp;quot;ABCDE&amp;quot;;&lt;br /&gt;
  list&amp;amp;lt;char&amp;gt; v(cp, cp+5);  // v.size() is 5&lt;br /&gt;
  for (list&amp;amp;lt;char&amp;gt;::const_iterator p=v.begin(); p!=v.end(); ++p)  // Print ABCDE&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; *p;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=map&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;map&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;map&amp;amp;lt;K,V&amp;gt; m&amp;lt;/tt&amp;gt; is a set of key-value pairs with unique, sorted&lt;br /&gt;
keys of type K and values of type V.  m[k] efficiently (O(log n) time)&lt;br /&gt;
returns the value associated with k (as an lvalue), or creates a default&lt;br /&gt;
value (0 if V is numeric) if k is used for the first time.&lt;br /&gt;
A map iterator points to a &amp;lt;tt&amp;gt;pair&amp;amp;lt;const K, V&amp;gt;&amp;lt;/tt&amp;gt;, which has&lt;br /&gt;
members &amp;lt;tt&amp;gt;first&amp;lt;/tt&amp;gt; of type const K and &amp;lt;tt&amp;gt;second&amp;lt;/tt&amp;gt; of type V.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  pair&amp;amp;lt;K,V&amp;gt; x(k,v);    // Create a pair x containing copies of k and v&lt;br /&gt;
  x.first              // k&lt;br /&gt;
  x.second             // v&lt;br /&gt;
  x=make_pair(k,v)     // x.first=k; x.second=v;&lt;br /&gt;
&lt;br /&gt;
  map&amp;amp;lt;K,V&amp;gt; m;          // map sorted by &amp;amp;lt; on K&lt;br /&gt;
  map&amp;amp;lt;K,V,f&amp;gt;()         // map sorted by f(x,y) instead of x&amp;amp;lt;y on K&lt;br /&gt;
  m[k]=v;              // Associate v (type V) with unique key k of type K&lt;br /&gt;
  m[k]                 // Retrieve v, or associate V() with k if new&lt;br /&gt;
  m.size()             // Number of unique keys&lt;br /&gt;
  m.empty()            // true if m.size() == 0&lt;br /&gt;
  map&amp;amp;lt;K,V&amp;gt;::iterator   // bidirectional, points to a pair&amp;amp;lt;const K, V&amp;gt;&lt;br /&gt;
  map&amp;amp;lt;K,V&amp;gt;::const_iterator   // points to a pair&amp;amp;lt;const K, const V&amp;gt;&lt;br /&gt;
  m.begin()            // Points to first pair (lowest k)&lt;br /&gt;
  m.end()              // Points 1 past last pair&lt;br /&gt;
  m.find(k)            // Points to pair containing k or m.end() if not found&lt;br /&gt;
  m.erase(k)           // Remove key K and its associated value&lt;br /&gt;
  m.erase(b)           // Remove pair pointed to by iterator b&lt;br /&gt;
  m.erase(b, e)        // Remove sequence [b, e)&lt;br /&gt;
  m.clear()            // Make empty: m.erase(m.begin(), m.end())&lt;br /&gt;
  m==m2                // Compare maps, also !=, &amp;amp;lt;, &amp;amp;lt;=, &amp;gt;, &amp;gt;=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We use &amp;lt;tt&amp;gt;m.find(k)&amp;lt;/tt&amp;gt; rather than m[k] when we wish to look up k&lt;br /&gt;
without increasing the size of m if k is not found.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Read words, print an alphabetical index of words with their counts&lt;br /&gt;
  string s;&lt;br /&gt;
  map&amp;amp;lt;string, int&amp;gt; m;&lt;br /&gt;
  while (cin &amp;gt;&amp;gt; s)&lt;br /&gt;
    ++m[s];&lt;br /&gt;
  for (map&amp;amp;lt;string, int&amp;gt;::const_iterator p=m.begin(); p!=m.end(); ++p)&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; p-&amp;gt;first &amp;amp;lt;&amp;amp;lt; &amp;quot; &amp;quot; &amp;amp;lt;&amp;amp;lt; p-&amp;gt;second &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;multimap&amp;lt;/tt&amp;gt; is a &amp;lt;tt&amp;gt;map&amp;lt;/tt&amp;gt; that allows duplicate keys.&lt;br /&gt;
It support all &amp;lt;tt&amp;gt;map&amp;lt;/tt&amp;gt; operations except [].  Elements are added&lt;br /&gt;
by inserting a pair&amp;amp;lt;K,V&amp;gt; and retrieved by &amp;lt;tt&amp;gt;m.equal_range(k)&amp;lt;/tt&amp;gt; which&lt;br /&gt;
returns a pair of iterators defining the sequence of pairs matching k.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  multimap&amp;amp;lt;K,V,f&amp;gt; m;   // f defaults to &amp;amp;lt; on K&lt;br /&gt;
  m.insert(make_pair(k,v))  // Insert a pair&lt;br /&gt;
  pair&amp;amp;lt;multimap&amp;amp;lt;K,V,f&amp;gt;::iterator, multimap&amp;amp;lt;K,V,f&amp;gt;::iterator&amp;gt; p&lt;br /&gt;
    = m.equal_range(k) // Sequence with key k is [p-&amp;gt;first, p-&amp;gt;second)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;f (when used as a template argument) is a &amp;lt;i&amp;gt;functoid&amp;lt;/i&amp;gt; (or&lt;br /&gt;
function object), a class&lt;br /&gt;
that looks like a function by overloading ().  For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt; class GreaterThan {&lt;br /&gt;
  public:&lt;br /&gt;
    bool operator()(const T&amp;amp; a, const T&amp;amp; b) const {return b &amp;amp;lt; a;}&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  map&amp;amp;lt;string, int, GreaterThan&amp;amp;lt;T&amp;gt; &amp;gt; m;  // keys sorted in reverse order&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some function objects can be found in &amp;lt;a href=#functional&amp;gt;&amp;amp;lt;functional&amp;gt;&amp;lt;/a&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=set&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;set&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;set&amp;amp;lt;K&amp;gt;&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;multiset&amp;amp;lt;K&amp;gt;&amp;lt;/tt&amp;gt; are like a map&lt;br /&gt;
and multimap, but without values.  Iterators point to a K rather&lt;br /&gt;
than a pair.  There is no [] operator.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  set&amp;amp;lt;K&amp;gt; m;            // Elements are sorted by &amp;amp;lt; on K&lt;br /&gt;
  m.insert(k)          // Add an element&lt;br /&gt;
  m.erase(k)           // Remove an element&lt;br /&gt;
  m.find(k)!=m.end()   // Test if k is in m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=queue&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;queue&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;queue&amp;lt;/tt&amp;gt; is a container in which elements are inserted at the&lt;br /&gt;
back and removed from the front.  This could also be done with a&lt;br /&gt;
&amp;lt;tt&amp;gt;deque&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt;, so no new capabilities are provided.&lt;br /&gt;
A &amp;lt;tt&amp;gt;queue&amp;lt;/tt&amp;gt; does not support iterators or indexing.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  queue&amp;amp;lt;T&amp;gt; q;          // Queue of type T&lt;br /&gt;
  q.size()             // Number of items in q&lt;br /&gt;
  q.empty()            // true if q.size() == 0&lt;br /&gt;
  q.push(x)            // Put x in the back&lt;br /&gt;
  x=q.back()           // The item last pushed, may be assigned to&lt;br /&gt;
  x=q.front()          // The next item to pop, may be assigned to&lt;br /&gt;
  q.pop()              // Remove the front item&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;priority_queue&amp;lt;/tt&amp;gt; is more useful.  It sorts the items as they&lt;br /&gt;
are pushed so that the largest is on top and removed first.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  priority_queue&amp;amp;lt;T&amp;gt; q; // Element type is T&lt;br /&gt;
  priority_queue&amp;amp;lt;T, vector&amp;amp;lt;T&amp;gt;, f&amp;gt; q;  // Use functoid f(x,y) instead of x &amp;amp;lt; y to sort&lt;br /&gt;
  q.size(), q.empty()  // As before&lt;br /&gt;
  q.push(x)            // Insert x&lt;br /&gt;
  x=q.top()            // Largest item in q, cannot be assigned to&lt;br /&gt;
  q.pop()              // Remove top item&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=stack&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;stack&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Items are popped from the top of a &amp;lt;tt&amp;gt;stack&amp;lt;/tt&amp;gt; in the reverse order&lt;br /&gt;
in which they were pushed.  It does not provide any new functionality&lt;br /&gt;
beyond a vector, deque, or list, and does not support iterators or indexing.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  stack&amp;amp;lt;T&amp;gt; s;          // Stack with elements of type T&lt;br /&gt;
  s.size(), s.empty()  // As with queue&lt;br /&gt;
  s.push(x);           // Put x on top&lt;br /&gt;
  x=s.top();           // Last item pushed, may be assigned to&lt;br /&gt;
  s.pop();             // Remove the top item&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=bitset&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;bitset&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;bitset&amp;amp;lt;N&amp;gt;&amp;lt;/tt&amp;gt; is like a &amp;lt;tt&amp;gt;vector&amp;amp;lt;bool&amp;gt;&amp;lt;/tt&amp;gt; with fixed&lt;br /&gt;
size N, but without iterators, and supporting logical operators like&lt;br /&gt;
an N-bit &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;.  Its elements have the values 0 or 1.  It is&lt;br /&gt;
implemented efficiently, with 8 elements per byte.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  bitset&amp;amp;lt;N&amp;gt; b;         // N-bit bitset, N must be a compile time constant&lt;br /&gt;
  bitset&amp;amp;lt;N&amp;gt; b=x;       // Initialize b[0]..b[31] from bits of long x&lt;br /&gt;
  b[i]                 // i'th bit, 0 &amp;amp;lt;= i &amp;amp;lt; N or throw out_of_range()&lt;br /&gt;
  b.size()             // N, cannot be changed&lt;br /&gt;
  b.set(i)             // b[i] = 1&lt;br /&gt;
  b.reset(i)           // b[i] = 0&lt;br /&gt;
  b.flip(i)            // b[i] = 1 - b[i]&lt;br /&gt;
  b.test(i)            // true if b[i] == 1&lt;br /&gt;
  b.set()              // Set all bits, also b.reset(), b.flip()&lt;br /&gt;
  b &amp;amp; b2               // Bitwise AND, also | ^ ~ &amp;amp;lt;&amp;amp;lt; &amp;gt;&amp;gt; &amp;amp;= |= ^= &amp;amp;lt;&amp;amp;lt;= &amp;gt;&amp;gt;= == !=&lt;br /&gt;
  b.count()            // Number of bits set to 1&lt;br /&gt;
  b.any()              // true if b.count() &amp;gt; 0&lt;br /&gt;
  b.none()             // true if b.count() == 0&lt;br /&gt;
  cin &amp;gt;&amp;gt; b             // Read bits as '0' and '1' e.g. &amp;quot;10101&amp;quot;&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; b            // Write bits as '0' and '1'&lt;br /&gt;
  bitset&amp;amp;lt;N&amp;gt; b(s);      // Initialize from string s of '0' and '1' or throw invalid_argument()&lt;br /&gt;
  s=b.template to_string&amp;amp;lt;char&amp;gt;()  // Convert to string&lt;br /&gt;
  x=b.to_ulong()       // Convert to unsigned long, throw overflow_error() if bits &amp;gt; 31 set&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=valarray&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;valarray&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;valarray&amp;lt;/tt&amp;gt; is like a fixed sized array or vector that supports&lt;br /&gt;
arithmetic operations on all the elements at once.  For instance, if&lt;br /&gt;
x and y are valarrays of the same size, then x+y is a valarray containing&lt;br /&gt;
the sums of the corresponding elements.&lt;br /&gt;
Likewise, y=sqrt(x) assigns y[i]=sqrt(x[i]) to each element of y.&lt;br /&gt;
In mixed type expressions,&lt;br /&gt;
a scalar (element of type T) is promoted to a valarray of the same size&lt;br /&gt;
by duplicating it, e.g. x+1 adds 1 to all elements of x.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  valarray&amp;amp;lt;T&amp;gt; v(n);    // n elements of type T, initially T() or 0&lt;br /&gt;
  valarray&amp;amp;lt;T&amp;gt; v(x, n); // n copies of x (note arguments are backwards)&lt;br /&gt;
  valarray&amp;amp;lt;T&amp;gt; v(a, n); // Initialize from array a[0]..a[n-1]&lt;br /&gt;
  valarray&amp;amp;lt;T&amp;gt; v;       // size is 0&lt;br /&gt;
  v.size()             // Number of elements, n&lt;br /&gt;
  v[i]                 // i'th element, 0 &amp;lt;= i &amp;lt; n, not checked&lt;br /&gt;
  v+=x, v+=v           // Add x or v[i] to all v[i], also = -= *= /= %= ^= &amp;amp;= |= &amp;lt;&amp;lt;= &amp;gt;&amp;gt;=&lt;br /&gt;
  v+v, v+x, x+v        // Also - * / % ^ &amp;amp; | &amp;lt;&amp;lt; &amp;gt;&amp;gt; and unary + - ~ !&lt;br /&gt;
  sqrt(v)              // Also all functions in &amp;lt;a href=#cmath&amp;gt;cmath&amp;lt;/a&amp;gt;&lt;br /&gt;
  x=v.sum()            // Sum of all elements&lt;br /&gt;
  v.shift(n)           // Move all v[i] to v[i+n], shift in 0&lt;br /&gt;
  v.cshift(n)          // Move v[i] to v[(i+n) % v.size()]&lt;br /&gt;
  v.resize(n)          // Change size to n, but reset all elements to 0&lt;br /&gt;
  v.resize(n, x)       // Change size to n, set all elements to x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=complex&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;complex&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;complex&amp;lt;/tt&amp;gt; supports complex arithmetic.  It has real and&lt;br /&gt;
imaginary parts of type T.  Mixed type expressions promote real&lt;br /&gt;
to complex (e.g. double to complex&amp;amp;lt;double&amp;gt; and lower precision&lt;br /&gt;
to higher precision (e.g. complex&amp;amp;lt;int&amp;gt; to complex&amp;amp;lt;double&amp;gt;).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  complex&amp;amp;lt;T&amp;gt; x;        // (0,0), T is a numeric type&lt;br /&gt;
  complex&amp;amp;lt;T&amp;gt; x=r;      // (r,0), convert real r to complex&lt;br /&gt;
  complex&amp;amp;lt;T&amp;gt; x(r, i);  // (r,i)&lt;br /&gt;
  x=polar&amp;amp;lt;T&amp;gt;(rho, theta); // Polar notation: radius, angle in radians&lt;br /&gt;
  x.real()             // r&lt;br /&gt;
  x.imag()             // i&lt;br /&gt;
  abs(x)               // rho = sqrt(r*r+i*i)&lt;br /&gt;
  arg(x)               // tan(theta) = i/r&lt;br /&gt;
  norm(x)              // abs(x)*abs(x)&lt;br /&gt;
  conj(x)              // (r,-i)&lt;br /&gt;
  x+y                  // Also - * / == != = += -= *= /= and unary + -&lt;br /&gt;
  sin(x)               // Also sinh, sqrt, tan, tanh, cos, cosh, exp, log, log10, pow(x,y)&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; x            // Prints in format &amp;quot;(r,i)&amp;quot;&lt;br /&gt;
  cin &amp;gt;&amp;gt; x             // Expects &amp;quot;r&amp;quot;, &amp;quot;(r)&amp;quot;, or &amp;quot;(r,i)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=stdexcept&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;stdexcept&amp;gt;, &amp;amp;lt;exception&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The standard library provides a hierarchy of exception types.  Not all&lt;br /&gt;
of them are used by the library, but any may be thrown.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;b&amp;gt;Type                   Header                   Thrown by&amp;lt;/b&amp;gt;&lt;br /&gt;
  exception              stdexcept, exception&lt;br /&gt;
    logic_error          stdexcept&lt;br /&gt;
      length_error       stdexcept&lt;br /&gt;
      domain_error       stdexcept&lt;br /&gt;
      out_of_range       stdexcept                .at(i) (vector/string/deque index out of bounds)&lt;br /&gt;
      invalid_argument   stdexcept, bitset        bitset(&amp;quot;xxx&amp;quot;) (not '0' or '1')&lt;br /&gt;
    runtime_error        stdexcept&lt;br /&gt;
      range_error        stdexcept    &lt;br /&gt;
      overflow_error     stdexcept&lt;br /&gt;
      underflow_error    stdexcept&lt;br /&gt;
    bad_alloc            new                      new, new[] (out of memory)&lt;br /&gt;
    bad_cast             typeinfo                 dynamic_cast&amp;amp;lt;T&amp;amp;&amp;gt; (can't convert to derived)&lt;br /&gt;
    bad_typeid           typeinfo                 typeid(*p) when p==0&lt;br /&gt;
    bad_exception        exception&lt;br /&gt;
    ios_base::failure    ios, iostream, fstream   istream::clear(), ostream::clear()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Catching a base class catches all derived classes, thus &amp;lt;tt&amp;gt;catch(exception&lt;br /&gt;
e)&amp;lt;/tt&amp;gt; catches all of the above types.  However, C++ allows throwing&lt;br /&gt;
exceptions not derived from &amp;lt;tt&amp;gt;exception&amp;lt;/tt&amp;gt;, so this may not catch&lt;br /&gt;
everything.  All exceptions provide the following interface:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  throw exception(msg)   // Throw exception with char* or string msg&lt;br /&gt;
  throw exception();     // Default msg&lt;br /&gt;
  catch(exception e) {e.what();}  // msg as a char*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;New exceptions may be derived from existing types to maintain this&lt;br /&gt;
interface (see &amp;lt;a href=#inheritance&amp;gt;inheritance&amp;lt;/a&amp;gt;).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class MyError: public exception {&lt;br /&gt;
  public:&lt;br /&gt;
    MyError(const string&amp;amp; msg=&amp;quot;&amp;quot;): exception(msg) {}&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cpplibrary&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;C++ Standard Library Functions&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Many C++ standard library functions operate on sequences denoted by&lt;br /&gt;
iterators or pointers.  &amp;lt;b&amp;gt;Iterators&amp;lt;/b&amp;gt; are a family of types that&lt;br /&gt;
include pointers.  They are classified by the operators they support.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;input:&amp;lt;/b&amp;gt; &amp;lt;tt&amp;gt;++p, p++, p=q, p==q, p!=q, *p&amp;lt;/tt&amp;gt; (read-only)&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;output:&amp;lt;/b&amp;gt; &amp;lt;tt&amp;gt;p=q, p==q, p!=q, *p++ = x&amp;lt;/tt&amp;gt; (alternating write/increment)&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;forward:&amp;lt;/b&amp;gt; input and output and &amp;lt;tt&amp;gt;p-&amp;gt;m, *p&amp;lt;/tt&amp;gt; (multiple read-write)&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;bidirectional:&amp;lt;/b&amp;gt; forward and &amp;lt;tt&amp;gt;--p, p--&amp;lt;/tt&amp;gt;, implemented by&lt;br /&gt;
list, map, multimap, set, multiset.&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;random:&amp;lt;/b&amp;gt; bidirectional and &amp;lt;tt&amp;gt;p&amp;amp;lt;q, p&amp;gt;q, p&amp;amp;lt;=q, p&amp;gt;=q, p+i, i+p, p-i, p-q, p[i]&amp;lt;/tt&amp;gt;,&lt;br /&gt;
implemented by arrays (as pointers), string, vector, deque.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Some algorithms require certain iterator types, but will accept more&lt;br /&gt;
powerful types.  For example, &amp;lt;tt&amp;gt;copy(b, e, d)&amp;lt;/tt&amp;gt; require b and e&lt;br /&gt;
to be at least input iterators and d to be at least an output iterator.  But&lt;br /&gt;
it will accept forward, bidirectional, or random iterators because these&lt;br /&gt;
all support input and output operations.  &amp;lt;tt&amp;gt;sort()&amp;lt;/tt&amp;gt; requires random&lt;br /&gt;
iterators and will accept no other type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The notation [b,e) denotes&lt;br /&gt;
the sequence of e-b objects from b[0] to e[-1], i.e. b points to the&lt;br /&gt;
beginning of the sequence and e points one past the end.  For most&lt;br /&gt;
containers, v, the sequence is [v.begin(), v.end()).  For an array of&lt;br /&gt;
n elements, the sequence is [a, a+n).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=algorithm&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;algorithm&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In the following, b and e are input iterators, and d is an output iterator,&lt;br /&gt;
unless otherwise specified.  Parameters eq and lt are optional,&lt;br /&gt;
and default to functions that take 2 arguments x and y and return x==y&lt;br /&gt;
and x&amp;amp;lt;y respectively, e.g. &amp;lt;tt&amp;gt;bool eq(x,y) {return x==y;}&amp;lt;/tt&amp;gt;.&lt;br /&gt;
x and y are objects of the type pointed to by the iterators.&lt;br /&gt;
p is a pair of iterators.  f is a function or function object as noted.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Operations on ordinary objects&lt;br /&gt;
  swap(x1, x2);              // Swap values of 2 objects of the same type&lt;br /&gt;
  min(x1, x2);               // Smaller of x1 or x2, must be same type&lt;br /&gt;
  max(x1, x2);               // Larger of x1 or x2, must be same type&lt;br /&gt;
&lt;br /&gt;
  // Properties of sequences (input iterators)&lt;br /&gt;
  equal(b, e, b2, eq);       // true if [b,e)==[b2,...)&lt;br /&gt;
  lexicographical_compare(b, e, b2, e2, lt);  // true if [b,e)&amp;amp;lt;[b2,e2)&lt;br /&gt;
  i=min_element(b, e);       // Points to smallest in [b,e)&lt;br /&gt;
  i=max_element(b, e);       // Points to largest&lt;br /&gt;
  n=count(b, e, x);          // Number of occurrences of x in [b,e)&lt;br /&gt;
  n=count_if(b, e, f);       // Number of f(x) true in [b,e)&lt;br /&gt;
&lt;br /&gt;
  // Searching, i points to found item or end (e) if not found&lt;br /&gt;
  i=find(b, e, x);           // Find first x in [b,e)&lt;br /&gt;
  i=find_if(b, e, f);        // Find first x where f(x) is true&lt;br /&gt;
  i=search(b, e, b2, e2, eq);// Find first [b2,e2) in [b,e) (forward)&lt;br /&gt;
  i=find_end(b, e, b2, e2, eq); // Find last [b2,e2) in [b,e) (forward)&lt;br /&gt;
  i=search_n(b, e, n, x, eq);// Find n copies of x in [b,e) (forward)&lt;br /&gt;
  p=mismatch(b, e, b2, eq);  // Find first *p.first in [b,e) != *p.second in [b2,.) (forward)&lt;br /&gt;
  i=adjacent_find(b, e, eq); // Find first of 2 equal elements (forward)&lt;br /&gt;
&lt;br /&gt;
  // Modifying elements&lt;br /&gt;
  i=copy(b, e, d);           // Copy [b,e) to [d,i)&lt;br /&gt;
  fill(d, i, x);             // Set all in [d,i) to x (forward)&lt;br /&gt;
  i=fill_n(d, n, x);         // Set n elements in [d,i) to x&lt;br /&gt;
  generate(d, i, f);         // Set [d,i) to f() (e.g. rand) (forward)&lt;br /&gt;
  i=generate_n(d, n, f);     // Set n elements in [d,i) to f()&lt;br /&gt;
  f=for_each(b, e, f);       // Call f(x) for each x in [b,e)&lt;br /&gt;
  i=transform(b, e, d, f);   // For x in [b,e), put f(x) in [d,i)&lt;br /&gt;
  i=transform(b, e, b2, d, f);  // For x in [b,e), y in [b2,.), put f(x,y) in [d,i)&lt;br /&gt;
  replace(b, e, x, y)        // Replace x with y in [b,e)&lt;br /&gt;
  replace_if(b, e, f, y);    // Replace with y in [b,e) where f(x) is true&lt;br /&gt;
  i=replace_copy(b, e, d, x, y);    // Copy [b,e) to [d,i) replacing x with y&lt;br /&gt;
  i=replace_copy_if(b, e, d, f, y); // Copy replacing with y where f(x) is true&lt;br /&gt;
&lt;br /&gt;
  // Rearranging sequence elements&lt;br /&gt;
  sort(b, e, lt);            // Sort [b,e) by &amp;amp;lt; (random)&lt;br /&gt;
  stable_sort(b, e, lt);     // Sort slower, maintaining order of equal elements (random)&lt;br /&gt;
  partial_sort(b, m, e, lt); // Sort faster but leave [m,e) unsorted (random)&lt;br /&gt;
  nth_element(b, m, e, lt);  // Sort fastest but only *m in proper place (random)&lt;br /&gt;
  iter_swap(b, e);           // swap(*b, *e) (forward)&lt;br /&gt;
  i=swap_ranges(b, e, b2);   // swap [b,e) with [b2,i) (forward)&lt;br /&gt;
  i=partition(b, e, f);      // Moves f(x) true to front, [i,e) is f(x) false (bidirectional)&lt;br /&gt;
  i=stable_partition(b, e, f);  // Maintains order within each partition&lt;br /&gt;
  i=remove(b, e, x);         // Move all x to end in [i,e) (forward)&lt;br /&gt;
  i=remove_if(b, e, f);      // Move f(x) true to front in [b,i) (forward)&lt;br /&gt;
  i=remove_copy(b, e, d, x); // Copy elements matching x to [d,i)&lt;br /&gt;
  i=remove_copy_if(b, e, d, f);  // Copy elements x if f(x) is false to [d,i)&lt;br /&gt;
  replace(b, e, x1, x2);     // Replace x1 with x2 in [b,e)&lt;br /&gt;
  i=replace_copy(b, e, d, x1, x2);  // Copy [b,e) to [d,i) replacing x1 with x2&lt;br /&gt;
  reverse(b, e);             // Reverse element order in [b,e) (bidirectional)&lt;br /&gt;
  i=reverse_copy(b, e, d);   // Copy [b,e) to [d,i) reversing the order (b,e bidirectional)&lt;br /&gt;
  rotate(b, m, e);           // Move [b,m) behind [m,e) (forward)&lt;br /&gt;
  i=rotate_copy(b, m, e, d); // Rotate into [d,i)&lt;br /&gt;
  random_shuffle(b, e, f);   // Random permutation, f() defaults to rand()&lt;br /&gt;
  next_permutation(b, e, lt);// Next greater sequence, true if successful (bidirectional)&lt;br /&gt;
  prev_permutation(b, e, lt);// Previous permutation, true if successful (bidirectional)&lt;br /&gt;
&lt;br /&gt;
  // Operations on sorted sequences&lt;br /&gt;
  i=unique(b, e, eq);            // Move unique list to [b,i), extras at end&lt;br /&gt;
  i=unique_copy(b, e, d, eq);    // Copy one of each in [b,d) to [d,i)&lt;br /&gt;
  i=binary_search(b, e, x, lt);  // Find i in [b,e) (forward)&lt;br /&gt;
  i=lower_bound(b, e, x, lt);    // Find first x in [b,e) or where to insert it (forward)&lt;br /&gt;
  i=upper_bound(b, e, x, lt);    // Find 1 past last x in [b,e) or where to insert it (forward)&lt;br /&gt;
  p=equal_range(b, e, x, lt);    // p.first = lower bound, p.second = upper bound (forward)&lt;br /&gt;
  includes(b, e, b2, e2, lt);    // true if [b,e) is a subset of [b2,e2)&lt;br /&gt;
  i=merge(b, e, b2, e2, d, lt);  // Merge [b,e) and [b2,e2) to [d,i)&lt;br /&gt;
  inplace_merge(b, m, e, lt);    // Merge [b,m) and [m,e) to [b,e) (bidirectional)&lt;br /&gt;
  i=set_union(b, e, b2, e2, d, lt);  // [d,i) = unique elements in either [b,e) or [b2,e2)&lt;br /&gt;
  i=set_intersection(b, e, b2, e2, d, lt);  // [d,i) = unique elements in both&lt;br /&gt;
  i=set_difference(b, e, b2, e2, d, lt);    // [d,i) = unique elements in [b,e) but not [b2,e2)&lt;br /&gt;
  i=set_symmetric_difference(b, e, b2, e2, d, lt);  // [d,i) = elements in one but not both&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Algorithms never change the size of a container.  When copying, the&lt;br /&gt;
destination must be large enough to hold the result.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a[5]={3,1,4,1,6};&lt;br /&gt;
  vector&amp;lt;int&amp;gt; b(5);&lt;br /&gt;
  copy(a, a+5, v.begin());   // Copy a to v&lt;br /&gt;
  remove(a, a+5, 1);         // {3,4,6,1,1}, returns a+3&lt;br /&gt;
  sort(a, a+4);              // {1,3,4,6,1}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=numeric&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;numeric&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following, &amp;lt;tt&amp;gt;plus, minus,&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;times&amp;lt;/tt&amp;gt; are&lt;br /&gt;
optional functions taking 2 arguments x and y that return x+y, x-y,&lt;br /&gt;
and x*y respectively, e.g. &amp;lt;tt&amp;gt;int plus(int x, int y) {return x+y;}&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  x=accumulate(b, e, x, plus);                // x + sum over [b,e)&lt;br /&gt;
  x=inner_product(b, e, b2, x, plus, times);  // x + sum [b,e)*[b2,e2)&lt;br /&gt;
  adjacent_difference(b, e, minus);           // for i in (b,e) *i -= i[-1]&lt;br /&gt;
  partial_sum(b, e, plus);                    // for i in [b,e) *i += sum [b,i)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=iterator&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;iterator&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An inserter is an output iterator that expands the container it&lt;br /&gt;
points to by calling push_back(), push_front(), or insert().  The container&lt;br /&gt;
must support this operation.  A stream iterator&lt;br /&gt;
can be used to do formatted input or output using &amp;gt;&amp;gt; or &amp;amp;lt;&amp;amp;lt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  back_inserter(c);             // An iterator that appends to container c&lt;br /&gt;
  front_inserter(c);            // Inserts at front of c&lt;br /&gt;
  inserter(c, p);               // Inserts in front of p&lt;br /&gt;
  ostream_iterator&amp;amp;lt;T&amp;gt;(out, cp); // Writes to ostream separated by char* cp (default &amp;quot; &amp;quot;)&lt;br /&gt;
  istream_iterator&amp;amp;lt;T&amp;gt;(in);      // An input iterator that reads T objects from istream&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The most common use is to copy to an empty vector, deque, or list.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  vector&amp;amp;lt;int&amp;gt; from(10), to;&lt;br /&gt;
  copy(from.begin(), from.end(), back_inserter(to));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This header also defines tag types to be used for creating&lt;br /&gt;
iterator types that work with algorithms.  See&lt;br /&gt;
&amp;lt;a href=#defining_iterators&amp;gt;defining iterators&amp;lt;/a&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=functional&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;functional&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions in &amp;amp;lt;functional&amp;gt; create &amp;lt;i&amp;gt;function objects&amp;lt;/i&amp;gt;, which&lt;br /&gt;
are objects that behave like functions by overloading &amp;lt;tt&amp;gt;operator()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
These can be passed to algorithms that take function arguments, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  vector&amp;amp;lt;int&amp;gt; v(10);&lt;br /&gt;
  sort(v.begin(), v.end(), greater&amp;amp;lt;int&amp;gt;());  // Sort v in reverse order&lt;br /&gt;
  int x=accumulate(v.begin(), v.end(), 1, multiplies&amp;amp;lt;T&amp;gt;);  // Product of elements  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following create function objects that take one or two parameters&lt;br /&gt;
x and y of type T and return the indicated expression, i.e.,&lt;br /&gt;
&amp;lt;tt&amp;gt;equal_to&amp;amp;lt;int&amp;gt;()(3,4)&amp;lt;/tt&amp;gt; returns false.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   // Predicates (return bool)&lt;br /&gt;
   equal_to&amp;amp;lt;T&amp;gt;()                 // x==y&lt;br /&gt;
   not_equal_to&amp;amp;lt;T&amp;gt;()             // x!=y&lt;br /&gt;
   greater&amp;amp;lt;T&amp;gt;()                  // x&amp;gt;y&lt;br /&gt;
   less&amp;amp;lt;T&amp;gt;()                     // x&amp;amp;lt;y&lt;br /&gt;
   greater_equal&amp;amp;lt;T&amp;gt;()            // x&amp;gt;=y&lt;br /&gt;
   less_equal&amp;amp;lt;T&amp;gt;()               // x&amp;amp;lt;=y&lt;br /&gt;
   logical_and&amp;amp;lt;bool&amp;gt;()           // x&amp;amp;&amp;amp;y&lt;br /&gt;
   logical_or&amp;amp;lt;bool&amp;gt;()            // x||y&lt;br /&gt;
   logical_not&amp;amp;lt;bool&amp;gt;()           // !x (unary)&lt;br /&gt;
&lt;br /&gt;
   // Arithmetic operations (return T)&lt;br /&gt;
   plus&amp;amp;lt;T&amp;gt;()                     // x+y&lt;br /&gt;
   minus&amp;amp;lt;T&amp;gt;()                    // x-y&lt;br /&gt;
   multiplies&amp;amp;lt;T&amp;gt;()               // x*y&lt;br /&gt;
   divides&amp;amp;lt;T&amp;gt;()                  // x/y&lt;br /&gt;
   modulus&amp;amp;lt;T&amp;gt;()                  // x%y&lt;br /&gt;
   negate&amp;amp;lt;T&amp;gt;()                   // -x (unary)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A &amp;lt;i&amp;gt;binder&amp;lt;/i&amp;gt; converts a 2-argument function object into a 1-argument&lt;br /&gt;
object by binding a fixed value &amp;lt;tt&amp;gt;c&amp;lt;/tt&amp;gt; to the other argument, e.g.&lt;br /&gt;
&amp;lt;tt&amp;gt;bind2nd(less&amp;amp;lt;int&amp;gt;(), 10) returns a function object that takes one&lt;br /&gt;
argument x and returns true if x&amp;amp;lt;10.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  bind1st(f, c)                  // An object computing f(c,y)&lt;br /&gt;
  bind2nd(f, c)                  // An object computing f(x,c)&lt;br /&gt;
&lt;br /&gt;
  i=find_if(v.begin(), v.end(), bind2nd(equal_to&amp;amp;lt;int&amp;gt;(), 0));  // Find first 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following convert ordinary functions and member functions into&lt;br /&gt;
function objects.  All functions must be converted to be passed to&lt;br /&gt;
bind1st and bind2nd.  Member functions must also be converted to be&lt;br /&gt;
passed to algorithms.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ptr_fun(f)                     // Convert ordinary function f to object&lt;br /&gt;
  mem_fun(&amp;amp;T::f)                 // Convert member function of class T&lt;br /&gt;
  mem_fun_ref(T::f)              // Same&lt;br /&gt;
&lt;br /&gt;
  i=find_if(v.begin(), v.end(), mem_fun(&amp;amp;string::empty));  // Find &amp;quot;&amp;quot;&lt;br /&gt;
  transform(v.begin(), v.end(), v.begin(), bind2nd(ptr_fun(pow), 2.0));  // Square elements&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;not1()&amp;lt;/tt&amp;gt; and not2()&amp;lt;/tt&amp;gt; negate a unary or binary function object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  not1(f)                        // Object computing !f(x)&lt;br /&gt;
  not2(f)                        // Object computing !f(x,y)&lt;br /&gt;
&lt;br /&gt;
  i=find_if(v.begin(), v.end(), not1(bind2nd(equal_to&amp;amp;lt;int&amp;gt;(), 0)));  // Find nonzero&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=new&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;new&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The default behavior of &amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt; is to throw an exception of&lt;br /&gt;
type &amp;lt;tt&amp;gt;bad_alloc&amp;lt;/tt&amp;gt; if&lt;br /&gt;
out of memory.  This can be changed by writing a function (taking&lt;br /&gt;
no parameters and returning void) and passing it to&lt;br /&gt;
&amp;lt;tt&amp;gt;set_new_handler()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  void handler() {throw bad_alloc();} // The default&lt;br /&gt;
  set_new_handler(handler);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;new(nothrow)&amp;lt;/tt&amp;gt; may be used in place of &amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt;.  If&lt;br /&gt;
out of memory, it returns 0 rather than throw bad_alloc.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int* p = new(nothrow) int[1000000000];  // p may be 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=clibrary&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;C Library Functions&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The C library is provided for backwards compatibility with the C language.&lt;br /&gt;
Because C lacked namespaces, all types and functions were defined globally.&lt;br /&gt;
For each C header, C++ provides an additional header by prefixing &amp;quot;c&amp;quot;&lt;br /&gt;
and dropping the &amp;quot;.h&amp;quot; suffix, which places everything in namespace &amp;lt;tt&amp;gt;std&amp;lt;/tt&amp;gt;.&lt;br /&gt;
For instance, &amp;lt;tt&amp;gt;&amp;amp;lt;stdio.h&amp;gt;&amp;lt;/tt&amp;gt; becomes &amp;lt;tt&amp;gt;&amp;amp;lt;cstdio&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cstdlib&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cstdlib&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Miscellaneous functions.  s is type char*, n is int&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  atoi(s); atol(s); atof(s);// Convert char* s to int, long, double e.g. atof(&amp;quot;3.5&amp;quot;)&lt;br /&gt;
  abs(x); labs(x);          // Absolute value of numeric x as int, long&lt;br /&gt;
  rand();                   // Pseudo-random int from 0 to RAND_MAX (at least 32767)&lt;br /&gt;
  srand(n);                 // Initialize rand(), e.g. srand(time(0));&lt;br /&gt;
  system(s);                // Execute OS command s, e.g. system(&amp;quot;ls&amp;quot;);&lt;br /&gt;
  getenv(s);                // Environment variable or 0 as char*, e.g. getenv(&amp;quot;PATH&amp;quot;); &lt;br /&gt;
  exit(n);                  // Kill program, return status n, e.g. exit(0);&lt;br /&gt;
  void* p = malloc(n);      // Allocate n bytes or 0 if out of memory.  Obsolete, use new.&lt;br /&gt;
  p = calloc(n, 1);         // Allocate and set to 0 or return NULL.  Obsolete.&lt;br /&gt;
  p = realloc(p, n);        // Enlarge to n bytes or return NULL.  Obsolete.&lt;br /&gt;
  free(p);                  // Free memory.  Obsolete: use delete&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cctype&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cctype&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Character tests take a char c and return bool.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  isalnum(c);               // Is c a letter or digit?&lt;br /&gt;
  isalpha(c); isdigit(c);   // Is c a letter?  Digit?&lt;br /&gt;
  islower(c); isupper(c);   // Is c lower case?  Upper case?&lt;br /&gt;
  isgraph(c); isprint(c);   // Printing character except/including space?&lt;br /&gt;
  isspace(c); iscntrl(c);   // Is whitespace?  Is a control character?&lt;br /&gt;
  ispunct(c);               // Is printing except space, letter, or digit?&lt;br /&gt;
  isxdigit(c);              // Is hexadecimal digit?&lt;br /&gt;
  c=tolower(c); c=toupper(c);   // Convert c to lower/upper case&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cmath&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cmath&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions take double and return double.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  sin(x); cos(x); tan(x);   // Trig functions, x in radians&lt;br /&gt;
  asin(x); acos(x); atan(x);// Inverses&lt;br /&gt;
  atan2(y, x);              // atan(y/x)&lt;br /&gt;
  sinh(x); cosh(x); tanh(x);// Hyperbolic&lt;br /&gt;
  exp(x); log(x); log10(x); // e to the x, log base e, log base 10&lt;br /&gt;
  pow(x, y); sqrt(x);       // x to the y, square root&lt;br /&gt;
  ceil(x); floor(x);        // Round up or down (as a double)&lt;br /&gt;
  fabs(x); fmod(x, y);      // Absolute value, x mod y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=ctime&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;ctime&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions for reading the system clock.  &amp;lt;tt&amp;gt;time_t&amp;lt;/tt&amp;gt; is&lt;br /&gt;
an integer type (usually long).  &amp;lt;tt&amp;gt;tm&amp;lt;/tt&amp;gt; is a struct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  clock()/CLOCKS_PER_SEC;   // Time in seconds since program started&lt;br /&gt;
  time_t t=time(0);         // Absolute time in seconds or -1 if unknown&lt;br /&gt;
  tm* p=gmtime(&amp;amp;t);         // 0 if UCT unavailable, else p-&amp;gt;tm_X where X is:&lt;br /&gt;
    sec, min, hour, mday, mon (0-11), year (-1900), wday, yday, isdst&lt;br /&gt;
  asctime(p);               // &amp;quot;Day Mon dd hh:mm:ss yyyy\n&amp;quot;&lt;br /&gt;
  asctime(localtime(&amp;amp;t));   // Same format, local time&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cstring&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cstring&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions for performing string-like operations on arrays of char&lt;br /&gt;
marked with a terminating '\0' (such as &amp;lt;tt&amp;gt;&amp;quot;quoted literals&amp;quot;&amp;lt;/tt&amp;gt;&lt;br /&gt;
or as returned by &amp;lt;tt&amp;gt;string::c_str()&amp;lt;/tt&amp;gt;.  Mostly obsoleted by&lt;br /&gt;
type &amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  strcpy(dst, src);         // Copy src to dst. Not bounds checked&lt;br /&gt;
  strcat(dst, src);         // Concatenate to dst. Not bounds checked&lt;br /&gt;
  strcmp(s1, s2);           // Compare, &amp;amp;lt;0 if s1&amp;amp;lt;s2, 0 if s1==s2, &amp;amp;gt;0 if s1&amp;amp;gt;s2&lt;br /&gt;
  strncpy(dst, src, n);     // Copy up to n chars, also strncat(), strncmp()&lt;br /&gt;
  strlen(s);                // Length of s not counting \0&lt;br /&gt;
  strchr(s,c); strrchr(s,c);// Address of first/last char c in s or 0&lt;br /&gt;
  strstr(s, sub);           // Address of first substring in s or 0&lt;br /&gt;
    // mem... functions are for any pointer types (void*), length n bytes&lt;br /&gt;
  memcpy(dst, src, n);      // Copy n bytes from src to dst&lt;br /&gt;
  memmove(dst, src, n);     // Same, but works correctly if dst overlaps src&lt;br /&gt;
  memcmp(s1, s2, n);        // Compare n bytes as in strcmp&lt;br /&gt;
  memchr(s, c, n);          // Find first byte c in s, return address or 0&lt;br /&gt;
  memset(s, c, n);          // Set n bytes of s to c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cstdio&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cstdio&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The &amp;lt;tt&amp;gt;stdio&amp;lt;/tt&amp;gt; library is made mostly obsolete by the newer&lt;br /&gt;
&amp;lt;tt&amp;gt;iostream&amp;lt;/tt&amp;gt;&lt;br /&gt;
library, but many programs still use it.  There are facilities for&lt;br /&gt;
random access files and greater control over output format,&lt;br /&gt;
error handling, and temporary files.  Mixing both I/O libraries is&lt;br /&gt;
not recommended.  There are no facilities for string I/O.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Global objects &amp;lt;tt&amp;gt;stdin, stdout, stderr&amp;lt;/tt&amp;gt; of type &amp;lt;tt&amp;gt;FILE*&amp;lt;/tt&amp;gt;&lt;br /&gt;
correspond to &amp;lt;tt&amp;gt;cin, cout, cerr&amp;lt;/tt&amp;gt;.  s is type char*, c is char,&lt;br /&gt;
n is int, f is FILE*.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  FILE* f=fopen(&amp;quot;filename&amp;quot;, &amp;quot;r&amp;quot;);  // Open for reading, NULL (0) if error&lt;br /&gt;
    // Mode may also be &amp;quot;w&amp;quot; (write) &amp;quot;a&amp;quot; append, &amp;quot;a+&amp;quot; random access read/append,&lt;br /&gt;
    // &amp;quot;rb&amp;quot;, &amp;quot;wb&amp;quot;, &amp;quot;ab&amp;quot;, &amp;quot;a+b&amp;quot; are binary&lt;br /&gt;
  fclose(f);                // Close file f&lt;br /&gt;
  fprintf(f, &amp;quot;x=%d&amp;quot;, 3);    // Print &amp;quot;x=3&amp;quot;  Other conversions:&lt;br /&gt;
    &amp;quot;%5d %u %-8ld&amp;quot;            // int width 5, unsigned int, long left justified&lt;br /&gt;
    &amp;quot;%o %x %X %lx&amp;quot;            // octal, hex, HEX, long hex&lt;br /&gt;
    &amp;quot;%f %5.1f&amp;quot;                // double: 123.000000, 123.0&lt;br /&gt;
    &amp;quot;%e %g&amp;quot;                   // 1.23e2, use either f or g&lt;br /&gt;
    &amp;quot;%c %s&amp;quot;                   // char, char*&lt;br /&gt;
    &amp;quot;%%&amp;quot;                      // %&lt;br /&gt;
  sprintf(s, &amp;quot;x=%d&amp;quot;, 3);    // Print to array of char s&lt;br /&gt;
  printf(&amp;quot;x=%d&amp;quot;, 3);        // Print to stdout (screen unless redirected)&lt;br /&gt;
  fprintf(stderr, ...       // Print to standard error (not redirected)&lt;br /&gt;
  getc(f);                  // Read one char (as an int, 0-255) or EOF (-1) from f&lt;br /&gt;
  ungetc(c, f);             // Put back one c to f&lt;br /&gt;
  getchar();                // getc(stdin);&lt;br /&gt;
  putc(c, f)                // fprintf(f, &amp;quot;%c&amp;quot;, c);&lt;br /&gt;
  putchar(c);               // putc(c, stdout);&lt;br /&gt;
  fgets(s, n, f);           // Read line including '\n' into char s[n] from f.  NULL if EOF&lt;br /&gt;
  gets(s)                   // fgets(s, INT_MAX, f); no '\n' or bounds check&lt;br /&gt;
  fread(s, n, 1, f);        // Read n bytes from f to s, return number read&lt;br /&gt;
  fwrite(s, n, 1, f);       // Write n bytes of s to f, return number written&lt;br /&gt;
  fflush(f);                // Force buffered writes to f&lt;br /&gt;
  fseek(f, n, SEEK_SET);    // Position binary file f at n&lt;br /&gt;
    // or SEEK_CUR from current position, or SEEK_END from end&lt;br /&gt;
  ftell(f);                 // Position in f, -1L if error&lt;br /&gt;
  rewind(f);                // fseek(f, 0L, SEEK_SET); clearerr(f);&lt;br /&gt;
  feof(f);                  // Is f at end of file?&lt;br /&gt;
  ferror(f);                // Error in f?&lt;br /&gt;
  perror(s);                // Print char* s and last I/O error message to stderr&lt;br /&gt;
  clearerr(f);              // Clear error code for f&lt;br /&gt;
  remove(&amp;quot;filename&amp;quot;);       // Delete file, return 0 if OK&lt;br /&gt;
  rename(&amp;quot;old&amp;quot;, &amp;quot;new&amp;quot;);     // Rename file, return 0 if OK&lt;br /&gt;
  f = tmpfile();            // Create temporary file in mode &amp;quot;wb+&amp;quot;&lt;br /&gt;
  tmpnam(s);                // Put a unique file name in char s[L_tmpnam]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Example: input file name and print its size&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  char filename[100];              // Cannot be a string&lt;br /&gt;
  printf(&amp;quot;Enter filename\n&amp;quot;);      // Prompt&lt;br /&gt;
  gets(filename, 100, stdin);      // Read line ending in &amp;quot;\n\0&amp;quot;&lt;br /&gt;
  filename[strlen(filename)-1]=0;  // Chop off '\n';&lt;br /&gt;
  FILE* f=fopen(filename, &amp;quot;rb&amp;quot;);   // Open for reading in binary mode&lt;br /&gt;
  if (f) {                         // Open OK?&lt;br /&gt;
    fseek(f, 0, SEEK_END);         // Position at end&lt;br /&gt;
    long n=ftell(f);               // Get position&lt;br /&gt;
    printf(&amp;quot;%s has %ld bytes\n&amp;quot;, filename, n);&lt;br /&gt;
    fclose(f);                     // Or would close when program ends&lt;br /&gt;
  }&lt;br /&gt;
  else&lt;br /&gt;
    perror(filename);              // fprintf(stderr, &amp;quot;%s: not found\n&amp;quot;, filename);&lt;br /&gt;
                                   // or permission denied, etc.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;printf(), fprintf()&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;sprintf()&amp;lt;/tt&amp;gt; accept a variable&lt;br /&gt;
number of arguments, one for each &amp;quot;%&amp;quot; in the format string, which must&lt;br /&gt;
be the appropriate type.  The compiler does not check for this.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  printf(&amp;quot;%d %f %s&amp;quot;, 2, 2.0, &amp;quot;2&amp;quot;);  // OK&lt;br /&gt;
  printf(&amp;quot;%s&amp;quot;, 5);  // Crash: expected a char* arg, read from address 5&lt;br /&gt;
  printf(&amp;quot;%s&amp;quot;);     // Crash&lt;br /&gt;
  printf(&amp;quot;%s&amp;quot;, string(&amp;quot;hi&amp;quot;));  // Crash: use &amp;quot;hi&amp;quot; or string(&amp;quot;hi&amp;quot;).c_str()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cassert&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cassert&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Provides a debugging function for testing conditions where&lt;br /&gt;
all instances can be turned on or off at once.  &amp;lt;tt&amp;gt;assert(false);&amp;lt;/tt&amp;gt;&lt;br /&gt;
prints the asserted expression, source code file name, and line number,&lt;br /&gt;
then aborts.&lt;br /&gt;
Compiling with &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;g++ -DNDEBUG&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; effectively removes&lt;br /&gt;
these statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  assert(e);                // If e is false, print message and abort&lt;br /&gt;
  #define NDEBUG            // (before #include &amp;amp;lt;assert.h&amp;gt;), turn off assert&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=classes&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Classes&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Classes provide data abstraction, the ability to create new types and hide&lt;br /&gt;
their implementation in order to improve maintainability.&lt;br /&gt;
A &amp;lt;tt&amp;gt;class&amp;lt;/tt&amp;gt; is a data structure and an associated set of&lt;br /&gt;
&amp;lt;i&amp;gt;member functions&amp;lt;/i&amp;gt; (methods) and related type declarations&lt;br /&gt;
which can be associated with the class or instances (objects) of the&lt;br /&gt;
class.  A class is divided into a &amp;lt;tt&amp;gt;public&amp;lt;/tt&amp;gt; interface, visible&lt;br /&gt;
wherever the class or its instances are visible, and a &amp;lt;tt&amp;gt;private&amp;lt;/tt&amp;gt;&lt;br /&gt;
implementation visible only to member functions of the class.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class T {          // Create a new type T&lt;br /&gt;
  private:           // Members are visible only to member functions of T (default)&lt;br /&gt;
  public:            // Members are visible wherever T is visible&lt;br /&gt;
    // Type, object, and function declarations&lt;br /&gt;
  };&lt;br /&gt;
  T::m;              // Member m of type T&lt;br /&gt;
  T x;               // Create object x of type T&lt;br /&gt;
  x.m;               // Member m of object x&lt;br /&gt;
  T* p=&amp;amp;x; p-&amp;gt;m;     // Member m of object pointed to by p&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Typically the data structure is private, and functionality is provided&lt;br /&gt;
by member functions.  Member function definitions should be separated from&lt;br /&gt;
the declaration and written outside the class definition, or else they&lt;br /&gt;
are assumed to be inline (which is appropriate for short functions).&lt;br /&gt;
A member function should be declared const (before the opening brace)&lt;br /&gt;
if it does not modify any data members.  Only const member functions may&lt;br /&gt;
be called on const objects.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {    // Represents imaginary numbers&lt;br /&gt;
  private:&lt;br /&gt;
    double re, im;   // Data members, represents re + im * sqrt(-1)&lt;br /&gt;
  public:&lt;br /&gt;
    void set(double r, double i) {re=r; im=i;}  // Inlined member function definition&lt;br /&gt;
    double real() const {return re;}            // const - does not modify data members&lt;br /&gt;
    double imag() const;                        // Declaration for non-inlined function&lt;br /&gt;
  };&lt;br /&gt;
  double Complex::imag() const {return im;}     // Definition for imag()&lt;br /&gt;
  int main() {&lt;br /&gt;
    Complex a, b=a;                // Objects of type Complex&lt;br /&gt;
    a.set(3, 4);                   // Call a member function&lt;br /&gt;
    b=a;                           // Assign b.re=a.re; b.im=a.im&lt;br /&gt;
    b==a;                          // Error, == is not defined&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; a.re;                  // Error, re is private&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; a.real();              // OK, 3&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; Complex().real();      // OK, prints an undefined value&lt;br /&gt;
    Complex().set(5, 6);           // Error, non-const member called on const object&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A class has two special member functions, a &amp;lt;i&amp;gt;constructor&amp;lt;/i&amp;gt;, which is called&lt;br /&gt;
when the object is created, and a &amp;lt;i&amp;gt;destructor&amp;lt;/i&amp;gt;, called when destroyed.&lt;br /&gt;
The constructor is named &amp;lt;tt&amp;gt;&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;::&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt;, has no return&lt;br /&gt;
type or value, may be overloaded and have default arguments, and is&lt;br /&gt;
never const.  It is followed by an optional initialization list&lt;br /&gt;
listing each data member and its initial value.  Initialization&lt;br /&gt;
takes place before the constructor code is executed.  Initialization&lt;br /&gt;
might not be in the order listed.  Members not listed&lt;br /&gt;
are default-initialized by calling their constructors with default&lt;br /&gt;
arguments.  If no constructor is written, the compiler provides one which&lt;br /&gt;
default-initializes all members.  The syntax is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;::&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;(&amp;lt;i&amp;gt;parameter list&amp;lt;/i&amp;gt;): &amp;lt;i&amp;gt;member&amp;lt;/i&amp;gt;(&amp;lt;i&amp;gt;value&amp;lt;/i&amp;gt;), &amp;lt;i&amp;gt;member&amp;lt;/i&amp;gt;(&amp;lt;i&amp;gt;value&amp;lt;/i&amp;gt;) { &amp;lt;i&amp;gt;code...&amp;lt;/i&amp;gt;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The destructor is named &amp;lt;tt&amp;gt;&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;::~&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt;, has no&lt;br /&gt;
return type or value, no parameters, and is never const.  It is usually&lt;br /&gt;
not needed except to return shared resources by closing files or&lt;br /&gt;
deleting memory.  After the code executes, the data members are&lt;br /&gt;
destroyed using their respective destructors in the reverse order&lt;br /&gt;
in which they were constructed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
  public:&lt;br /&gt;
    Complex(double r=0, double i=0): re(r), im(i) {}  // Constructor&lt;br /&gt;
    ~Complex() {}                                     // Destructor&lt;br /&gt;
    // Other members...&lt;br /&gt;
  };&lt;br /&gt;
  Complex a(1,2), b(3), c=4, d;  // (1,2) (3,0) (4,0) (0,0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A constructor defines a conversion function for creating temporary&lt;br /&gt;
objects.  A constructor that allows 1 argument allows implicit conversion&lt;br /&gt;
wherever needed, such as in expressions, parameter passing, assignment,&lt;br /&gt;
and initialization.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Complex(3, 4).real();  // 3&lt;br /&gt;
  a = 5;                 // Implicit a = Complex(5) or a = Complex(5, 0)&lt;br /&gt;
&lt;br /&gt;
  void assign_if(bool, Complex&amp;amp;amp;, const Complex&amp;amp;amp;);&lt;br /&gt;
  assign_if(true, a, 6); // Implicit Complex(6) passed to third parameter&lt;br /&gt;
  assign_if(true, 6, a); // Error, non-const reference to Complex(6), which is const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Operators may be overloaded as members.  The expression &amp;lt;tt&amp;gt;aXb&amp;lt;/tt&amp;gt; for&lt;br /&gt;
operator X can match either &amp;lt;tt&amp;gt;operator X(a, b)&amp;lt;/tt&amp;gt; (global)&lt;br /&gt;
or &amp;lt;tt&amp;gt;a.operator X(b)&amp;lt;/tt&amp;gt; (member function), but not both.&lt;br /&gt;
Unary operators omit b.&lt;br /&gt;
Operators =, [], and -&amp;gt; can only be overloaded as member functions.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
  public:&lt;br /&gt;
    Complex operator + (const Complex&amp;amp; b) const { // const because a+b doesn't change a&lt;br /&gt;
      return Complex(re+b.re, im+b.im);&lt;br /&gt;
    }&lt;br /&gt;
    // ...&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  Complex operator - (const Complex&amp;amp; a, const Complex&amp;amp; b) {&lt;br /&gt;
    return Complex(a.real()-b.real(), a.imag()-b.imag());&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  Complex a(1, 2), b(3, 4);&lt;br /&gt;
  a+b;                    // OK, a.operator+(b) == Complex(4, 6)&lt;br /&gt;
  a-b;                    // OK, operator-(a, b) == Complex(-2, -2)&lt;br /&gt;
  a+10;                   // OK, Complex(1, 12), implicit a+Complex(10, 0)&lt;br /&gt;
  10+a;                   // Error, 10 has no member operator+(Complex)&lt;br /&gt;
  a-10;                   // OK, Complex(1, -8)&lt;br /&gt;
  10-a;                   // OK, Complex(7, -4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;The member function (+) has the advantage of private access (including to&lt;br /&gt;
other objects of the same class), but can only do&lt;br /&gt;
implicit conversions on the right side.  The global function (-) is&lt;br /&gt;
symmetrical, but lacks private access.  A &amp;lt;tt&amp;gt;friend&amp;lt;/tt&amp;gt; declaration&lt;br /&gt;
(in either the private or public section) allows private access to&lt;br /&gt;
a global function.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
    friend Complex operator-(const Complex&amp;amp;, const Complex&amp;amp;);&lt;br /&gt;
    friend class T;       // All member functions of class T are friends&lt;br /&gt;
    // ...&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A conversion operator allows implicit conversion to another type.&lt;br /&gt;
It has the form of a member function named &amp;lt;tt&amp;gt;operator T() const&amp;lt;/tt&amp;gt; with&lt;br /&gt;
implied return type T.  It is generally a good idea to allow implicit&lt;br /&gt;
conversions in only one direction, preferably with constructors, so&lt;br /&gt;
this member function is usually used to convert to pre-existing types.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
  public:&lt;br /&gt;
    operator double() const {return re;}&lt;br /&gt;
    // ...&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  Complex a(1, 2);&lt;br /&gt;
  a-10;                  // Error, double(a)-10 or a-Complex(10) ?&lt;br /&gt;
  a-Complex(10);         // Complex(-9, 2);&lt;br /&gt;
  double(a)-10;          // -9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An &amp;lt;tt&amp;gt;explicit&amp;lt;/tt&amp;gt; constructor does not allow implicit conversions.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
    explicit Complex(double r=0, double i=0);&lt;br /&gt;
    // ...&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  Complex a=1;           // Error&lt;br /&gt;
  Complex a(1);          // OK&lt;br /&gt;
  a-10;                  // OK, double(a)-10 = -9&lt;br /&gt;
  a-Complex(10);         // OK, Complex(-9, 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=templateclass&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;A class or member function may be &amp;lt;b&amp;gt;templated&amp;lt;/b&amp;gt;.&lt;br /&gt;
The type parameter must be passed in&lt;br /&gt;
the declaration for objects of the class.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
    T re, im;&lt;br /&gt;
  public:&lt;br /&gt;
    T real() const {return re;}&lt;br /&gt;
    T imag() const {return im;}&lt;br /&gt;
    Complex(T r=0, T i=0);&lt;br /&gt;
    friend Complex&amp;amp;lt;T&amp;gt; operator - (const Complex&amp;amp;lt;T&amp;gt;&amp;amp;, const Complex&amp;amp;lt;T&amp;gt;&amp;amp;);&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt;&lt;br /&gt;
  Complex&amp;amp;lt;T&amp;gt;::Complex(T r, T i): re(r), im(i) {}&lt;br /&gt;
&lt;br /&gt;
  Complex&amp;amp;lt;int&amp;gt; a(1, 2);               // Complex of int&lt;br /&gt;
  Complex&amp;amp;lt;double&amp;gt; b(1.0, 2.0);        // Complex of double&lt;br /&gt;
  a=a-Complex&amp;amp;lt;int&amp;gt;(3, 4);             // Complex&amp;amp;lt;int&amp;gt;(-2, -2)&lt;br /&gt;
  Complex&amp;amp;lt;Complex&amp;amp;lt;double&amp;gt; &amp;gt; c(b, b);  // Note space, not &amp;gt;&amp;gt;&lt;br /&gt;
  c.real().imag();                    // 2.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Templates can have default arguments and int parameters.  The argument&lt;br /&gt;
to an int parameter must be a value known at compile time.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  template &amp;amp;lt;class T, class U=T, int n=0&amp;gt; class V {};&lt;br /&gt;
  V&amp;amp;lt;double, string, 3&amp;gt; v1;&lt;br /&gt;
  V&amp;amp;lt;char&amp;gt; v2;  // V&amp;amp;lt;char, char, 0&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Classes define default behavior for copying and assignment, which is&lt;br /&gt;
to copy/assign each data member.  This behavior can be overridden by&lt;br /&gt;
writing a &amp;lt;i&amp;gt;copy constructor&amp;lt;/i&amp;gt; and &amp;lt;tt&amp;gt;operator=&amp;lt;/tt&amp;gt; as members,&lt;br /&gt;
both taking arguments of the same type, passed by const reference.&lt;br /&gt;
They are usually required in classes that have destructors, such as the&lt;br /&gt;
&amp;lt;tt&amp;gt;vector&amp;amp;lt;T&amp;gt;&amp;lt;/tt&amp;gt;-like class below.  If we did not overload these,&lt;br /&gt;
the default behavior would be to copy the data pointer, resulting in&lt;br /&gt;
two Vectors pointing into the same array.  The assignment operator&lt;br /&gt;
normally returns itself (&amp;lt;tt&amp;gt;*this&amp;lt;/tt&amp;gt;) by reference to allow&lt;br /&gt;
expressions of the form &amp;lt;tt&amp;gt;a=b=c;&amp;lt;/tt&amp;gt;, but is not required to do so.&lt;br /&gt;
&amp;lt;tt&amp;gt;this&amp;lt;/tt&amp;gt; means the address of the current object; thus any member&lt;br /&gt;
&amp;lt;tt&amp;gt;m&amp;lt;/tt&amp;gt; may also be called &amp;lt;tt&amp;gt;this-&amp;gt;m&amp;lt;/tt&amp;gt; within a member function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt;&lt;br /&gt;
  class Vector {&lt;br /&gt;
  private:&lt;br /&gt;
    T* data;  // Array of n elements&lt;br /&gt;
    int n;    // size()&lt;br /&gt;
  public:&lt;br /&gt;
    typedef T* iterator;                      // Vector&amp;lt;T&amp;gt;::iterator means T*&lt;br /&gt;
    typedef const T* const_iterator;          // Iterators for const Vector&lt;br /&gt;
    int size() const {return n;}              // Number of elements&lt;br /&gt;
    T&amp;amp; operator[](int i) {return data[i];}    // i'th element&lt;br /&gt;
    const T&amp;amp; operator[](int i) const {return data[i];}  // i'th element of const Vector&lt;br /&gt;
    iterator begin() {return data;}           // First, last+1 elements&lt;br /&gt;
    iterator end() {return data+size();}&lt;br /&gt;
    const_iterator begin() const {return data;}  // Const versions&lt;br /&gt;
    const_iterator end() const {return data+size();}&lt;br /&gt;
    Vector(int i=0): data(new T[i]), n(i) {}  // Create with size i&lt;br /&gt;
    ~Vector() {delete[] data;}                // Return memory&lt;br /&gt;
    Vector(const Vector&amp;amp;lt;T&amp;gt;&amp;amp; v): data(new T[v.n]), n(v.n) {  // Copy constructor&lt;br /&gt;
      copy(v.begin(), v.end(), begin());&lt;br /&gt;
    }&lt;br /&gt;
    Vector&amp;amp; operator=(const Vector&amp;amp; v) {      // Assignment&lt;br /&gt;
      if (&amp;amp;amp;v != this) {                       // Assignment to self?&lt;br /&gt;
        delete[] data;                        // If not, resize and copy&lt;br /&gt;
        data=new T[n=v.n];&lt;br /&gt;
        copy(v.begin(), v.end(), begin());&lt;br /&gt;
      }&lt;br /&gt;
      return *this;                           // Allow a=b=c;&lt;br /&gt;
    }&lt;br /&gt;
    template &amp;amp;lt;class P&amp;gt; Vector(P b, P e): data(new T[e-b]), n(e-b) {  // Templated member&lt;br /&gt;
      copy(b, e, data);                       // Initialize from sequence [b, e)&lt;br /&gt;
    }&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A type defined in a class is accessed through&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;::&amp;lt;/i&amp;gt;type&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Vector&amp;amp;lt;int&amp;gt;::iterator p;        // Type is int*&lt;br /&gt;
  Vector&amp;amp;lt;int&amp;gt;::const_iterator cp; // Type is const int*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Member functions may be overloaded on &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Overloaded member functions need&lt;br /&gt;
not have the same return types.  &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt; member functions should not&lt;br /&gt;
return non-const references or pointers to data members.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Vector&amp;amp;lt;int&amp;gt; v(10);              // Uses non-const [], begin(), end()&lt;br /&gt;
  const Vector&amp;amp;lt;int&amp;gt; cv(10);       // Uses const [], begin(), end()&lt;br /&gt;
  cv=v;                           // Error, non-const operator= called on cv&lt;br /&gt;
  v[5]=cv[5];                     // OK. assigns to int&amp;amp;&lt;br /&gt;
  cv[5]=v[5];                     // Error, assigns to const int&amp;amp;&lt;br /&gt;
  p=cv.begin();                   // Error, would allow *p=x to write into cv&lt;br /&gt;
  cp=cv.begin();                  // OK because can't assign to *cp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=defining_iterators&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Defining Iterators&amp;lt;/b&amp;gt;.&lt;br /&gt;
Sometimes a container's iterator types must be defined as nested&lt;br /&gt;
classes overloading the usual pointer operations rather than typedef'ed&lt;br /&gt;
to pointers.&lt;br /&gt;
In order to work properly with functions defined in&lt;br /&gt;
&amp;lt;a href=#algorithm&amp;gt;&amp;amp;lt;algorithm&amp;gt;&amp;lt;/a&amp;gt;, iterators should define the following&lt;br /&gt;
5 public typedefs:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;iterator_category&amp;lt;/tt&amp;gt;: one of the following (defined in &amp;lt;tt&amp;gt;&amp;amp;lt;iterator&amp;gt;&amp;lt;/tt&amp;gt;):&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;output_iterator_tag&amp;lt;/tt&amp;gt;  (if sequential writing is supported)&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;input_iterator_tag&amp;lt;/tt&amp;gt;   (if sequential reading is supported)&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;forward_iterator_tag&amp;lt;/tt&amp;gt; (if both are supported)&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;bidirectional_iterator_tag&amp;lt;/tt&amp;gt;  (if the iterator can be decremented)&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;random_access_iterator_tag&amp;lt;/tt&amp;gt;  (if all pointer operations are supported)&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;value_type&amp;lt;/tt&amp;gt;: the type of the elements, for example, &amp;lt;tt&amp;gt;T&amp;lt;/tt&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;difference_type&amp;lt;/tt&amp;gt;: the result of iterator subtraction, usually &amp;lt;tt&amp;gt;ptrdiff_t&amp;lt;/tt&amp;gt; (a signed int type)&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;pointer&amp;lt;/tt&amp;gt;: the type returned by &amp;lt;tt&amp;gt;operator-&amp;gt;()&amp;lt;/tt&amp;gt;, usually &amp;lt;tt&amp;gt;T*&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;const T*&amp;lt;/tt&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;reference&amp;lt;/tt&amp;gt;: the type returned by &amp;lt;tt&amp;gt;operator*()&amp;lt;/tt&amp;gt;, usually &amp;lt;tt&amp;gt;T&amp;amp;&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;const T&amp;amp;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Operator -&amp;gt; should be overloaded as a unary function returning a&lt;br /&gt;
pointer to a class to which -&amp;gt; will be applied, i.e. &amp;lt;tt&amp;gt;x-&amp;gt;m&amp;lt;/tt&amp;gt; is&lt;br /&gt;
interpreted as &amp;lt;tt&amp;gt;x.operator-&amp;gt;()-&amp;gt;m&amp;lt;/tt&amp;gt;.  Nested class members&lt;br /&gt;
are named Outer::Inner::member.  Outer and inner classes cannot access&lt;br /&gt;
each other's private members.  Templated members defined outside the&lt;br /&gt;
class need their own template declarations.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt; class Vector {&lt;br /&gt;
  public:&lt;br /&gt;
&lt;br /&gt;
    // Reverse iterator for Vector, i.e. ++p goes to the previous element.&lt;br /&gt;
    class reverse_iterator {&lt;br /&gt;
    private:&lt;br /&gt;
      T* p;                                // Points to current element&lt;br /&gt;
    public:&lt;br /&gt;
&lt;br /&gt;
      // typedefs needed to work with &amp;amp;lt;algorithm&amp;gt; functions&lt;br /&gt;
      typedef std::random_access_iterator_tag iterator_category;  // Defined in &amp;amp;lt;iterator&amp;gt;&lt;br /&gt;
      typedef T value_type;                // Type of element&lt;br /&gt;
      typedef ptrdiff_t difference_type;   // Result of iterator subtraction, usually int&lt;br /&gt;
      typedef T* pointer;                  // Type returned by operator -&amp;gt;&lt;br /&gt;
      typedef T&amp;amp; reference;                // Type returned by operator *&lt;br /&gt;
&lt;br /&gt;
      reverse_iterator(T* a=0): p(a) {}    // Implicit conversion from T* and iterator&lt;br /&gt;
      iterator base() const {return p;}    // Convert to normal iterator&lt;br /&gt;
&lt;br /&gt;
      // Forward operators&lt;br /&gt;
      reverse_iterator&amp;amp; operator++() {--p; return *this;} // prefix&lt;br /&gt;
      reverse_iterator  operator++(int);                  // postfix, we pretend it's binary&lt;br /&gt;
      reference operator*() const {return *p;}&lt;br /&gt;
      pointer operator-&amp;gt;() const {return p;}              // We pretend it's unary&lt;br /&gt;
      bool operator==(Vector&amp;amp;lt;T&amp;gt;::reverse_iterator b) const {return p==b.p;}&lt;br /&gt;
      bool operator!=(Vector&amp;amp;lt;T&amp;gt;::reverse_iterator b) const {return p!=b.p;}&lt;br /&gt;
      // Also, bidirectional and random operators&lt;br /&gt;
    };&lt;br /&gt;
    reverse_iterator rbegin() {return end()-1;}&lt;br /&gt;
    reverse_iterator rend() {return begin()-1;}&lt;br /&gt;
    // Other members...&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  // Code for postfix ++&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt;&lt;br /&gt;
  inline Vector&amp;amp;lt;T&amp;gt;::reverse_iterator Vector::reverse_iterator::operator++(int dummy) {&lt;br /&gt;
    Vector&amp;amp;lt;T&amp;gt;::reverse_iterator result = *this;&lt;br /&gt;
    ++*this;&lt;br /&gt;
    return result;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  // Print a Vector in reverse order&lt;br /&gt;
  int main() {&lt;br /&gt;
    Vector&amp;amp;lt;int&amp;gt; a(10);&lt;br /&gt;
    for (Vector&amp;amp;lt;int&amp;gt;::reverse_iterator p=a.rbegin(); p!=a.rend(); ++p)&lt;br /&gt;
      cout &amp;amp;lt;&amp;amp;lt; *p &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;vector&amp;amp;lt;T&amp;gt;&amp;lt;/tt&amp;gt; supplies random&lt;br /&gt;
&amp;lt;tt&amp;gt;reverse_iterator&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;const_reverse_iterator&amp;lt;/tt&amp;gt;&lt;br /&gt;
as above.  Const iterators would typedef &amp;lt;tt&amp;gt;pointer&amp;lt;/tt&amp;gt; as &amp;lt;tt&amp;gt;const T*&amp;lt;/tt&amp;gt;&lt;br /&gt;
and &amp;lt;tt&amp;gt;reference&amp;lt;/tt&amp;gt; as &amp;lt;tt&amp;gt;const T&amp;amp;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A &amp;lt;tt&amp;gt;static&amp;lt;/tt&amp;gt; data member is shared by all instances of a class.&lt;br /&gt;
It must be initialized in a separate declaration, not in the class definition&lt;br /&gt;
or in the constructor initialization list.  A &amp;lt;tt&amp;gt;static&amp;lt;/tt&amp;gt; member function&lt;br /&gt;
cannot refer to &amp;lt;tt&amp;gt;this&amp;lt;/tt&amp;gt; or any&lt;br /&gt;
non-static members (and therefore it makes no sense to make them&lt;br /&gt;
&amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt;).  Static members may be referenced either as&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;i&amp;gt;object.member&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;::&amp;lt;i&amp;gt;member&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Counter {&lt;br /&gt;
    static int count;  // Number of Counters that currently exist (private)&lt;br /&gt;
  public:&lt;br /&gt;
    static int get() {return count;}&lt;br /&gt;
    Counter() {++count;}&lt;br /&gt;
    ~Counter() {--count;}&lt;br /&gt;
    Counter(const Counter&amp;amp; c) {++count;}  // Default would be wrong&lt;br /&gt;
    Counter&amp;amp; operator=(const Counter&amp;amp; c) {return *this;}  // Default would be OK&lt;br /&gt;
  };&lt;br /&gt;
  int Counter::count = 0;  // Initialize here, OK if private&lt;br /&gt;
  main() {&lt;br /&gt;
    Counter a, b, c;&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; b.get();         // 3&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; Counter::get();  // 3&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=inheritance&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Inheritance&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inheritance is used to write a specialized or enhanced version of&lt;br /&gt;
another class.  For example, an &amp;lt;tt&amp;gt;ofstream&amp;lt;/tt&amp;gt; is a type of&lt;br /&gt;
&amp;lt;tt&amp;gt;ostream&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;tt&amp;gt;class &amp;lt;i&amp;gt;D&amp;lt;/i&amp;gt;: public &amp;lt;i&amp;gt;B&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt; defines class D as&lt;br /&gt;
&amp;lt;i&amp;gt;derived&amp;lt;/i&amp;gt; from (subclass of) &amp;lt;i&amp;gt;base&amp;lt;/i&amp;gt; class (superclass) B,&lt;br /&gt;
meaning that D &amp;lt;i&amp;gt;inherits&amp;lt;/i&amp;gt;&lt;br /&gt;
all of B's members, except the constructors, destructor, and assignment&lt;br /&gt;
operator.  The default behavior of these special member functions is to treat&lt;br /&gt;
the base class as a data member.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class String: public Vector&amp;amp;lt;char&amp;gt; {&lt;br /&gt;
  public:&lt;br /&gt;
    String(const char* s=&amp;quot;&amp;quot;): Vector&amp;amp;lt;char&amp;gt;(strlen(s)) {&lt;br /&gt;
      copy(s, s+strlen(s), begin());  // Inherits Vector&amp;amp;lt;char&amp;gt;::begin()&lt;br /&gt;
    }&lt;br /&gt;
  };&lt;br /&gt;
  String a=&amp;quot;hello&amp;quot;; // Calls Vector&amp;amp;lt;char&amp;gt;::Vector(5);&lt;br /&gt;
  a.size();         // 5, inherits Vector&amp;amp;lt;char&amp;gt;::size()&lt;br /&gt;
  a[0]='j';         // &amp;quot;jello&amp;quot;, inherits Vector&amp;amp;lt;char&amp;gt;::operator[]&lt;br /&gt;
  String b=a;       // Default copy constructor uses Vector's copy constructor on base part&lt;br /&gt;
  b=a;              // Default = calls Vector's assignment operator on base part&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The default destructor &amp;lt;tt&amp;gt;String::~String() {}&amp;lt;/tt&amp;gt; is correct,&lt;br /&gt;
since in the process of destroying a String, the base is also&lt;br /&gt;
destroyed, calling &amp;lt;tt&amp;gt;Vector&amp;amp;lt;char&amp;gt;::~Vector() {delete data[];}&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Since there is no need to write a destructor, there is no need to&lt;br /&gt;
redefine copying or assignment either.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Although &amp;lt;tt&amp;gt;String&amp;lt;/tt&amp;gt; inherits &amp;lt;tt&amp;gt;Vector&amp;amp;lt;char&amp;gt;::data&amp;lt;/tt&amp;gt;,&lt;br /&gt;
it is private&lt;br /&gt;
and inaccessible.  A &amp;lt;tt&amp;gt;protected&amp;lt;/tt&amp;gt; member is accessible to derived&lt;br /&gt;
classes but private elsewhere.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class B {&lt;br /&gt;
  protected:&lt;br /&gt;
    int x;&lt;br /&gt;
  } b;                            // Declare class B and object b&lt;br /&gt;
  b.x=1;                          // Error, x is protected&lt;br /&gt;
&lt;br /&gt;
  class D: public B {&lt;br /&gt;
    void f() {x=1;}               // OK&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, a base class is private, making all inherited members&lt;br /&gt;
private.  Private base classes are rare and typically used as&lt;br /&gt;
implementations rather than specializations (A string is a vector,&lt;br /&gt;
but a stack is not).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Stack: Vector&amp;amp;lt;int&amp;gt; {  // or class Stack: private Vector&amp;amp;lt;int&amp;gt;&lt;br /&gt;
  public:&lt;br /&gt;
    bool empty() const {return size()==0;}  // OK&lt;br /&gt;
  } s;&lt;br /&gt;
  s.size();   // Error, private&lt;br /&gt;
  s.empty();  // OK, public&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A class may have more than one base class (called &amp;lt;i&amp;gt;multiple&lt;br /&gt;
inheritance&amp;lt;/i&amp;gt;).  If both bases are in&lt;br /&gt;
turn derived from a third base, then we derive from this root class using&lt;br /&gt;
&amp;lt;tt&amp;gt;virtual&amp;lt;/tt&amp;gt; to avoid inheriting its members twice further on.&lt;br /&gt;
Any indirectly derived class treats the virtual root as a direct base&lt;br /&gt;
class in the constructor initialization list.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ios {...};                                      // good(), binary, ...&lt;br /&gt;
  class fstreambase: public virtual ios {...};          // open(), close(), ...&lt;br /&gt;
  class istream: public virtual ios {...};              // get(), operator&amp;gt;&amp;gt;(), ...&lt;br /&gt;
  class ifstream: public fstreambase, public istream {  // Only 1 copy of ios&lt;br /&gt;
    ifstream(): fstreambase(), istream(), ios() {...}   // Normally ios() would be omitted&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=polymorphism&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Polymorphism&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Polymorphism is the technique of defining a common interface for a&lt;br /&gt;
hierarchy of classes.  To support this, a derived object is allowed&lt;br /&gt;
wherever a base object is expected.  For example,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  String s=&amp;quot;Hello&amp;quot;;&lt;br /&gt;
  Vector&amp;amp;lt;char&amp;gt; v=s;    // Discards derived part of s to convert&lt;br /&gt;
  Vector&amp;amp;lt;char&amp;gt;* p=&amp;amp;s;  // p points to base part of s&lt;br /&gt;
  try {throw s;} catch(Vector&amp;amp;lt;char&amp;gt; x) {}  // Caught with x set to base part of s&lt;br /&gt;
  s=Vector&amp;amp;lt;char&amp;gt;(5);   // Error, can't convert base to derived&lt;br /&gt;
&lt;br /&gt;
  // Allow output of Vector&amp;amp;lt;char&amp;gt; using normal notation&lt;br /&gt;
  ostream&amp;amp; operator &amp;amp;lt;&amp;amp;lt; (ostream&amp;amp; out, const Vector&amp;amp;lt;char&amp;gt;&amp;amp; v) {&lt;br /&gt;
    copy(v.begin(), v.end(), ostream_iterator&amp;amp;lt;char&amp;gt;(out, &amp;quot;&amp;quot;));  // Print v to out&lt;br /&gt;
    return out;        // To allow (cout &amp;amp;lt;&amp;amp;lt; a) &amp;amp;lt;&amp;amp;lt; b;&lt;br /&gt;
  }&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; s;           // OK, v refers to base part of s&lt;br /&gt;
  ofstream f(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
  f &amp;amp;lt;&amp;amp;lt; s;              // OK, ofstream is derived from ostream&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A derived class may redefine inherited member functions, overriding any&lt;br /&gt;
function&lt;br /&gt;
with the same name, parameters, return type, and const-ness (and hiding&lt;br /&gt;
other functions with the same name, thus the overriding function should&lt;br /&gt;
not be overloaded).&lt;br /&gt;
The function call is resolved at compile time.  This is incorrect in case&lt;br /&gt;
of a base pointer or reference to a derived object.  To allow run time&lt;br /&gt;
resolution, the base member function should be declared &amp;lt;tt&amp;gt;virtual&amp;lt;/tt&amp;gt;.  Since&lt;br /&gt;
the default destructor is not virtual, a virtual destructor should&lt;br /&gt;
be added to the base class.  If empty, no copy constructor or assignment&lt;br /&gt;
operator is required.  Constructors and = are never virtual.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Shape {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void draw() const;&lt;br /&gt;
    virtual ~Shape() {}&lt;br /&gt;
  };&lt;br /&gt;
  class Circle: public Shape {&lt;br /&gt;
  public:&lt;br /&gt;
    void draw() const;      // Must use same parameters, return type, and const&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  Shape s; s.draw();        // Shape::draw()&lt;br /&gt;
  Circle c; c.draw();       // Circle::draw()&lt;br /&gt;
  Shape&amp;amp; r=c; r.draw();     // Circle::draw() if virtual&lt;br /&gt;
  Shape* p=&amp;amp;c; p-&amp;gt;draw();   // Circle::draw() if virtual&lt;br /&gt;
  p=new Circle; p-&amp;gt;draw();  // Circle::draw() if virtual&lt;br /&gt;
  delete p;                 // Circle::~Circle() if virtual&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An &amp;lt;i&amp;gt;abstract&amp;lt;/i&amp;gt; base class defines an interface for one or&lt;br /&gt;
more derived classes, which are allowed to instantiate objects.&lt;br /&gt;
Abstractness can be enforced by using protected (not private) constructors&lt;br /&gt;
or using &amp;lt;i&amp;gt;pure virtual&amp;lt;/i&amp;gt; member functions, which must be overridden in&lt;br /&gt;
the derived class or else that class is abstract too.  A pure virtual&lt;br /&gt;
member function is declared &amp;lt;tt&amp;gt;=0;&amp;lt;/tt&amp;gt; and has no code defined.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Shape {&lt;br /&gt;
  protected:&lt;br /&gt;
    Shape();                 // Optional, but default would be public&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void draw() const = 0; // Pure virtual, no definition&lt;br /&gt;
    virtual ~Shape() {}&lt;br /&gt;
  };&lt;br /&gt;
  // Circle as before&lt;br /&gt;
&lt;br /&gt;
  Shape s;                   // Error, protected constructor, no Shape::draw()&lt;br /&gt;
  Circle c;                  // OK&lt;br /&gt;
  Shape&amp;amp; r=c; r.draw();      // OK, Circle::draw()&lt;br /&gt;
  Shape* p=new Circle();     // OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=runtimetype&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Run time type identification&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
C++ provides for run time type identification, although this usually&lt;br /&gt;
indicates a poor design.&lt;br /&gt;
&amp;lt;tt&amp;gt;dynamic_cast&amp;amp;lt;T&amp;gt;&amp;lt;/tt&amp;gt;(x) checks at run time whether a base pointer&lt;br /&gt;
or reference is to a derived object, and if so, does a conversion.&lt;br /&gt;
The base class must have at least one virtual function to use run time&lt;br /&gt;
type checking.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #include &amp;amp;lt;typeinfo&amp;gt;    // For typeid()&lt;br /&gt;
  typeid(*p)==typeid(T)  // true if p points to a T&lt;br /&gt;
  dynamic_cast&amp;amp;lt;T*&amp;gt;(p)    // Convert base pointer to derived T* or 0.&lt;br /&gt;
  dynamic_cast&amp;amp;lt;T&amp;amp;&amp;gt;(r)    // Convert base reference to derived T&amp;amp; or throw bad_cast()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class B {public: virtual void f(){}};&lt;br /&gt;
  class D: public B {public: int x;} d;  // Bad design, public member in D but not B&lt;br /&gt;
  B* p=&amp;amp;d; p-&amp;gt;x;                         // Error, no B::x&lt;br /&gt;
  D* q=p; q-&amp;gt;x;                          // Error, can't convert B* to D*&lt;br /&gt;
  q=(D*)p;  q-&amp;gt;x;                        // OK, but reinterpret_cast, no run time check&lt;br /&gt;
  q=dynamic_cast&amp;amp;lt;D*&amp;gt;(p); if (q) q-&amp;gt;x;    // OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=othertypes&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Other Types&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=typedef&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;b&amp;gt;typedef&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt; defines a synonym for a type.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  typedef char* Str;  // Str is a synonym for char*&lt;br /&gt;
  Str a, b[5], *c;    // char* a; char* b[5]; char** c;&lt;br /&gt;
  char* d=a;          // OK, really the same type&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=enum&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;&amp;lt;b&amp;gt;enum&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt; defines a type and a set of symbolic&lt;br /&gt;
values for it.  There is an implicit conversion to int and explicit&lt;br /&gt;
conversion from int to enum.  You can specify the int equivalents of&lt;br /&gt;
the symbolic names, or they default to successive values beginning&lt;br /&gt;
with 0.  Enums may be anonymous,&lt;br /&gt;
specifying the set of symbols and possibly objects without giving the&lt;br /&gt;
type a name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  enum Weekday {MON,TUE=1,WED,THU,FRI};  // Type declaration&lt;br /&gt;
  enum Weekday today=WED;                // Object declaration, has value 2&lt;br /&gt;
  today==2                               // true, implicit int(today)&lt;br /&gt;
  today=Weekday(3);                      // THU, conversion must be explicit&lt;br /&gt;
  enum {N=10};                           // Anonymous enum, only defines N&lt;br /&gt;
  int a[N];                              // OK, N is known at compile time&lt;br /&gt;
  enum {SAT,SUN} weekend=SAT;            // Object of anonymous type&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=struct&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;A &amp;lt;tt&amp;gt;&amp;lt;b&amp;gt;struct&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt; is a class where the default protection is&lt;br /&gt;
public instead of private.  A &amp;lt;tt&amp;gt;struct&amp;lt;/tt&amp;gt; can be initialized like an&lt;br /&gt;
array.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  struct Complex {double re, im;};     // Declare type&lt;br /&gt;
  Complex a, b={1,2}, *p=&amp;amp;amp;b;           // Declare objects&lt;br /&gt;
  a.re = p-&amp;gt;im;                        // Access members&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=union&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;A &amp;lt;tt&amp;gt;&amp;lt;b&amp;gt;union&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt; is a struct whose fields overlap in memory.&lt;br /&gt;
Unions can also be anonymous.  They may be used to implement variant records.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  union U {int i; double d;};  // sizeof(U) is larger of int or double&lt;br /&gt;
  U u; u.i=3;                  // overwrites u.d&lt;br /&gt;
&lt;br /&gt;
  // A variant record&lt;br /&gt;
  class Token {&lt;br /&gt;
    enum {INT, DOUBLE} type;   // which field is in use?&lt;br /&gt;
    union {int i; double d;} value;  // An anonymous union&lt;br /&gt;
  public:&lt;br /&gt;
    void print() const {&lt;br /&gt;
      if (type==INT) cout &amp;amp;lt;&amp;amp;lt; value.i;&lt;br /&gt;
      else cout &amp;amp;lt;&amp;amp;lt; value.d;&lt;br /&gt;
    }&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An enum, struct, class, or union type and a list of objects may&lt;br /&gt;
be declared together in a single statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {public: double re, im;} a, b={1,2}, *p=&amp;amp;amp;b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=programorganization&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Program Organization&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;For C++ programs that only use one source code file and the&lt;br /&gt;
standard library, the only rule is to declare things before using them:&lt;br /&gt;
type declarations before object declarations, and function declarations&lt;br /&gt;
or definitions before calling them.  However, implicitly inlined member&lt;br /&gt;
functions&lt;br /&gt;
may use members not yet declared, and templates may use names as long&lt;br /&gt;
as they are declared before instantiation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
    double real() const {return re;}  // OK&lt;br /&gt;
    double re, im;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Global and member functions (unless inlined or templated) and global&lt;br /&gt;
or class static objects are separately compilable units, and may appear&lt;br /&gt;
in separate source code (.cpp) files.  If they are defined and used&lt;br /&gt;
in different files, then a declaration is needed.  To insure that&lt;br /&gt;
the declaration and definition are consistent, the declaration should&lt;br /&gt;
be in a shared header file.  A shared header conventionally has a&lt;br /&gt;
&amp;lt;tt&amp;gt;.h&amp;lt;/tt&amp;gt; extension, and is inserted with a&lt;br /&gt;
&amp;lt;tt&amp;gt;#include &amp;quot;&amp;lt;i&amp;gt;filename&amp;lt;/i&amp;gt;.h&amp;quot;&amp;lt;/tt&amp;gt;, using double quotes to indicate&lt;br /&gt;
that the file is in the current directory.  Global variables are&lt;br /&gt;
declared with &amp;lt;tt&amp;gt;extern&amp;lt;/tt&amp;gt; without initialization.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// prog.h         // prog1.cpp        // prog2.cpp&lt;br /&gt;
extern int x;     #include &amp;quot;prog.h&amp;quot;   #include &amp;quot;prog.h&amp;quot;&lt;br /&gt;
int f();          int x=0;            int f() {&lt;br /&gt;
                  int main() {          return x;&lt;br /&gt;
                    f();              }&lt;br /&gt;
                    return 0;&lt;br /&gt;
                  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To compile,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;b&amp;gt;g++ prog1.cpp prog2.cpp -o prog&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This produces two object files (&amp;lt;tt&amp;gt;prog1.o, prog2.o&amp;lt;/tt&amp;gt;), and then links&lt;br /&gt;
them to produce the executable &amp;lt;tt&amp;gt;prog&amp;lt;/tt&amp;gt;.  g++ also accepts &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt;&lt;br /&gt;
files, which are linked only, saving time if the &amp;lt;tt&amp;gt;.cpp&amp;lt;/tt&amp;gt;&lt;br /&gt;
file was not changed.  To compile without linking, use &amp;lt;tt&amp;gt;-c&amp;lt;/tt&amp;gt;.&lt;br /&gt;
To optimize (compile slower but run faster), use &amp;lt;tt&amp;gt;-O&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The UNIX &amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt; command updates the executable as needed based&lt;br /&gt;
on the timestamps of source and &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt; files.  It requires a file&lt;br /&gt;
named &amp;lt;tt&amp;gt;Makefile&amp;lt;/tt&amp;gt; containing a set of dependencies of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;i&amp;gt;file: files which should be older than file&amp;lt;/i&amp;gt;&lt;br /&gt;
  (tab) &amp;lt;i&amp;gt;commands to update file&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Dependencies may be in any order.  The Makefile is executed repeatedly&lt;br /&gt;
until all dependencies are satisfied.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Makefile comment&lt;br /&gt;
  prog: prog1.o prog2.o&lt;br /&gt;
        g++ prog1.o prog2.o -o prog&lt;br /&gt;
&lt;br /&gt;
  prog1.o: prog1.cpp prog.h&lt;br /&gt;
        g++ -c prog1.cpp&lt;br /&gt;
&lt;br /&gt;
  prog2.o: prog2.cpp prog.h&lt;br /&gt;
        g++ -c prog2.cpp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compiler options for g++.  Other compilers may vary.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  g++ file1.cpp              Compile, produce executable a.out in UNIX&lt;br /&gt;
  g++ file1.cpp file2.o      Compile .cpp and link .o to executable a.out&lt;br /&gt;
  g++ -Wall                  Turn on all warnings&lt;br /&gt;
  g++ -c file1.cpp           Compile to file1.o, do not link&lt;br /&gt;
  g++ -o file1               Rename a.out to file1&lt;br /&gt;
  g++ -O                     Optimize executable for speed&lt;br /&gt;
  g++ -v                     Verbose mode&lt;br /&gt;
  g++ -DX=Y                  Equivalent to #define X Y&lt;br /&gt;
  g++ --help                 Show all g++ options&lt;br /&gt;
  gxx file1.cpp              Compile in Windows MS-DOS box (DJGPP) to A.EXE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Anything which is not a separately compilable unit may appear in&lt;br /&gt;
a header file, such as class definitions (but not function code unless&lt;br /&gt;
inlined), templated classes (including function code), templated&lt;br /&gt;
functions, and other &amp;lt;tt&amp;gt;#include&amp;lt;/tt&amp;gt; statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=namespaces&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Creating Libraries (namespaces)&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Libraries usually come in the form of a header and an object (&amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt;)&lt;br /&gt;
file.  To use them, &amp;lt;tt&amp;gt;#include &amp;quot;header.h&amp;quot;&amp;lt;/tt&amp;gt; and link the &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt;&lt;br /&gt;
file using g++.  If the &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt; was compiled in C rather than C++,&lt;br /&gt;
then indicate this with &amp;lt;tt&amp;gt;extern &amp;quot;C&amp;quot; {}&amp;lt;/tt&amp;gt; to turn off name mangling.&lt;br /&gt;
C++ encodes or &amp;quot;mangles&amp;quot; overloaded function names to allow them to be linked,&lt;br /&gt;
but C does not since it doesn't allow overloading.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  extern &amp;quot;C&amp;quot; {          // Turn off name mangling&lt;br /&gt;
  #include &amp;quot;header.h&amp;quot;   // Written in C&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When writing your own library, use a unique namespace name to prevent&lt;br /&gt;
conflicts with other libraries.  A namespace may span multiple&lt;br /&gt;
files.  Types, objects, and functions declared in a namespace N must&lt;br /&gt;
be prefixed with N:: when used outside the namespace, or there must&lt;br /&gt;
be a &amp;lt;tt&amp;gt;using namespace N;&amp;lt;/tt&amp;gt; in the current scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Also, to guard against possible multiple&lt;br /&gt;
inclusions of the header file, &amp;lt;tt&amp;gt;#define&amp;lt;/tt&amp;gt; some symbol and test&lt;br /&gt;
for it with &amp;lt;/tt&amp;gt;#ifndef ... #endif&amp;lt;/tt&amp;gt; on the first and last lines.&lt;br /&gt;
Don't have a &amp;lt;tt&amp;gt;using&lt;br /&gt;
namespace std;&amp;lt;/tt&amp;gt;, since the user may not want &amp;lt;tt&amp;gt;std&amp;lt;/tt&amp;gt; visible.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #ifndef MYLIB_H       // mylib.h, or use #if !defined(MYLIB_H)&lt;br /&gt;
  #define MYLIB_H&lt;br /&gt;
  #include &amp;amp;lt;string&amp;gt;&lt;br /&gt;
  // No using statement&lt;br /&gt;
  namespace mylib {&lt;br /&gt;
    class B {&lt;br /&gt;
    public:&lt;br /&gt;
      std::string f();  // No code&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  #endif&lt;br /&gt;
&lt;br /&gt;
  // mylib.cpp, becomes mylib.o&lt;br /&gt;
  #include &amp;amp;lt;string&amp;gt;&lt;br /&gt;
  #include &amp;quot;mylib.h&amp;quot;&lt;br /&gt;
  using namespace std;  // OK&lt;br /&gt;
  namespace mylib {&lt;br /&gt;
    string B::f() {return &amp;quot;hi&amp;quot;;}&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;#define&amp;lt;/tt&amp;gt; could be used to create constants through text substitution,&lt;br /&gt;
but it is better to use &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt; to allow type checking.&lt;br /&gt;
&amp;lt;tt&amp;gt;#define X Y&amp;lt;/tt&amp;gt; has the effect of replacing symbol X with&lt;br /&gt;
arbitrary text Y before compiling, equivalent to the g++ option &amp;lt;tt&amp;gt;-DX=Y&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Each compiler usually defines a different set of symbols, which&lt;br /&gt;
can be tested with &amp;lt;tt&amp;gt;#if, #ifdef, #ifndef, #elsif, #else&amp;lt;/tt&amp;gt;,&lt;br /&gt;
and &amp;lt;tt&amp;gt;#endif&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #ifdef unix  // Defined by most UNIX compilers&lt;br /&gt;
  // ...&lt;br /&gt;
  #else&lt;br /&gt;
  // ...&lt;br /&gt;
  #endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Preprocessor statements are one line (no semicolon).  They perform&lt;br /&gt;
text substitutions in the source code prior to compiling.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #include &amp;amp;lt;header&amp;gt;          // Standard header&lt;br /&gt;
  #include &amp;quot;header.h&amp;quot;        // Include header file from current directory&lt;br /&gt;
  #define X Y                // Replace X with Y in source code&lt;br /&gt;
  #define f(a,b) a##b        // Replace f(1,2) with 12&lt;br /&gt;
  #define X \                // Continue a # statement on next line&lt;br /&gt;
  #ifdef X                   // True if X is #defined&lt;br /&gt;
  #ifndef X                  // False if X is #defined&lt;br /&gt;
  #if !defined(X)            // Same&lt;br /&gt;
  #else                      // Optional after #if...&lt;br /&gt;
  #endif                     // Required&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=history&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;History of C++&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;C++ evolved from C, which in turn evolved from B, written by Ken&lt;br /&gt;
Thompson in 1970 as a variant of BCPL.  C was developed in the 1970's&lt;br /&gt;
by Brian Kernighan and Dennis Ritchie as a &amp;quot;portable assembly language&amp;quot;&lt;br /&gt;
to develop UNIX.  C became widely available when they published &amp;quot;The&lt;br /&gt;
C Programming Language&amp;quot; in 1983.  C lacked standard containers (string,&lt;br /&gt;
vector, map), iostreams, bool, const, references, classes, exceptions,&lt;br /&gt;
namespaces, new/delete, function and operator overloading, and&lt;br /&gt;
object-oriented capabilities.&lt;br /&gt;
I/O was done using &amp;lt;tt&amp;gt;&amp;amp;lt;stdio.h&amp;gt;&amp;lt;/tt&amp;gt;.  Strings were implemented as&lt;br /&gt;
fixed sized char[] arrays requiring functions to assign or compare them&lt;br /&gt;
(strcpy(), strcmp()).  Structs could not be assigned, and had to be&lt;br /&gt;
copied using memcpy().  Function arguments were not type checked.&lt;br /&gt;
Functions could only modify arguments by passing their addresses.&lt;br /&gt;
Memory allocation was done using malloc(), which requires the number of&lt;br /&gt;
bytes to allocate and returns an untyped pointer or NULL if it fails.&lt;br /&gt;
The language allowed unsafe implicit conversions such as int to pointers.&lt;br /&gt;
Variables had to be declared before the first statement.  There was&lt;br /&gt;
no &amp;lt;tt&amp;gt;inline&amp;lt;/tt&amp;gt;, so macros were often used in place of small functions.&lt;br /&gt;
Hardware was slow and optimizers were not very good, so it was common&lt;br /&gt;
to declare &amp;lt;tt&amp;gt;register&amp;lt;/tt&amp;gt; variables.  There were no // style comments.&lt;br /&gt;
For instance,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /* Copy argv[1] to buf and print it */&lt;br /&gt;
  #include &amp;amp;lt;stdio.h&amp;gt;         /* No cout, use printf()                             */&lt;br /&gt;
  #include &amp;amp;lt;string.h&amp;gt;        /* No string type, use char*                         */&lt;br /&gt;
  #include &amp;amp;lt;stdlib.h&amp;gt;        /* No new/delete, use malloc/free                    */&lt;br /&gt;
  main(argc, argv)           /* Return type defaults to int */&lt;br /&gt;
  int argc;                  /* Old style parameter declaration, no type checking */&lt;br /&gt;
  char** argv;&lt;br /&gt;
  {                          /* No namespace std                                  */&lt;br /&gt;
    char* buf;               /* All declarations before the first statement       */&lt;br /&gt;
    if (argc&amp;gt;1) {&lt;br /&gt;
      buf=(char*)malloc((strlen(argv[1])+1)*sizeof(char));  /* Cast optional      */&lt;br /&gt;
      strcpy(buf, argv[1]);  /* Can't assign, no range check                      */&lt;br /&gt;
      printf(&amp;quot;%s\n&amp;quot;, buf);   /* Arguments not type checked                        */&lt;br /&gt;
      free(buf);             /* No delete */&lt;br /&gt;
    }&lt;br /&gt;
  }                          /* Return value is undefined (unchecked)             */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The ANSI C standard was finished in 1988.  It added &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt;,&lt;br /&gt;
new style function declaration with type checking, &amp;lt;tt&amp;gt;struct&amp;lt;/tt&amp;gt; assignment,&lt;br /&gt;
strict type checking of pointer assignments,&lt;br /&gt;
and specified the standard C library, which until now was widely used&lt;br /&gt;
but with minor, annoying variations.  However, many compilers did not&lt;br /&gt;
become ANSI compliant until the early 1990's.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In the 1980's Bjarne Stroustrup at AT&amp;amp;T developed &amp;quot;C with Classes&amp;quot;, later C++.&lt;br /&gt;
Early implementations were available for UNIX as &amp;lt;tt&amp;gt;cfront&amp;lt;/tt&amp;gt; (cc), a&lt;br /&gt;
C++ to C translator around 1990.&lt;br /&gt;
It added object oriented programming with&lt;br /&gt;
classes, inheritance, and polymorphism, also references, the iostream&lt;br /&gt;
library, and minor enhancements such as // style comments and the ability&lt;br /&gt;
to declare variables anywhere.  Because there were no namespaces,&lt;br /&gt;
the iostream header was named &amp;amp;lt;iostream.h&amp;gt; and no &amp;lt;tt&amp;gt;using&amp;lt;/tt&amp;gt;&lt;br /&gt;
statement was required.  Unlike C programs which always have a .c extension,&lt;br /&gt;
C++ didn't say, so .cpp, .cc  and .C were all common, and .hpp for headers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;GNU gcc and g++, which compiled C and C++&lt;br /&gt;
directly to machine code, were developed in the early 1990's.  Templates&lt;br /&gt;
were added in 1993.  Exceptions were added in 1994.&lt;br /&gt;
The standard&lt;br /&gt;
container library (originally called the standard template library&lt;br /&gt;
or STL) was developed by researchers at Hewlett-Packard and made&lt;br /&gt;
available free as&lt;br /&gt;
a separate download in the mid 1990's and ported to several compilers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;ANSI standard C++ compilers became available in 1998.  This added&lt;br /&gt;
STL to the standard library, added multiple inheritance, namespaces,&lt;br /&gt;
type bool, and run time type checking (dynamic_cast, typeid).  The&lt;br /&gt;
&amp;lt;tt&amp;gt;.h&amp;lt;/tt&amp;gt; extension on headers was dropped.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;C++ most likely succeeded where other early object oriented languages&lt;br /&gt;
failed (Simula67, Actor, Eiffel, SmallTalk) because it was backwards&lt;br /&gt;
compatible with C, allowing old code to be used, and because C programmers&lt;br /&gt;
could use it immediately without learning the new features.  However, there&lt;br /&gt;
are a few incompatibilities.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Old style function declarations are not allowed.&lt;br /&gt;
&amp;lt;li&amp;gt;Conversion from &amp;lt;tt&amp;gt;void*&amp;lt;/tt&amp;gt; (returned by &amp;lt;tt&amp;gt;malloc()&amp;lt;/tt&amp;gt;) requires&lt;br /&gt;
a cast.&lt;br /&gt;
&amp;lt;li&amp;gt;There are many new reserved words.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;There are also some incompatibilities between old (before 1998)&lt;br /&gt;
and new versions of C++.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt; was changed to throw type &amp;lt;tt&amp;gt;bad_alloc&amp;lt;/tt&amp;gt; if out&lt;br /&gt;
of memory, instead of returning 0.&lt;br /&gt;
&amp;lt;li&amp;gt;The scope of a variable declared in a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop was changed&lt;br /&gt;
to be local to the loop and not beyond it (not yet implemented by&lt;br /&gt;
Microsoft Visual C++)&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;g++ does not yet implement all ANSI C++ features.  For instance,&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Type &amp;lt;tt&amp;gt;ostringstream&amp;lt;/tt&amp;gt; allowing formatted writing to strings.&lt;br /&gt;
&amp;lt;li&amp;gt;Run time bounds checking of vector indexes using v.at(i)&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The largest integer type is 32 bits in most implementations, but&lt;br /&gt;
as 64 bit machines become common it is possible that type &amp;lt;tt&amp;gt;long&amp;lt;/tt&amp;gt;&lt;br /&gt;
could become a 64 bit type (as in Java) in the future.&lt;br /&gt;
g++ supports the nonstandard 64-bit integer type &amp;lt;tt&amp;gt;long long&amp;lt;/tt&amp;gt;, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  unsigned long long bigzero=0LLU;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Most implementations of &amp;lt;tt&amp;gt;time()&amp;lt;/tt&amp;gt; return the number of seconds since&lt;br /&gt;
Jan. 1, 1970 as a &amp;lt;tt&amp;gt;time_t&amp;lt;/tt&amp;gt;, normally a signed 32-bit &amp;lt;tt&amp;gt;long&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Programs that use this implementation will fail on Jan. 19,&lt;br /&gt;
2038 at 3:14:08 AM as this value overflows and becomes negative.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=furtherreading&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Further Reading&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Brian W. Kernighan, &amp;lt;i&amp;gt;The C Programming Language&amp;lt;/i&amp;gt;, 2nd Ed.,&lt;br /&gt;
Prentice Hall, 1988.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Bjarne Stroustrup, &amp;lt;i&amp;gt;The C++ Programming Language&amp;lt;/i&amp;gt;, 3rd Ed,,&lt;br /&gt;
Addison Wesley, 1997.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Andrew Koenig, Barbara E. Moo, &amp;lt;i&amp;gt;Accelerated C++&amp;lt;/i&amp;gt;,&lt;br /&gt;
Addison Wesley, 2000.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=User:Benargee&amp;diff=376</id>
		<title>User:Benargee</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=User:Benargee&amp;diff=376"/>
		<updated>2015-10-22T23:32:03Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* GitHub */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Benargee]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
====DCS====&lt;br /&gt;
*[http://forums.eagle.ru/member.php?u=96654 Forum Profile]&lt;br /&gt;
====Arma====&lt;br /&gt;
*[https://community.bistudio.com/wiki/User:Benargee Wiki Profile]&lt;br /&gt;
*[http://forums.bistudio.com/member.php?105006-Benargee Forum Profile]&lt;br /&gt;
====Twitter====&lt;br /&gt;
*[https://twitter.com/benargee Benargee]&lt;br /&gt;
==Other Web Presence==&lt;br /&gt;
===DCS===&lt;br /&gt;
*[http://en.wiki.eagle.ru/wiki/User:Benargee Wiki]&lt;br /&gt;
**[http://en.wiki.eagle.ru/wiki/Special:Contributions/Benargee Contributions]&lt;br /&gt;
===Wikipedia===&lt;br /&gt;
*[http://en.wikipedia.org/wiki/User:Benargee User Page]&lt;br /&gt;
**[http://en.wikipedia.org/wiki/Special:Contributions/Benargee Contributions]&lt;br /&gt;
===[https://github.com/Benargee GitHub]===&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Hello_World&amp;diff=375</id>
		<title>Hello World</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Hello_World&amp;diff=375"/>
		<updated>2015-10-22T01:49:19Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Created page with &amp;quot;Hello World&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hello World&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Template_talk:Rating&amp;diff=374</id>
		<title>Template talk:Rating</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Template_talk:Rating&amp;diff=374"/>
		<updated>2015-10-22T01:48:54Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Created page with &amp;quot;TODO: Create simple template that uses stars out of five for rating stuff. use on page Recommended Software for example&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;TODO:&lt;br /&gt;
Create simple template that uses stars out of five for rating stuff. use on page [[Recommended Software]] for example&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=373</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=373"/>
		<updated>2015-10-22T00:23:33Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Dev */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*[https://www.google.ca/search?q=reclass Reclass]&lt;br /&gt;
*[https://www.google.ca/search?q=Cheat+Engine Cheat Engine]&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=372</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=372"/>
		<updated>2015-10-22T00:21:08Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Added Links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*[https://handbrake.fr/ HandBrake] [https://github.com/HandBrake/HandBrake GitHub]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Avidemux AviDemux]&lt;br /&gt;
*[http://www.videolan.org/vlc/index.html VLC media player]&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*[http://audacityteam.org/ Audacity]&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*[https://git-scm.com/downloads Git for windows]&lt;br /&gt;
*[https://tortoisegit.org/ TortoiseGit]&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*[https://www.visualstudio.com/ Microsoft Visual Studio]&lt;br /&gt;
*[https://www.hex-rays.com/products/ida/ IDA]&lt;br /&gt;
*Reclass&lt;br /&gt;
*Cheat Engine&lt;br /&gt;
*[https://sourcegear.com/diffmerge/ SourceGear DiffMerge]&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*[http://www.7-zip.org/ 7-zip]&lt;br /&gt;
*[http://www.rarlab.com/ WinRAR]&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*[http://battlefield.realmware.co.uk/bf4-settings-editor/downloads BF4 Settings Editor]&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*[https://en.wikipedia.org/wiki/MeshLab MeshLab]&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*[http://www.gimp.org/ GIMP]&lt;br /&gt;
*[https://inkscape.org InkScape] (vector)&lt;br /&gt;
*[http://www.getpaint.net/index.html Paint.NET]&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*[https://justgetflux.com/ f.lux] (screen dimmer)&lt;br /&gt;
*[https://www.teamviewer.com/en/index.aspx Teamviewer]&lt;br /&gt;
*[https://www.openoffice.org/ Open Office]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=About&amp;diff=371</id>
		<title>About</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=About&amp;diff=371"/>
		<updated>2015-10-18T04:35:30Z</updated>

		<summary type="html">&lt;p&gt;Benargee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Benargee=&lt;br /&gt;
[[User:Benargee]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[User talk:Benargee]]&lt;br /&gt;
&lt;br /&gt;
=Domain=&lt;br /&gt;
[http://www.namecheap.com/ NameCheap] -Registrar&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Web Host=&lt;br /&gt;
[http://www.NAMECHEAP.COM namecheap]&amp;lt;br&amp;gt;&lt;br /&gt;
MySQL 5.5.45 &amp;lt;br&amp;gt;&lt;br /&gt;
PHP 5.2, 5.3, 5.4, 5.5, '''5.6''', 7.0rc&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--Apache/2.4.10&amp;lt;br&amp;gt;--&amp;gt;&lt;br /&gt;
cPanel&lt;br /&gt;
&lt;br /&gt;
=Wiki=&lt;br /&gt;
[http://www.mediawiki.org MediaWiki] 1.24.1&lt;br /&gt;
&lt;br /&gt;
[[Wiki Guide]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Benargee's_Wiki]]&lt;br /&gt;
&lt;br /&gt;
=Wiki Changes=&lt;br /&gt;
[[Site Change Log]]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=About&amp;diff=370</id>
		<title>About</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=About&amp;diff=370"/>
		<updated>2015-10-18T04:33:33Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Domain */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Benargee=&lt;br /&gt;
[[User:Benargee]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[User talk:Benargee]]&lt;br /&gt;
&lt;br /&gt;
=Domain=&lt;br /&gt;
[http://www.namecheap.com/ NameCheap] -Registrar&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Web Host=&lt;br /&gt;
[http://www.NAMECHEAP.COM namecheap]&amp;lt;br&amp;gt;&lt;br /&gt;
MySQL 5.5.45 &amp;lt;br&amp;gt;&lt;br /&gt;
PHP 5.2, 5.3, 5.4, 5.5, '''5.6''', 7.0rc&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--Apache/2.4.10&amp;lt;br&amp;gt;--!&amp;gt;&lt;br /&gt;
cPanel&lt;br /&gt;
&lt;br /&gt;
=Wiki=&lt;br /&gt;
[http://www.mediawiki.org MediaWiki] 1.24.1&lt;br /&gt;
&lt;br /&gt;
[[Wiki Guide]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Benargee's_Wiki]]&lt;br /&gt;
&lt;br /&gt;
=Wiki Changes=&lt;br /&gt;
[[Site Change Log]]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=About&amp;diff=369</id>
		<title>About</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=About&amp;diff=369"/>
		<updated>2015-10-18T04:32:33Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Web Host */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Benargee=&lt;br /&gt;
[[User:Benargee]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[User talk:Benargee]]&lt;br /&gt;
&lt;br /&gt;
=Domain=&lt;br /&gt;
[http://www.namecheap.com/ NameCheap] -Registrar&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Web Host=&lt;br /&gt;
[http://www.NAMECHEAP.COM namecheap]&amp;lt;br&amp;gt;&lt;br /&gt;
MySQL 5.5.45 &amp;lt;br&amp;gt;&lt;br /&gt;
PHP 5.2, 5.3, 5.4, 5.5, '''5.6''', 7.0rc&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!--Apache/2.4.10&amp;lt;br&amp;gt;--!&amp;gt;&lt;br /&gt;
cPanel&lt;br /&gt;
&lt;br /&gt;
=Wiki=&lt;br /&gt;
[http://www.mediawiki.org MediaWiki] 1.24.1&lt;br /&gt;
&lt;br /&gt;
[[Wiki Guide]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Benargee's_Wiki]]&lt;br /&gt;
&lt;br /&gt;
=Wiki Changes=&lt;br /&gt;
[[Site Change Log]]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Site_Change_Log&amp;diff=368</id>
		<title>Site Change Log</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Site_Change_Log&amp;diff=368"/>
		<updated>2015-10-18T03:44:29Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Wiki transfer from old host&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=2014=&lt;br /&gt;
==December==&lt;br /&gt;
===9===&lt;br /&gt;
*Site founded &lt;br /&gt;
*Domain '''www.benargee.cf''' created with '''wiki.benargee.cf''' subdomain with freenom.com&lt;br /&gt;
*Website hosted with hostinger.in&lt;br /&gt;
*Installed MediaWiki 1.24.0&lt;br /&gt;
===11===&lt;br /&gt;
*Site Down&lt;br /&gt;
*'''benargee.cf''' deactivated by freenom&lt;br /&gt;
*MySQL and FTP exported from hostinger.in&lt;br /&gt;
===30===&lt;br /&gt;
*Site back up&lt;br /&gt;
*Domain '''[http://www.benargee.com www.benargee.com]''' created with '''[[Main Page|wiki.benargee.com]]''' subdomain with namecheap.com&lt;br /&gt;
*Domain hosted with hostinger.co.uk&lt;br /&gt;
*Wiki MySQL Impotorted from orignal freenom/.in&lt;br /&gt;
*Installed MediaWiki 1.24.1&lt;br /&gt;
===31===&lt;br /&gt;
*Site Registered and Indexed with [https://www.google.com/webmasters/tools/ Google Webmaster Tools]&lt;br /&gt;
*Site Indexed with [http://www.bing.com/toolbox/webmaster Bing Webmaster Tools]&lt;br /&gt;
=2015=&lt;br /&gt;
==January==&lt;br /&gt;
===20===&lt;br /&gt;
*Wiki rehosted after many issues with provisionhost's nameservers&lt;br /&gt;
*Used XML export/import for wiki pages&lt;br /&gt;
*Website hosted with provisionhost.com&lt;br /&gt;
&lt;br /&gt;
==October==&lt;br /&gt;
===12===&lt;br /&gt;
*Website hosted with namecheap.com&lt;br /&gt;
*Installed MediaWiki 1.24.1&lt;br /&gt;
===17===&lt;br /&gt;
*Wiki pages transferred from old Provision Host via phpMyAdmin (MySQL)&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=367</id>
		<title>Recommended Software</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Recommended_Software&amp;diff=367"/>
		<updated>2015-10-01T00:52:44Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Created page with &amp;quot;{{stub}}  Software that I use and personally recommend  ===Video=== *Handbrake *AviDemux *VLC media player  ===Audio=== *Audacity  ===GIT=== *Git for windows *TortoiseGit  ===...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
Software that I use and personally recommend&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
*Handbrake&lt;br /&gt;
*AviDemux&lt;br /&gt;
*VLC media player&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
*Audacity&lt;br /&gt;
&lt;br /&gt;
===GIT===&lt;br /&gt;
*Git for windows&lt;br /&gt;
*TortoiseGit&lt;br /&gt;
&lt;br /&gt;
===Dev===&lt;br /&gt;
*Microsoft Visual Studio&lt;br /&gt;
*IDA&lt;br /&gt;
*Reclass&lt;br /&gt;
*Cheat Engine&lt;br /&gt;
*SourceGear DiffMerge&lt;br /&gt;
&lt;br /&gt;
===Data Compression===&lt;br /&gt;
*7-zip&lt;br /&gt;
*win rar&lt;br /&gt;
&lt;br /&gt;
===Game utils===&lt;br /&gt;
*BF4 Settings Editor&lt;br /&gt;
&lt;br /&gt;
===Modelling===&lt;br /&gt;
*meshlab&lt;br /&gt;
&lt;br /&gt;
===Photo editing===&lt;br /&gt;
*GIMP&lt;br /&gt;
*InkScape (vector)&lt;br /&gt;
*Paint.net&lt;br /&gt;
&lt;br /&gt;
===FTP===&lt;br /&gt;
*Filezilla (bloat free option)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
*f.lux (screen dimmer)&lt;br /&gt;
*Teamviewer&lt;br /&gt;
*Open Office&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=How_To_Change_Default_Installation_Directory_Path_In_Windows_7&amp;diff=366</id>
		<title>How To Change Default Installation Directory Path In Windows 7</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=How_To_Change_Default_Installation_Directory_Path_In_Windows_7&amp;diff=366"/>
		<updated>2015-09-27T22:47:26Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Created page with &amp;quot;Category:Tutorials =64bit= #Run:%systemroot%\syswow64\regedit #Goto HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows \ CurrentVersion #Change these values: &amp;quot;ProgramFile...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Tutorials]]&lt;br /&gt;
=64bit=&lt;br /&gt;
#Run:%systemroot%\syswow64\regedit&lt;br /&gt;
#Goto HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows \ CurrentVersion&lt;br /&gt;
#Change these values: &amp;quot;ProgramFileDir x86&amp;quot;, &amp;quot;ProgramW6432Dir&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Sources==&lt;br /&gt;
*[http://fixitwizkid.com/threads/how-to-change-default-installation-directory-path-windows-7.8462/ fixitwizkid.com]&lt;br /&gt;
*[http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/how-do-you-change-the-default-installation/73450b25-d794-4f18-9add-75253b893343?auth=1 answers.microsoft.com]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=365</id>
		<title>KSP - Mods</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=365"/>
		<updated>2015-09-18T02:02:26Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Not Installed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ksp}}&lt;br /&gt;
=Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/18230 KerbalEngineer Redux] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/113111 Kerbal Inventory System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92514 Kerbal Attachment System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/47863 Precise Node] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/86677 Stage Recovery] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/104758 Waypoint Manager] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/68089 kOS]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/83305 RemoteTech]&lt;br /&gt;
**[http://forum.kerbalspaceprogram.com/threads/108669 RemoteTech XF]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/80369 SCANsat]&lt;br /&gt;
----&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/40667 TAC Life Support]&lt;br /&gt;
=Not Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92324 Chatterer]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/24786 Kerbal Alarm Clock]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/43901 Docking Port Alignment Indicator]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/96497 PlanetShine]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/20451 Ferram Aerospace Research]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/74195 Action Groups Extended]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/117471 RasterPropMonitor]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/50736  Automate Vertical Velocity and Altitude Control]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/50524 Enhanced Navball ]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/104694 Trajectories]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=364</id>
		<title>Programming Tutorials</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=364"/>
		<updated>2015-09-13T02:58:05Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /*Android*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
=Android=&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL2F07DBCDCC01493A Android Application Development Tutorials] - by [https://www.youtube.com/user/thenewboston thenewboston] - 200 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL6gx4Cwl9DGBsvRxJJOzG4r4k_zLKrnxl Android App Development for Beginners Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 77 videos - Last updated on Mar 4, 2015&lt;br /&gt;
&lt;br /&gt;
=C++=&lt;br /&gt;
* [http://alumni.cs.ucr.edu/~pdiloren/C++_Pointers/Learning C++ Pointers for REAL Dummies]&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79Cu5MYkyJ-u4SyQmMhFeC1C &amp;lt;nowiki&amp;gt;C++ Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79DLA5K3GLbIwf3baNVFO2Lq &amp;lt;nowiki&amp;gt;C++ Object Oriented Programming Video Tutorials For Beginners [Completed Series] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 91 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79AxxmZwARAh3J9SHNGarty8 Advanced C++ Programming Video Tutorials] by [https://www.youtube.com/user/LearningLad LearningLad] - 58 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL5jc9xFGsL8E12so1wlMS0r0hTQoJL74M Concurrent Programming with C++ 11] - by [https://www.youtube.com/user/BoQianTheProgrammer Bo Qian] - 10 videos - Last updated on Jun 25, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLAE85DE8440AA6B83 C++ Programming Tutorials Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 73 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLF541C2C1F671AEF6 C++ Programming Tutorials from thenewboston] - by [https://www.youtube.com/user/thenewboston thenewboston] - 29 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLD0D54219E5F2544D C++ GUI with Qt Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 14 videos - Last updated on Jun 30, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLZMkqlPED79zA8mDuijmhNK5Zg9PkREvS C++ Series] - by [https://www.youtube.com/user/Whiplashx86 Nathan Biefeld] - 8 videos - Last updated on Mar 28, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL318629B5E7919639 C++ Programming] - by [https://www.youtube.com/user/cgermany77 cgermany77] - 31 videos - Last updated on Jun 8, 2014&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=C=&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79CZ5kHTiQHcm-l2q8j06ofd &amp;lt;nowiki&amp;gt;C Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 28, 2015&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=363</id>
		<title>Programming Tutorials</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=363"/>
		<updated>2015-09-13T02:50:53Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /*Playlists*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
=C++=&lt;br /&gt;
* [http://alumni.cs.ucr.edu/~pdiloren/C++_Pointers/Learning C++ Pointers for REAL Dummies]&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79Cu5MYkyJ-u4SyQmMhFeC1C &amp;lt;nowiki&amp;gt;C++ Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79DLA5K3GLbIwf3baNVFO2Lq &amp;lt;nowiki&amp;gt;C++ Object Oriented Programming Video Tutorials For Beginners [Completed Series] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 91 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79AxxmZwARAh3J9SHNGarty8 Advanced C++ Programming Video Tutorials] by [https://www.youtube.com/user/LearningLad LearningLad] - 58 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL5jc9xFGsL8E12so1wlMS0r0hTQoJL74M Concurrent Programming with C++ 11] - by [https://www.youtube.com/user/BoQianTheProgrammer Bo Qian] - 10 videos - Last updated on Jun 25, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLAE85DE8440AA6B83 C++ Programming Tutorials Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 73 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLF541C2C1F671AEF6 C++ Programming Tutorials from thenewboston] - by [https://www.youtube.com/user/thenewboston thenewboston] - 29 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLD0D54219E5F2544D C++ GUI with Qt Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 14 videos - Last updated on Jun 30, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLZMkqlPED79zA8mDuijmhNK5Zg9PkREvS C++ Series] - by [https://www.youtube.com/user/Whiplashx86 Nathan Biefeld] - 8 videos - Last updated on Mar 28, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL318629B5E7919639 C++ Programming] - by [https://www.youtube.com/user/cgermany77 cgermany77] - 31 videos - Last updated on Jun 8, 2014&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=C=&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79CZ5kHTiQHcm-l2q8j06ofd &amp;lt;nowiki&amp;gt;C Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 28, 2015&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=362</id>
		<title>Programming Tutorials</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=362"/>
		<updated>2015-09-13T02:43:20Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /*C*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
=C++=&lt;br /&gt;
* [http://alumni.cs.ucr.edu/~pdiloren/C++_Pointers/Learning C++ Pointers for REAL Dummies]&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79Cu5MYkyJ-u4SyQmMhFeC1C &amp;lt;nowiki&amp;gt;C++ Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79DLA5K3GLbIwf3baNVFO2Lq &amp;lt;nowiki&amp;gt;C++ Object Oriented Programming Video Tutorials For Beginners [Completed Series] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 91 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79AxxmZwARAh3J9SHNGarty8 Advanced C++ Programming Video Tutorials] by [https://www.youtube.com/user/LearningLad LearningLad] - 58 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL5jc9xFGsL8E12so1wlMS0r0hTQoJL74M Concurrent Programming with C++ 11] - by [https://www.youtube.com/user/BoQianTheProgrammer Bo Qian] - 10 videos - Last updated on Jun 25, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLAE85DE8440AA6B83 C++ Programming Tutorials Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 73 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLF541C2C1F671AEF6 C++ Programming Tutorials from thenewboston] - by [https://www.youtube.com/user/thenewboston thenewboston] - 29 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLZMkqlPED79zA8mDuijmhNK5Zg9PkREvS C++ Series] - by [https://www.youtube.com/user/Whiplashx86 Nathan Biefeld] - 8 videos - Last updated on Mar 28, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL318629B5E7919639 C++ Programming] - by [https://www.youtube.com/user/cgermany77 cgermany77] - 31 videos - Last updated on Jun 8, 2014&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=C=&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79CZ5kHTiQHcm-l2q8j06ofd &amp;lt;nowiki&amp;gt;C Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 28, 2015&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=361</id>
		<title>Programming Tutorials</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=361"/>
		<updated>2015-09-13T02:37:44Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Playlists */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
=C++=&lt;br /&gt;
* [http://alumni.cs.ucr.edu/~pdiloren/C++_Pointers/Learning C++ Pointers for REAL Dummies]&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79Cu5MYkyJ-u4SyQmMhFeC1C &amp;lt;nowiki&amp;gt;C++ Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79AxxmZwARAh3J9SHNGarty8 Advanced C++ Programming Video Tutorials] by [https://www.youtube.com/user/LearningLad LearningLad] - 58 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL5jc9xFGsL8E12so1wlMS0r0hTQoJL74M Concurrent Programming with C++ 11] - by [https://www.youtube.com/user/BoQianTheProgrammer Bo Qian] - 10 videos - Last updated on Jun 25, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLAE85DE8440AA6B83 C++ Programming Tutorials Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 73 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLF541C2C1F671AEF6 C++ Programming Tutorials from thenewboston] - by [https://www.youtube.com/user/thenewboston thenewboston] - 29 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLZMkqlPED79zA8mDuijmhNK5Zg9PkREvS C++ Series] - by [https://www.youtube.com/user/Whiplashx86 Nathan Biefeld] - 8 videos - Last updated on Mar 28, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL318629B5E7919639 C++ Programming] - by [https://www.youtube.com/user/cgermany77 cgermany77] - 31 videos - Last updated on Jun 8, 2014&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=360</id>
		<title>Programming Tutorials</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=360"/>
		<updated>2015-09-09T01:43:11Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Playlists */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
=C++=&lt;br /&gt;
* [http://alumni.cs.ucr.edu/~pdiloren/C++_Pointers/Learning C++ Pointers for REAL Dummies]&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79Cu5MYkyJ-u4SyQmMhFeC1C &amp;lt;nowiki&amp;gt;C++ Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL5jc9xFGsL8E12so1wlMS0r0hTQoJL74M Concurrent Programming with C++ 11] - by [https://www.youtube.com/user/BoQianTheProgrammer Bo Qian] - 10 videos - Last updated on Jun 25, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLAE85DE8440AA6B83 C++ Programming Tutorials Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 73 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLF541C2C1F671AEF6 C++ Programming Tutorials from thenewboston] - by [https://www.youtube.com/user/thenewboston thenewboston] - 29 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLZMkqlPED79zA8mDuijmhNK5Zg9PkREvS C++ Series] - by [https://www.youtube.com/user/Whiplashx86 Nathan Biefeld] - 8 videos - Last updated on Mar 28, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL318629B5E7919639 C++ Programming] - by [https://www.youtube.com/user/cgermany77 cgermany77] - 31 videos - Last updated on Jun 8, 2014&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=359</id>
		<title>Programming Tutorials</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=359"/>
		<updated>2015-09-09T01:36:33Z</updated>

		<summary type="html">&lt;p&gt;Benargee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
=C++=&lt;br /&gt;
* [http://alumni.cs.ucr.edu/~pdiloren/C++_Pointers/Learning C++ Pointers for REAL Dummies]&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79Cu5MYkyJ-u4SyQmMhFeC1C &amp;lt;nowiki&amp;gt;C++ Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL5jc9xFGsL8E12so1wlMS0r0hTQoJL74M Concurrent Programming with C++ 11] - by [https://www.youtube.com/user/BoQianTheProgrammer Bo Qian] - 10 videos - Last updated on Jun 25, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLAE85DE8440AA6B83 C++ Programming Tutorials Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 73 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLF541C2C1F671AEF6 C++ Programming Tutorials from thenewboston] - by [https://www.youtube.com/user/thenewboston thenewboston] - 29 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLZMkqlPED79zA8mDuijmhNK5Zg9PkREvS C++ Series] - by [https://www.youtube.com/user/Whiplashx86 Nathan Biefeld] - 8 videos - Last updated on Mar 28, 2014&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=358</id>
		<title>Programming Tutorials</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Programming_Tutorials&amp;diff=358"/>
		<updated>2015-09-09T01:05:10Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Created page with &amp;quot;{{Stub}} =C++= ==YouTube== ===Playlists=== *[https://www.youtube.com/playlist?list=PLfVsf4Bjg79Cu5MYkyJ-u4SyQmMhFeC1C &amp;lt;nowiki&amp;gt;C++ Programming Video Tutorials For Beginners [ C...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
=C++=&lt;br /&gt;
==YouTube==&lt;br /&gt;
===Playlists===&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLfVsf4Bjg79Cu5MYkyJ-u4SyQmMhFeC1C &amp;lt;nowiki&amp;gt;C++ Programming Video Tutorials For Beginners [ Complete Series ] &amp;lt;/nowiki&amp;gt;] - by [https://www.youtube.com/user/LearningLad LearningLad] - 143 videos - Last updated on Aug 20, 2015&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PL5jc9xFGsL8E12so1wlMS0r0hTQoJL74M Concurrent Programming with C++ 11] - by [https://www.youtube.com/user/BoQianTheProgrammer Bo Qian] - 10 videos - Last updated on Jun 25, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLAE85DE8440AA6B83 C++ Programming Tutorials Playlist] - by [https://www.youtube.com/user/thenewboston thenewboston] - 73 videos - Last updated on Jul 2, 2014&lt;br /&gt;
*[https://www.youtube.com/playlist?list=PLF541C2C1F671AEF6 C++ Programming Tutorials from thenewboston] - by [https://www.youtube.com/user/thenewboston thenewboston] - 29 videos - Last updated on Jul 2, 2014&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Template:Warning&amp;diff=357</id>
		<title>Template:Warning</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Template:Warning&amp;diff=357"/>
		<updated>2015-08-30T05:22:09Z</updated>

		<summary type="html">&lt;p&gt;Benargee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;text-align: left; margin: 1em&amp;quot;&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width: 3;text-align:left; background-color: #ff6666; border: 1px solid #000000; padding: 0.1em; margin: 0; border-radius: 10px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;padding:0.05em; width:0;&amp;quot;|&lt;br /&gt;
| style=&amp;quot;padding: 0.1em;&amp;quot; | ''Warning:{{{1}}}''&lt;br /&gt;
|}&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;[[Category:Warning Pages]]&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[:Category:Warning Pages]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=How_to_Program_in_C%2B%2B_(by_Matt_Mahoney)&amp;diff=356</id>
		<title>How to Program in C++ (by Matt Mahoney)</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=How_to_Program_in_C%2B%2B_(by_Matt_Mahoney)&amp;diff=356"/>
		<updated>2015-08-30T05:21:17Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Created page with &amp;quot;{{Stub}} {{Warning|Page needs to be converted from HTML to MediaWiki format http://pandoc.org/ https://github.com/jgm/pandoc/releases/tag/1.15.0.6}}   &amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;How t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
{{Warning|Page needs to be converted from HTML to MediaWiki format http://pandoc.org/ https://github.com/jgm/pandoc/releases/tag/1.15.0.6}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;How to Program in C++&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body bgcolor=white&amp;gt;&lt;br /&gt;
&amp;lt;h1 align=center&amp;gt;How to Program in C++&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;You may copy this file for noncommercial use.  The latest version&lt;br /&gt;
is located at &amp;lt;a href=http://cs.fit.edu/~mmahoney/cse2050/how2cpp.html&amp;gt;&lt;br /&gt;
cs.fit.edu/~mmahoney/cse2050/how2cpp.html&amp;lt;/a&amp;gt; updated&lt;br /&gt;
Apr. 14, 2010.  Please report errors to Matt Mahoney at&lt;br /&gt;
&amp;lt;a href=mailto:mmahoney@cs.fit.edu&amp;gt;mmahoney@cs.fit.edu&amp;lt;/a&amp;gt;.&lt;br /&gt;
Seldom-used features have been deliberately omitted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=languagesummary&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Language Summary&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a href=#basics&amp;gt;Basic Concepts&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a href=#statements&amp;gt;Statements&amp;lt;/a&amp;gt; if, for, while, return, break...&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a href=#expressions&amp;gt;Expressions&amp;lt;/a&amp;gt; arithmetic, comparison, assignment...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The most important types are&lt;br /&gt;
&amp;lt;tt&amp;gt;int, char, bool, double&amp;lt;/tt&amp;gt;, and the containers &amp;lt;tt&amp;gt;string, vector,&amp;lt;/tt&amp;gt;&lt;br /&gt;
and &amp;lt;tt&amp;gt;map&amp;lt;/tt&amp;gt;.  Summary of common types:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;a href=#builtin&amp;gt;Built-in&amp;lt;/a&amp;gt;        Description&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;a href=#integer&amp;gt;int&amp;lt;/a&amp;gt; x;          Fastest integer type (16-32 bits), also short, long, unsigned&lt;br /&gt;
&amp;lt;a href=#char&amp;gt;char&amp;lt;/a&amp;gt; x;         8-bit character, '\0' to '\xFF' or -128 to 127&lt;br /&gt;
&amp;lt;a href=#floating&amp;gt;double&amp;lt;/a&amp;gt; x;       64 bit real + or - 1.8e308, 14 significant digits, also float&lt;br /&gt;
bool x;         true or false                     &lt;br /&gt;
               &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;a href=#modifiers&amp;gt;Modifiers&amp;lt;/a&amp;gt;       Description&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;a href=#const&amp;gt;const&amp;lt;/a&amp;gt; T x;      Non-modifiable object&lt;br /&gt;
T&amp;amp;amp; y=x;         &amp;lt;a href=#references&amp;gt;Reference&amp;lt;/a&amp;gt;, y is an alias for x, which both have type T&lt;br /&gt;
T f(...) {...}  Defines f as a &amp;lt;a href=#functions&amp;gt;function&amp;lt;/a&amp;gt; returning T&lt;br /&gt;
T* p;           &amp;lt;a href=#pointers&amp;gt;Pointer&amp;lt;/a&amp;gt; to T (*p is a T object)&lt;br /&gt;
T a[N];         &amp;lt;a href=#arrays&amp;gt;Array&amp;lt;/a&amp;gt; of N elements of T, a[0] to a[N-1]&lt;br /&gt;
&amp;lt;a href=#static&amp;gt;static&amp;lt;/a&amp;gt; T x;     Place x in data segment&lt;br /&gt;
&amp;lt;a href=#register&amp;gt;register&amp;lt;/a&amp;gt; T x;   (rare) Hint to optimize for speed&lt;br /&gt;
&amp;lt;a href=#volatile&amp;gt;volatile&amp;lt;/a&amp;gt; T x;   (rare) x may be modified externally&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following standard library types and functions require at the&lt;br /&gt;
beginning of the program:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #include &amp;amp;lt;&amp;lt;i&amp;gt;header&amp;lt;/i&amp;gt;&amp;gt;&lt;br /&gt;
  using namespace std;&lt;br /&gt;
               &lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;a href=#standardlibrarytypes&amp;gt;Library Type&amp;lt;/a&amp;gt;    Description                             Header&amp;lt;/b&amp;gt;&lt;br /&gt;
istream         Standard input (cin)                    &amp;lt;a href=#iostream&amp;gt;iostream&amp;lt;/a&amp;gt;&lt;br /&gt;
ostream         Output (cout, cerr, clog)               iostream&lt;br /&gt;
ifstream        Input file                              &amp;lt;a href=#fstream&amp;gt;fstream&amp;lt;/a&amp;gt;&lt;br /&gt;
ofstream        Output file                             fstream&lt;br /&gt;
string          Sequence of char                        &amp;lt;a href=#string&amp;gt;string&amp;lt;/a&amp;gt;&lt;br /&gt;
vector&amp;amp;lt;T&amp;gt;       Expandable array/stack of T             &amp;lt;a href=#vector&amp;gt;vector&amp;lt;/a&amp;gt;&lt;br /&gt;
deque&amp;amp;lt;T&amp;gt;        Array/double ended queue                &amp;lt;a href=#deque&amp;gt;deque&amp;lt;/a&amp;gt;&lt;br /&gt;
list&amp;amp;lt;T&amp;gt;         List/stack/queue of T                   &amp;lt;a href=#list&amp;gt;list&amp;lt;/a&amp;gt;&lt;br /&gt;
map&amp;amp;lt;T1,T2&amp;gt;      Associative mapping of T1 to T2         &amp;lt;a href=#map&amp;gt;map&amp;lt;/a&amp;gt;&lt;br /&gt;
set&amp;amp;lt;T1&amp;gt;         A map with keys only                    &amp;lt;a href=#set&amp;gt;set&amp;lt;/a&amp;gt;&lt;br /&gt;
pair&amp;amp;lt;T1,T2&amp;gt;     Two objects of type T1 and T2           map or utility&lt;br /&gt;
priority_queue&amp;amp;lt;T&amp;gt;  Sorted queue                         &amp;lt;a href=#queue&amp;gt;queue&amp;lt;/a&amp;gt;&lt;br /&gt;
stack&amp;amp;lt;T&amp;gt;        Stack                                   &amp;lt;a href=#stack&amp;gt;stack&amp;lt;/a&amp;gt;&lt;br /&gt;
bitset&amp;amp;lt;N&amp;gt;       Array of N bool with logical operations &amp;lt;a href=#bitset&amp;gt;bitset&amp;lt;/a&amp;gt;&lt;br /&gt;
valarray&amp;amp;lt;T&amp;gt;     Array with arithmetic operations        &amp;lt;a href=#valarray&amp;gt;valarray&amp;lt;/a&amp;gt;&lt;br /&gt;
complex&amp;amp;lt;T&amp;gt;      Complex number                          &amp;lt;a href=#complex&amp;gt;complex&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;a href=#cpplibrary&amp;gt;iterator&amp;lt;/a&amp;gt;        Pointer into a container                (Included with container)&lt;br /&gt;
const_iterator  Pointer not allowing element assignment (Included with container)&lt;br /&gt;
exception       Hierarchy of exception types            &amp;lt;a href=#stdexcept&amp;gt;stdexcept, exception&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;a href=#cpplibrary&amp;gt;C++ Standard Library Functions&amp;lt;/a&amp;gt;                          Header&amp;lt;/b&amp;gt;&lt;br /&gt;
min(), max(), swap(), sort(), copy(), equal()           &amp;lt;a href=#algorithm&amp;gt;algorithm&amp;lt;/a&amp;gt;&lt;br /&gt;
accumulate(), inner_product()                           &amp;lt;a href=#numeric&amp;gt;numeric&amp;lt;/a&amp;gt;&lt;br /&gt;
back_inserter()                                         &amp;lt;a href=#iterator&amp;gt;iterator&amp;lt;/a&amp;gt;&lt;br /&gt;
equal_to(), less(), bind2nd()                           &amp;lt;a href=#functional&amp;gt;functional&amp;lt;/a&amp;gt;&lt;br /&gt;
set_new_handler()                                       &amp;lt;a href=#new&amp;gt;new&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;a href=#clibrary&amp;gt;C Library Functions&amp;lt;/a&amp;gt;                                     Header&amp;lt;/b&amp;gt;&lt;br /&gt;
atoi(), atof(), abs(), rand(), system(), exit()         &amp;lt;a href=#cstdlib&amp;gt;cstdlib&amp;lt;/a&amp;gt;&lt;br /&gt;
isalpha(), isdigit(), tolower(), toupper()              &amp;lt;a href=#cctype&amp;gt;cctype&amp;lt;/a&amp;gt;&lt;br /&gt;
sqrt(), log(), exp(), pow(), sin(), cos(), atan()       &amp;lt;a href=#cmath&amp;gt;cmath&amp;lt;/a&amp;gt;&lt;br /&gt;
clock(), time()                                         &amp;lt;a href=#ctime&amp;gt;ctime&amp;lt;/a&amp;gt;&lt;br /&gt;
strlen(), memset(), memmove(), memcmp()                 &amp;lt;a href=#cstring&amp;gt;cstring&amp;lt;/a&amp;gt;&lt;br /&gt;
printf(), fopen(), getc(), perror()                     &amp;lt;a href=#cstdio&amp;gt;cstdio&amp;lt;/a&amp;gt;&lt;br /&gt;
assert()                                                &amp;lt;a href=#cassert&amp;gt;cassert&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;C++ allows you to create your own types and libraries.  The most&lt;br /&gt;
important type is a &amp;lt;a href=#classes&amp;gt;&amp;lt;tt&amp;gt;class&amp;lt;/tt&amp;gt;&amp;lt;/a&amp;gt;, allowing object oriented&lt;br /&gt;
programming.  A class is an abstract data type with a hidden&lt;br /&gt;
representation and a set of public member functions and types.&lt;br /&gt;
Classes can be organized into a hierarchy (&amp;lt;a href=#inheritance&amp;gt;inheritance&amp;lt;/a&amp;gt;), and you&lt;br /&gt;
can write code that accepts any type in this hierarchy (&amp;lt;a href=#polymorphism&amp;gt;polymorphism&amp;lt;/a&amp;gt;).&lt;br /&gt;
Functions and classes can be parameterized by type (templated).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;a href=#classes&amp;gt;class&amp;lt;/a&amp;gt; T {...};  Defines T as a collection of types, objects, and member functions&lt;br /&gt;
template &amp;amp;lt;class T&amp;gt; ... Defines a set of &amp;lt;a href=#templatefunction&amp;gt;functions&amp;lt;/a&amp;gt; or &amp;lt;a href=#templateclass&amp;gt;classes&amp;lt;/a&amp;gt; over all T&lt;br /&gt;
&amp;lt;a href=#typedef&amp;gt;typedef&amp;lt;/a&amp;gt; T U;    Defines type U is a synonym for T&lt;br /&gt;
&amp;lt;a href=#enum&amp;gt;enum&amp;lt;/a&amp;gt; T {...};   Defines T as an int, and set of int constants&lt;br /&gt;
&amp;lt;a href=#struct&amp;gt;struct&amp;lt;/a&amp;gt; T {...}; Like a class, except default scope of members is public&lt;br /&gt;
&amp;lt;a href=#union&amp;gt;union&amp;lt;/a&amp;gt; T {...};  A struct with object members overlapping in memory&lt;br /&gt;
&amp;lt;a href=#namespaces&amp;gt;namespace&amp;lt;/a&amp;gt; N {...};  Defines a scope for a collection of types, objects, and functions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a href=#programorganization&amp;gt;Program Organization&amp;lt;/a&amp;gt; (compiling, linking, make)&lt;br /&gt;
&amp;lt;a href=#history&amp;gt;History of C++&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;a href=#furtherreading&amp;gt;Further Reading&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=basics&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Basics&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;C++ is a compiled language, an upward compatible superset of C&lt;br /&gt;
and an (incompatible) predecessor to Java.  C++ compiles C programs but&lt;br /&gt;
adds object oriented (OO) features (classes, inheritance, polymorphism),&lt;br /&gt;
templates (generic functions and classes), function and operator&lt;br /&gt;
overloading, namespaces (packages), exception handling, a library of&lt;br /&gt;
standard data structures (string, vector, map, etc.) and formatted text I/O&lt;br /&gt;
(istream, ostream).  Unlike Java, C++ lacks a standard graphical user&lt;br /&gt;
interface (GUI), network interface, garbage collection, and threads,&lt;br /&gt;
and allows non-OO programming and unchecked low-level machine operations&lt;br /&gt;
with pointers.  However, C++ executes faster than Java and requires&lt;br /&gt;
no run-time support.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A C++ program is a collection of function, object, and type declarations.&lt;br /&gt;
Every program must have a function &amp;lt;tt&amp;gt;int main() { ... }&amp;lt;/tt&amp;gt;&lt;br /&gt;
where the curly braces enclose a block, a sequence of declarations&lt;br /&gt;
and statements ending in semicolons which are executed in order.&lt;br /&gt;
A statement is an expression, block,&lt;br /&gt;
or control statement that alters the order of execution, such as&lt;br /&gt;
&amp;lt;tt&amp;gt;if, while, for, break, return&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Some types (&amp;lt;tt&amp;gt;std::string&amp;lt;/tt&amp;gt;), objects (&amp;lt;tt&amp;gt;std::cout&amp;lt;/tt&amp;gt;),&lt;br /&gt;
and functions are defined in header files, requiring the line&lt;br /&gt;
&amp;lt;tt&amp;gt;#include &amp;amp;lt;&amp;lt;i&amp;gt;header&amp;lt;/i&amp;gt;&amp;amp;gt;&amp;lt;/tt&amp;gt; before use.  Items&lt;br /&gt;
defined in the standard headers are in the namespace &amp;lt;tt&amp;gt;std&amp;lt;/tt&amp;gt;.&lt;br /&gt;
The &amp;lt;tt&amp;gt;std::&amp;lt;/tt&amp;gt; prefix may be dropped after the statement&lt;br /&gt;
&amp;lt;tt&amp;gt;using namespace std;&amp;lt;/tt&amp;gt;.  For instance,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Comment: prints &amp;quot;Hello world!&amp;quot; and an OS-independent newline&lt;br /&gt;
  #include &amp;amp;lt;string&amp;gt;    // Defines type std::string&lt;br /&gt;
  #include &amp;amp;lt;iostream&amp;gt;  // Defines global object std::cout&lt;br /&gt;
  using namespace std; // Allow std:: to be dropped&lt;br /&gt;
  int main() {         // Execution starts here&lt;br /&gt;
    string s=&amp;quot;Hello world!\n&amp;quot;; // Declares object s of type string&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; s;         // An expression as a statement, &amp;amp;lt;&amp;amp;lt; is the output operator&lt;br /&gt;
    return 0;          // Execution ends here&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The symbol &amp;lt;tt&amp;gt;//&amp;lt;/tt&amp;gt; denotes a comment to the end of the line.  You may also&lt;br /&gt;
use &amp;lt;tt&amp;gt;/* ... */&amp;lt;/tt&amp;gt; for multiline comments.  Spacing and indentation is&lt;br /&gt;
used for readability.  C++ is mostly free-form, except that&lt;br /&gt;
the end of line is significant after &amp;lt;tt&amp;gt;# &amp;lt;/tt&amp;gt;and &amp;lt;tt&amp;gt;//&amp;lt;/tt&amp;gt;.&lt;br /&gt;
C++ is case sensitive.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;C++ source code files should be created with a text editor and&lt;br /&gt;
have the extension &amp;lt;tt&amp;gt;.cpp&amp;lt;/tt&amp;gt;.  If the above is called &amp;lt;tt&amp;gt;hello.cpp&amp;lt;/tt&amp;gt;,&lt;br /&gt;
it may be compiled  and run as follows in a UNIX shell window:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  g++ hello.cpp -o hello -Wall -O&lt;br /&gt;
  ./hello&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The &amp;lt;tt&amp;gt;-o&amp;lt;/tt&amp;gt; option renames the executable file, by default&lt;br /&gt;
&amp;lt;tt&amp;gt;a.out&amp;lt;/tt&amp;gt;.  &amp;lt;tt&amp;gt;-Wall&amp;lt;/tt&amp;gt; turns on all warnings (recommended).&lt;br /&gt;
&amp;lt;tt&amp;gt;-O&amp;lt;/tt&amp;gt; optimizes (compiles slower but runs faster).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In Windows, the GNU C++ compiler is called DJGPP.  To compile and&lt;br /&gt;
run from an MS-DOS box:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  gxx hello.cpp -o hello.exe&lt;br /&gt;
  hello&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The output file must have a .EXE extension (default is A.EXE).  There is&lt;br /&gt;
also a .OBJ file which you can delete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;To use the network or GUI interface in UNIX, you must use the X&lt;br /&gt;
and socket libraries, which don't work in Windows.  In Windows, you&lt;br /&gt;
must use the Windows API and a compiler that supports them, such&lt;br /&gt;
as from Microsoft, Borland, or Symantec.  GUI/network programming is&lt;br /&gt;
nonportable and outside the scope of this document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Links to free and commercial C++ compilers can be found at&lt;br /&gt;
&amp;lt;a href=http://cplusplus.com/&amp;gt;cplusplus.com&amp;lt;/a&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=statements&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Statements&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A program consists of a collection of functions (one of which must&lt;br /&gt;
be &amp;lt;tt&amp;gt;int main() {...}&amp;lt;/tt&amp;gt;) and type and object&lt;br /&gt;
declarations.  A function may contain declarations and statements.&lt;br /&gt;
Statements have the following forms, where&lt;br /&gt;
&amp;lt;tt&amp;gt;s&amp;lt;/tt&amp;gt; is a statement, and&lt;br /&gt;
&amp;lt;tt&amp;gt;t&amp;lt;/tt&amp;gt; is a true/false expression.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
s;                             // &amp;lt;a href=#expressions&amp;gt;Expression&amp;lt;/a&amp;gt; or &amp;lt;a href=#declarations&amp;gt;declaration&amp;lt;/a&amp;gt;&lt;br /&gt;
;                              // Empty statement&lt;br /&gt;
{s; s;}                        // A &amp;lt;a href=#statements&amp;gt;block&amp;lt;/a&amp;gt; of 0 or more statements is a statement&lt;br /&gt;
&amp;lt;a href=#if&amp;gt;if&amp;lt;/a&amp;gt; (t) s;                      // If t is true then s&lt;br /&gt;
if (t) s; else s;              // else is optional&lt;br /&gt;
&amp;lt;a href=#while&amp;gt;while&amp;lt;/a&amp;gt; (t) s;                   // Loop 0 or more times&lt;br /&gt;
&amp;lt;a href=#for&amp;gt;for&amp;lt;/a&amp;gt; (s1; t; s2) s;             // s1; while (t) {s; s2;}&lt;br /&gt;
break;                         // Jump from while, for, do, switch&lt;br /&gt;
&amp;lt;a href=#return&amp;gt;return&amp;lt;/a&amp;gt; x;                      // Return x to calling function&lt;br /&gt;
&amp;lt;a href=#try&amp;gt;try&amp;lt;/a&amp;gt; {throw x;}                 // Throw exception, abort if not caught, x has any type&lt;br /&gt;
  catch (T y) {s;}               // if x has type T then y=x, jump to s&lt;br /&gt;
  catch (...) {s;}               // else jump here (optional)&lt;br /&gt;
do s; while (t);               // (uncommon) s; while (t) s;&lt;br /&gt;
continue;                      // (uncommon) Start next loop of while, for, do&lt;br /&gt;
switch (i) {                   // (uncommon) Test int expression i to const C&lt;br /&gt;
  case C: s; break;              // if (i==C) go here&lt;br /&gt;
  default: s;                    // optional, else go here&lt;br /&gt;
}&lt;br /&gt;
label: goto label;             // (rare) Jump to label within a function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A statement may be a declaration or an expression.  Objects and&lt;br /&gt;
types declared in a block are local to that block.&lt;br /&gt;
(Functions cannot be defined locally).  It is normal (but not required) to&lt;br /&gt;
show statements on separate lines and to indent&lt;br /&gt;
statements enclosed in a block.  If braces are optional, we indent anyway.&lt;br /&gt;
For instance,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{                     // start of block&lt;br /&gt;
  int a[10], i=0, j;  // declaration&lt;br /&gt;
  a[i+2]=3;           // expression&lt;br /&gt;
}                     // end of block, a, i, and j are destroyed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
declares the array of int &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; with elements &amp;lt;tt&amp;gt;a[0]&amp;lt;/tt&amp;gt;&lt;br /&gt;
through &amp;lt;tt&amp;gt;a[9]&amp;lt;/tt&amp;gt; (whose values are initially undefined), &lt;br /&gt;
&amp;lt;tt&amp;gt;i&amp;lt;/tt&amp;gt; with initial value 0, and &amp;lt;tt&amp;gt;j&amp;lt;/tt&amp;gt;&lt;br /&gt;
with an undefined initial value.  These names can only be used in scope,&lt;br /&gt;
which is from the declaration to the closing brace.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;a name=while&amp;gt;&amp;lt;a name=for&amp;gt;&lt;br /&gt;
The &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop is normally used for iteration.  For &lt;br /&gt;
instance, the following both exit the loop with &amp;lt;tt&amp;gt;i&amp;lt;/tt&amp;gt; set to the index of&lt;br /&gt;
the first element of &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; such that &amp;lt;tt&amp;gt;a[i]&amp;lt;/tt&amp;gt; is 0, or to 10 if not found.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for (i=0; i&amp;amp;lt;10; i=i+1) {    i=0;&lt;br /&gt;
    if (a[i]==0) {            while (i&amp;amp;lt;10) {&lt;br /&gt;
      break;                    if (a[i]==0)&lt;br /&gt;
    }                             break;&lt;br /&gt;
  }                             i=i+1;&lt;br /&gt;
                              }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The braces in the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop are optional because they each enclose&lt;br /&gt;
a single statement.  In the &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loop, the outer braces are&lt;br /&gt;
required because they enclose 2 statements.&lt;br /&gt;
All statements are optional: &amp;lt;tt&amp;gt;for (;;)&amp;lt;/tt&amp;gt; loops forever.&lt;br /&gt;
The first statement in&lt;br /&gt;
a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop may declare a variable local to the loop.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for (int i=0; i&amp;amp;lt;10; i=i+1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;It is only possible to &amp;lt;tt&amp;gt;break&amp;lt;/tt&amp;gt; from the innermost loop&lt;br /&gt;
of a nested loop.  &amp;lt;tt&amp;gt;continue&amp;lt;/tt&amp;gt; in a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop&lt;br /&gt;
skips the rest of the block but executes the iteration (s2) and&lt;br /&gt;
test before starting the next loop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=return&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;return x;&amp;lt;/tt&amp;gt; causes the current function to return to&lt;br /&gt;
the caller, evaluating to x.  It is required except in functions&lt;br /&gt;
returning void, in which case &amp;lt;tt&amp;gt;return;&amp;lt;/tt&amp;gt; returns without a&lt;br /&gt;
value.  The value returned by &amp;lt;tt&amp;gt;main()&amp;lt;/tt&amp;gt; has no effect on&lt;br /&gt;
program behavior and is normally discarded.  However it is available&lt;br /&gt;
as the $status in a UNIX csh script or ERRORLEVEL in a Windows .BAT file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int sum(int x, int y) {  // Function definition&lt;br /&gt;
    return x+y;&lt;br /&gt;
  }&lt;br /&gt;
  int main() {&lt;br /&gt;
    int a=sum(1,2);        // a=3;&lt;br /&gt;
    return 0;              // By convention, nonzero indicates an error&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=if&amp;gt;&lt;br /&gt;
&amp;lt;a name=switch&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;A test of several alternatives usually has the form &amp;lt;tt&amp;gt;&lt;br /&gt;
if (t) s; else if (t) s; else if (t) s; ... else s;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
A &amp;lt;tt&amp;gt;switch&amp;lt;/tt&amp;gt; statement is an optimization&lt;br /&gt;
for the special case where an int expression is tested against a&lt;br /&gt;
small range of constant values.  The following are equivalent:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  switch (i) {                if (i==1)&lt;br /&gt;
    case 1: j=1; break;         j=1;&lt;br /&gt;
    case 2: // fall thru      else if (i==2 || i==3) // || means &amp;quot;or else&amp;quot;&lt;br /&gt;
    case 3: j=23; break;        j=23;&lt;br /&gt;
    default: j=0;             else&lt;br /&gt;
  }                             j=0;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=try&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;throw x&amp;lt;/tt&amp;gt; jumps to the first &amp;lt;tt&amp;gt;catch&amp;lt;/tt&amp;gt; statement of the&lt;br /&gt;
most recently executed &amp;lt;tt&amp;gt;try&amp;lt;/tt&amp;gt; block where the parameter declaration&lt;br /&gt;
matches the type of x, or a type that x can be converted to, or is&lt;br /&gt;
&amp;lt;tt&amp;gt;...&amp;lt;/tt&amp;gt;.  At most one catch block is executed.&lt;br /&gt;
If no matching &amp;lt;tt&amp;gt;catch&amp;lt;/tt&amp;gt; block is found, the program aborts&lt;br /&gt;
(Unexpected exception).&lt;br /&gt;
&amp;lt;tt&amp;gt;throw;&amp;lt;/tt&amp;gt; with no expression in a &amp;lt;tt&amp;gt;catch&amp;lt;/tt&amp;gt; block throws&lt;br /&gt;
the exception just caught.  Exceptions are generally&lt;br /&gt;
used when it is inconvenient to detect and handle an error in the&lt;br /&gt;
same place.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  void f() {&lt;br /&gt;
    throw 3;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  int main() {&lt;br /&gt;
    try {&lt;br /&gt;
      f();&lt;br /&gt;
    }&lt;br /&gt;
    catch(int i) {  // Execute this block with i = 3&lt;br /&gt;
      throw;        // throw 3 (not caught, so program aborts)&lt;br /&gt;
    }&lt;br /&gt;
    catch(...) {    // Catch any other type&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=expressions&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Expressions&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;There are 18 levels of operator precedence, listed highest to lowest.&lt;br /&gt;
Operators at the same level are evaluated left to right unless indicted,&lt;br /&gt;
Thus, a=b+c means a=(b+c) because + is higher than =, and a-b-c means&lt;br /&gt;
(a-b)-c.  Order of evaluation is undefined, e.g. for &amp;lt;tt&amp;gt;sin(x)+cos(x)&amp;lt;/tt&amp;gt;&lt;br /&gt;
we cannot say whether sin() or cos() is called first.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The meaning of an expression depends on the types of the operands.&lt;br /&gt;
&amp;lt;tt&amp;gt;(x,y)&amp;lt;/tt&amp;gt; denotes a comma separated list of 0 or more objects,&lt;br /&gt;
e.g. &amp;lt;tt&amp;gt;()&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;(x)&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;(1,2,3,4)&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1&lt;br /&gt;
X::m           Member m of namespace or class X&lt;br /&gt;
::m            Global name m when otherwise hidden by a local declaration&lt;br /&gt;
&lt;br /&gt;
2&lt;br /&gt;
p[i]           i'th element of container p (array, vector, string)&lt;br /&gt;
x.m            Member m of object x&lt;br /&gt;
p-&amp;gt;m           Member m of object pointed to by p&lt;br /&gt;
f(x,y)         Call function f with 0 or more arguments&lt;br /&gt;
i++            Add 1 to i, result is original value of i&lt;br /&gt;
i--            Subtract 1 from i, result is original value of i&lt;br /&gt;
&amp;lt;a href=#static_cast&amp;gt;static_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/a&amp;gt;       Convert x to type T using defined conversions&lt;br /&gt;
&amp;lt;a href=#const_cast&amp;gt;const_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/a&amp;gt;        (rare) Convert x to equivalent but non-const T&lt;br /&gt;
&amp;lt;a href=#reinterpret_cast&amp;gt;reinterpret_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/a&amp;gt;  (rare, dangerous) Pretend x has type T&lt;br /&gt;
&amp;lt;a href=#runtimetype&amp;gt;dynamic_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/a&amp;gt;      (rare) Convert base pointer or reference to derived if possible&lt;br /&gt;
&amp;lt;a href=#runtimetype&amp;gt;typeid(x)&amp;lt;/a&amp;gt;      (rare) If x is type T, then typeid(x)==typeid(T) (in &amp;amp;lt;typeinfo&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
3 (right to left)&lt;br /&gt;
*p             Contents of pointer p, or p[0].  If p is type T*, *p is T&lt;br /&gt;
&amp;amp;amp;x             Address of (pointer to) x.  If x is type T, &amp;amp;x is T*&lt;br /&gt;
-a             Negative of numeric a&lt;br /&gt;
!i             Not i, true if i is false or 0&lt;br /&gt;
~i             Bitwise compliment of i, -1 - i&lt;br /&gt;
(T)x           Convert (cast) object x to type T (by static, const, or reinterpret)&lt;br /&gt;
T(x,y)         Convert, initializing with 0 or more arguments&lt;br /&gt;
new T          Create a T object on heap, return its address as T*&lt;br /&gt;
new T(x,y)     Create, initializing with 0 or more arguments&lt;br /&gt;
new(p) T       (rare) Initialize T at address p without allocating from heap&lt;br /&gt;
new(p) T(x,y)  (rare) Initialize T with 0 or more arguments at p&lt;br /&gt;
new T[i]       Create array of i objects of type T, return T* pointing to first element&lt;br /&gt;
delete p       Destroy object pointed to by p obtained with new T or new T()&lt;br /&gt;
delete[] p     Destroy array obtained with new T[]&lt;br /&gt;
++i            Add 1 to i, result is the new i&lt;br /&gt;
--i            Subtract 1 from i, result is the new i&lt;br /&gt;
sizeof x       Size of object x in bytes&lt;br /&gt;
sizeof(T)      Size of objects of type T in bytes&lt;br /&gt;
&lt;br /&gt;
4&lt;br /&gt;
x.*p           (rare) Object in x pointed to by pointer to member p&lt;br /&gt;
q-&amp;gt;*p          (rare) Object in *q pointed to by pointer to member p&lt;br /&gt;
&lt;br /&gt;
5&lt;br /&gt;
a*b            Multiply numeric a and b&lt;br /&gt;
a/b            Divide numeric a and b, round toward 0 if both are integer&lt;br /&gt;
i%j            Integer remainder i-(i/j)*j&lt;br /&gt;
&lt;br /&gt;
6&lt;br /&gt;
a+b            Addition, string concatenation&lt;br /&gt;
a-b            Subtraction&lt;br /&gt;
&lt;br /&gt;
7&lt;br /&gt;
x&amp;amp;lt;&amp;amp;lt;y           Integer x shifted y bits to left, or output y to ostream x&lt;br /&gt;
x&amp;gt;&amp;gt;y           Integer x shifted y bits to right, or input y from istream x&lt;br /&gt;
&lt;br /&gt;
8&lt;br /&gt;
x&amp;amp;lt;y            Less than&lt;br /&gt;
x&amp;gt;y            Greater than&lt;br /&gt;
x&amp;amp;lt;=y           Less than or equal to&lt;br /&gt;
x&amp;gt;=y           Greater than or equal to&lt;br /&gt;
&lt;br /&gt;
9&lt;br /&gt;
x==y           Equals&lt;br /&gt;
x!=y           Not equals&lt;br /&gt;
&lt;br /&gt;
10&lt;br /&gt;
i&amp;amp;amp;j            Bitwise AND of integers i and j&lt;br /&gt;
&lt;br /&gt;
11&lt;br /&gt;
i^j            Bitwise XOR of integers i and j&lt;br /&gt;
&lt;br /&gt;
12&lt;br /&gt;
i|j            Bitwise OR of integers i and j&lt;br /&gt;
&lt;br /&gt;
13&lt;br /&gt;
i&amp;amp;amp;&amp;amp;amp;j           i and then j (evaluate j only if i is true/nonzero)&lt;br /&gt;
&lt;br /&gt;
14&lt;br /&gt;
i||j           i or else j (evaluate j only if i is false/zero)&lt;br /&gt;
&lt;br /&gt;
15 (right to left)&lt;br /&gt;
x=y            Assign y to x, result is new value of x&lt;br /&gt;
x+=y           x=x+y, also -= *= /= %= &amp;amp;amp;= |= ^= &amp;amp;lt;&amp;amp;lt;= &amp;gt;&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
16&lt;br /&gt;
i?x:y          If i is true/nonzero then x else y&lt;br /&gt;
&lt;br /&gt;
17&lt;br /&gt;
throw x        Throw exception x (any type)&lt;br /&gt;
&lt;br /&gt;
18&lt;br /&gt;
x,y            Evaluate x and y (any types), result is y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expressions that don't require creating a new object, such as &amp;lt;tt&amp;gt;a=b, ++a,&lt;br /&gt;
p[i], p-&amp;gt;m, x.m, a?b:c, a,b&amp;lt;/tt&amp;gt; etc. are &amp;lt;i&amp;gt;lvalues&amp;lt;/i&amp;gt;, meaning they&lt;br /&gt;
may appear on the left side of an assignment.&lt;br /&gt;
Other expressions and conversions create temporary objects to hold the&lt;br /&gt;
result, which are &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt; (constant).  An expression used as a&lt;br /&gt;
statement discards the final result.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a, b, c;&lt;br /&gt;
  a+b;         // Legal, add a and b, discard the sum&lt;br /&gt;
  a=b=c;       // Legal, assign c to b, then assign the new b to a&lt;br /&gt;
  (a+=b)+=c;   // Legal, add b to a, then add c to a&lt;br /&gt;
  a+b=c;       // Error, a+b is const&lt;br /&gt;
  double(a)=b; // Error, double(a) is const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a name=static_cast&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;static_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt; converts x to type T if a conversion&lt;br /&gt;
is defined.  Usually the value of x is preserved if possible.  Conversions&lt;br /&gt;
are defined between all numeric types (including char and bool), from&lt;br /&gt;
0 to pointer, pointer to bool or void*, istream to bool, ostream to bool,&lt;br /&gt;
char* to string, from a derived class to base class (including&lt;br /&gt;
pointers or references), and from type T to type U if class U has a&lt;br /&gt;
constructor taking T or class T has&lt;br /&gt;
a member &amp;lt;tt&amp;gt;operator U()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
A conversion will be implicit (automatically applied) whenever an&lt;br /&gt;
otherwise invalid expression, assignment, or function argument can be&lt;br /&gt;
made legal by applying one, except for T to U where U's constructor&lt;br /&gt;
taking T is declared &amp;lt;tt&amp;gt;explicit&amp;lt;/tt&amp;gt;, for example, the constructor&lt;br /&gt;
for &amp;lt;tt&amp;gt;vector&amp;lt;/tt&amp;gt; taking &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  double d; d=static_cast&amp;amp;lt;double&amp;gt;(3);  // Explicit 3 to 3.0&lt;br /&gt;
  d=3;                                 // Implicit conversion&lt;br /&gt;
  d=sqrt(3);                           // Implicit 3.0, sqrt() expects double&lt;br /&gt;
  vector&amp;amp;lt;int&amp;gt; v(5);                    // This constructor is explicit&lt;br /&gt;
  v=5;                                 // Error, no implicit conversion&lt;br /&gt;
  v=static_cast&amp;amp;lt;vector&amp;amp;lt;int&amp;gt; &amp;gt;(5);      // OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a name=const_cast&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;const_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; allows an object to be modified through&lt;br /&gt;
a const pointer or reference.  It must always be explicit.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int x=3;&lt;br /&gt;
  const int&amp;amp; r=x; r=4;     // Error, r is const&lt;br /&gt;
  const_cast&amp;amp;lt;int&amp;amp;&amp;gt;(r)=4;   // OK, x=4&lt;br /&gt;
  const int* p=&amp;amp;x; *p=5;   // Error, *p is const&lt;br /&gt;
  *const_cast&amp;amp;lt;int*&amp;gt;(p)=5;  // OK, x=5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If x were const, then this code would still be allowed but it is&lt;br /&gt;
undefined whether x actually changes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;a name=reinterpret_cast&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;reinterpret_cast&amp;amp;lt;T&amp;gt;(x)&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; turns off normal type checking between&lt;br /&gt;
int and different pointer types, which are normally incompatible.  The only&lt;br /&gt;
safe conversion is to convert a pointer back to its original type.&lt;br /&gt;
Conversion is always explicit.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int x=3, *p=&amp;amp;x; *p=5;             // OK, x=5&lt;br /&gt;
  *reinterpret_cast&amp;amp;lt;double*&amp;gt;(p)=5;  // Crash, writing 8 bytes into 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The expression &amp;lt;tt&amp;gt;(T)x&amp;lt;/tt&amp;gt; applies whatever combination&lt;br /&gt;
of static, const, and reinterpret casts are needed to convert x to&lt;br /&gt;
type T. &amp;lt;tt&amp;gt;T(x)&amp;lt;/tt&amp;gt; is a static_cast.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const char* s=&amp;quot;hello&amp;quot;;&lt;br /&gt;
  int(*s);                 // static_cast&lt;br /&gt;
  (char*)s;                // const_cast&lt;br /&gt;
  (const int*)s;           // reinterpret_cast&lt;br /&gt;
  (int*)s;                 // reinterpret_cast and const_cast&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=declarations&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Declarations&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A declaration creates a type, object, or function and gives it a name.&lt;br /&gt;
The syntax is a type name followed by a list of objects with possible&lt;br /&gt;
modifiers and initializers applying to each object.  A name consists of&lt;br /&gt;
upper or lowercase letters, digits, and underscores (_) with a leading&lt;br /&gt;
letter.  (Leading underscores are allowed but may be reserved).&lt;br /&gt;
An initializer appends the form &amp;lt;tt&amp;gt;=x&amp;lt;/tt&amp;gt; where x is an expression,&lt;br /&gt;
or (x,y) for a list of &amp;lt;i&amp;gt;one&amp;lt;/i&amp;gt; or more expressions.&lt;br /&gt;
For instance,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string s1, s2=&amp;quot;xxx&amp;quot;, s3(&amp;quot;xxx&amp;quot;), s4(3,'x'), *p, a[5], next_Word();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
declares s1 to be a string with initial value &amp;quot;&amp;quot;, s2, s3, and s4&lt;br /&gt;
to be strings with initial value &amp;quot;xxx&amp;quot;, p to be a pointer to string,&lt;br /&gt;
a to be an array of 5 strings (a[0] to a[4] with initial values &amp;quot;&amp;quot;),&lt;br /&gt;
and &amp;lt;tt&amp;gt;next_Word&amp;lt;/tt&amp;gt; to be a function that takes no parameters and&lt;br /&gt;
returns a string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=builtin&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Built-in Types&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All built-in types are numeric.  They are not automatically initialized&lt;br /&gt;
to 0 unless global or static.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a, b=0;       // a's value is undefined&lt;br /&gt;
  static double x;  // 0.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Types and their usual ranges are listed below.  Actual ranges could be&lt;br /&gt;
&amp;lt;a href=http://home.att.net/~jackklein/c/inttypes.html&amp;gt;different&amp;lt;/a&amp;gt;.&lt;br /&gt;
The most important types are int,&lt;br /&gt;
bool, char, and double.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;b&amp;gt;Integer types           Bits   Range&amp;lt;/b&amp;gt;&lt;br /&gt;
  bool                     1     false (0) or true (1)&lt;br /&gt;
  signed char              8     '\x80' to '\x7f' (-128 to 127)&lt;br /&gt;
  unsigned char            8     '\x00' to '\XFF' (0 to 255)&lt;br /&gt;
  char                     8     Usually signed&lt;br /&gt;
  short                   16     -32768 to 32767&lt;br /&gt;
  unsigned short          16     0u to 65535U&lt;br /&gt;
  int                     32     Usually -2147483648 to 2147483647&lt;br /&gt;
  unsigned int            32     Usually 0 to 4294967295U&lt;br /&gt;
  long                    32-64  At least -2147483648l to 2147483647L&lt;br /&gt;
  unsigned long           32-64  0ul to at least 4294967295LU&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;b&amp;gt;Floating point types    Bits   Range&amp;lt;/b&amp;gt;&lt;br /&gt;
  float                   32     -1.7e38f to 1.7E38F, 6 significant digits&lt;br /&gt;
  double                  64     -1.8e308 to 1.8E308, 14 significant digits&lt;br /&gt;
  long double             64-80  At least double&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are implicit conversions between all types.  When types are&lt;br /&gt;
mixed in an expression, both operands are converted to the type&lt;br /&gt;
that has the higher upper bound, but at least to int.  This conversion&lt;br /&gt;
only loses representation when mixing signed and unsigned types.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  7/4                     // 1, int division rounds toward 0&lt;br /&gt;
  7.0/4                   // 1.75, implicit double(4) = 4.0&lt;br /&gt;
  '\x05'+true             // 6, implicit int('\x05') = 5, int(true) = 1&lt;br /&gt;
  3U &amp;gt; -1                 // false, implicit (unsigned int)(-1) = 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Conversion from a floating point type to an integer type drops the&lt;br /&gt;
decimal part and rounds toward 0.  If the value is outside the range&lt;br /&gt;
of the target, then the result is undefined.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int(-3.8)               // -3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Conversion of one integer type to another is performed modulo the&lt;br /&gt;
range of the target.  For a B-bit number (except bool), we add or&lt;br /&gt;
subtract 2&amp;lt;sup&amp;gt;B&amp;lt;/sup&amp;gt; to bring the value within range.  (In terms&lt;br /&gt;
of a 2's complement number, we drop the most significant bits and&lt;br /&gt;
reinterpret the sign bit without changing any bits).  For bool,&lt;br /&gt;
any nonzero value is true.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  (unsigned char)(-1)     // '\xff' (255)&lt;br /&gt;
  bool(3)                 // true&lt;br /&gt;
  short a=x12345678;      // x5678 hex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=integer&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Integer Types&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int is the most common integer type, normally the underlying word size&lt;br /&gt;
of the computer or 32 bits, representing numbers&lt;br /&gt;
from -2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt; to 2&amp;lt;sup&amp;gt;31&amp;lt;/sup&amp;gt;-1 (-2147483648 to 2147483647).&lt;br /&gt;
On some older systems such as real mode DOS, it may be 16 bits (-32768 to&lt;br /&gt;
32767).  You should use int unless you need the range of some other type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An int value may be written in decimal (e.g. 255), hexadecimal&lt;br /&gt;
with a leading X (e.g. xff or XFF) or octal (base 8) with a leading 0&lt;br /&gt;
(e.g. 0377).  A trailing L denotes long (e.g. 255L or 255l), and U denotes&lt;br /&gt;
unsigned.  These may be combined (e.g. 255lu or 255UL is unsigned long).&lt;br /&gt;
&lt;br /&gt;
Most integer operations translate to a single machine instruction&lt;br /&gt;
and are very fast.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  + - * / % -i      Add, subtract, multiply, divide, mod, unary negation&lt;br /&gt;
  =                 Assignment&lt;br /&gt;
  == != &amp;amp;lt; &amp;amp;lt;= &amp;gt; &amp;gt;=   Comparison, returns true or false&lt;br /&gt;
  ++i i++ --i i--   Pre/post increment and decrement&lt;br /&gt;
  &amp;amp; | ^ ~i &amp;amp;lt;&amp;amp;lt; &amp;gt;&amp;gt;    Bitwise and, or, xor, not, left shift, right shift&lt;br /&gt;
  += -= *= /= %= &amp;amp;= |= ^= &amp;amp;lt;&amp;amp;lt;= &amp;gt;&amp;gt;=    Operate and assign, e.g. x+=y means x=x+y&lt;br /&gt;
  &amp;amp;&amp;amp; || !i          Logical and then, or else, not&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Division rounds toward 0, e.g. 7/4 is 1, -7/4 is -1.  x%y is the remainder&lt;br /&gt;
with the sign of x, e.g. -7%4 is -3.  Division or mod by 0 is a run time&lt;br /&gt;
error and should be avoided.  Operations that yield results outside&lt;br /&gt;
the range of an int are converted modulo 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;, or more generally,&lt;br /&gt;
2&amp;lt;sup&amp;gt;B&amp;lt;/sup&amp;gt; for a B bit number.  For instance, 65535*65537 is -1, not&lt;br /&gt;
2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Assignment returns the value assigned, e.g. x=y=0 assigns 0 to y and&lt;br /&gt;
the new y to x.  The result is an lvalue, e.g. (x=y)=0 is also legal&lt;br /&gt;
(but useless).  It assigns y to x, then 0 to x.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;++i and i++ both add 1 to i.  However, ++i returns the new value,&lt;br /&gt;
and i++ returns the old value.  Likewise for decrement, --i and i--, which&lt;br /&gt;
subtracts 1.  The &amp;lt;i&amp;gt;pre&amp;lt;/i&amp;gt; forms, ++i, --i, are lvalues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Bitwise operators treat an int as a 2's compliment B-bit binary&lt;br /&gt;
number (B=32) with weights -2&amp;lt;sup&amp;gt;B-1&amp;lt;/sup&amp;gt;, 2&amp;lt;sup&amp;gt;B-2&amp;lt;/sup&amp;gt;,&lt;br /&gt;
2&amp;lt;sup&amp;gt;B-3&amp;lt;/sup&amp;gt;, ...&lt;br /&gt;
8, 4, 2, 1.  The leftmost bit is negative, and serves as the sign&lt;br /&gt;
bit.  Thus, 0 is all zero bits and -1 is all 1 bits.  Bitwise&lt;br /&gt;
operators x&amp;amp;y x|y x^y and ~x perform B simultaneous logical operations&lt;br /&gt;
on the bits of x and y.  For instance, if y is a power of 2, then&lt;br /&gt;
x&amp;amp;(y-1) has the effect x%y, but is usually faster, and the result is always&lt;br /&gt;
positive in the range 0 to y-1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;x&amp;amp;lt;&amp;amp;lt;y returns x shifted left by y places, shifting in zeros.&lt;br /&gt;
The result is x*2&amp;lt;sup&amp;gt;y&amp;lt;/sup&amp;gt;.  x&amp;gt;&amp;gt;y returns x shifted right by y places,&lt;br /&gt;
shifting in copies of the sign bit (or zeros if unsigned).&lt;br /&gt;
The result is x/2&amp;lt;sup&amp;gt;y&amp;lt;/sup&amp;gt; but&lt;br /&gt;
rounding negative instead of toward 0.  For instance, -100&amp;gt;&amp;gt;3 is -13.&lt;br /&gt;
y must be in the range 0 to B-1 (0 to 31).  Shifting is usually faster&lt;br /&gt;
than * and /.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Any binary arithmetic or bitwise operator may be combined with&lt;br /&gt;
assignment.  The result&lt;br /&gt;
is an lvalue.  e.g. &amp;lt;tt&amp;gt;(x+=2)*=3;&amp;lt;/tt&amp;gt; has the effect x=x+2; x=x*3;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Logical operators treat 0 as false and any other value as true.&lt;br /&gt;
They return true (1) or false (0), as do comparisons.  The &amp;amp;&amp;amp; and ||&lt;br /&gt;
operators do not evaluate the right operand if the result is known from&lt;br /&gt;
the left operand.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  if (i&amp;gt;=0 &amp;amp;&amp;amp; i&amp;amp;lt;n &amp;amp;&amp;amp; a[i]==x)  // Do bounds check on i before indexing array a&lt;br /&gt;
  if (x=3)                     // Legal but probably wrong, assign 3 to x and test true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=char&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A &amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt; is a one byte value.  Unlike other numeric types,&lt;br /&gt;
it prints as a character, although it can be used in arithmetic expressions.&lt;br /&gt;
Character constants are enclosed in single quotes, as &amp;lt;tt&amp;gt;'a'&amp;lt;/tt&amp;gt;.&lt;br /&gt;
A backslash has special meaning.  '\n' is a newline,&lt;br /&gt;
'\\' is a single backslash, '\'' is a single&lt;br /&gt;
quote, '\&amp;quot;' is a double quote.  A backslash may be followed by 3 octal&lt;br /&gt;
digits ('\377') or an X and 2 hex digits ('\xFF') (but not decimal).&lt;br /&gt;
Most computers use ASCII conversion as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  8-13:   \b\t\n\v\f\r  (bell, tab, newline, vertical tab, formfeed, return)&lt;br /&gt;
  32-47:   !\&amp;quot;#$%&amp;amp;amp;\'()*+,-./                 (32=space, \' and \&amp;quot; are one char)&lt;br /&gt;
  48-63:  0123456789:;&amp;amp;lt;=&amp;gt;\?                  (\? is one char)&lt;br /&gt;
  64-95:  @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_  (\\ is one char)&lt;br /&gt;
  96-126: `abcdefghijklmnopqrstuvwxyz{|}~&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=floating&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Floating Point Types&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A number with a decimal point is double (e.g. 3.7) unless a trailing&lt;br /&gt;
F is appended (e.g. 3.7f or 3.7F), in which case it is float.  Double&lt;br /&gt;
is preferred.  A double may be written in the form xey meaning&lt;br /&gt;
x*10&amp;lt;sup&amp;gt;y&amp;lt;/sup&amp;gt;, e.g. 3.7E-2 (0.037) or 1e4 (10000.0).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A double is usually represented as a 64 bit number with a sign bit,&lt;br /&gt;
an 11 bit exponent, and 52 bit mantissa.  Therefore it can only represent&lt;br /&gt;
numbers of the form M*2&amp;lt;sup&amp;gt;E&amp;lt;/sup&amp;gt; exactly, where -2&amp;lt;sup&amp;gt;52&amp;lt;/sup&amp;gt; &amp;amp;lt;&lt;br /&gt;
M &amp;amp;lt; 2&amp;lt;sup&amp;gt;52&amp;lt;/sup&amp;gt; and 2&amp;lt;sup&amp;gt;-10&amp;lt;/sup&amp;gt; &amp;amp;lt; E &amp;amp;lt; 2&amp;lt;sup&amp;gt;10&amp;lt;/sup&amp;gt;.&lt;br /&gt;
This is about + or - 1.797e308 with about 15 decimal digits of precision.&lt;br /&gt;
Therefore, numbers like 1e14 and 0.5 have exact representations, but 1e20&lt;br /&gt;
and 0.1 do not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  0.1 * 10 == 1    // false, they differ by about 10&amp;lt;sup&amp;gt;-15&amp;lt;/sup&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There are no bitwise or logical operators, %, ++, or --&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  + - * / -x        Add, subtract, multiply, divide, unary negation (no %)&lt;br /&gt;
  = += -= *= /=     Assignment, may be combined with operators&lt;br /&gt;
  == != &amp;amp;lt; &amp;amp;lt;= &amp;gt; &amp;gt;=   Comparison, however only &amp;amp;lt; and &amp;gt; are meaningful&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Operations may produce values outside the range of a double resulting&lt;br /&gt;
in infinity, -infinity or NaN (not a number).  These values cannot&lt;br /&gt;
be written in C++.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Additional mathematical functions (sqrt(), log(), pow(), etc.) can&lt;br /&gt;
be found in &amp;amp;lt;&amp;lt;a href=#cmath&amp;gt;cmath&amp;lt;/a&amp;gt;&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=modifiers&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Modifiers&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In a declaration, modifiers before the type name apply to&lt;br /&gt;
all objects in the list.  Otherwise they apply to single objects.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int* p, q;           // p is a pointer, q is an int&lt;br /&gt;
  const int a=0, b=0;  // a and b are both const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=const&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;const&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt; objects cannot be modified once created.  They must&lt;br /&gt;
be initialized in the declaration.  By convention, const objects are&lt;br /&gt;
UPPERCASE when used globally or as parameters.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const double PI=3.14159265359;  // Assignment to PI not allowed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=references&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;References&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A reference creates an alias for an object that already exists.&lt;br /&gt;
It must be initialized.  A reference to a const object must also be const.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int i=3;&lt;br /&gt;
  int&amp;amp;amp; r=i;         // r is an alias for i&lt;br /&gt;
  r=4;              // i=4;&lt;br /&gt;
  double&amp;amp;amp; pi=PI;    // Error, would allow PI to be modified&lt;br /&gt;
  const double&amp;amp; pi=PI;  // OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=functions&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Functions&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A function has a list of parameter declarations, a return type,&lt;br /&gt;
and a block of statements.  Execution must end with a return statement&lt;br /&gt;
returning an expression that can be converted to the return type,&lt;br /&gt;
unless void, in which case there is an implied &amp;lt;tt&amp;gt;return;&amp;lt;/tt&amp;gt; at&lt;br /&gt;
the end.  Arguments passed to a function must match the parameters&lt;br /&gt;
or allow implicit conversion (such as int to double).&lt;br /&gt;
Functions must be defined before use, or&lt;br /&gt;
have a matching declaration that replaces the block with a semicolon&lt;br /&gt;
and may optionally omit parameter names.&lt;br /&gt;
Functions are always global (not defined in other functions).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  void f(double x, double); // Declaration&lt;br /&gt;
  double g() {              // Definition&lt;br /&gt;
    return 3;               // Implied conversion to double (3.0)&lt;br /&gt;
  }&lt;br /&gt;
  int main() {              // Execution starts with function main&lt;br /&gt;
    f(g(), 5);              // Calls g, then f with implicit 5.0&lt;br /&gt;
    return 0;               // Return UNIX $status or Windows ERRORLEVEL&lt;br /&gt;
  }&lt;br /&gt;
  void f(double x, double y) { // Definition must match declaration&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; x+y;&lt;br /&gt;
    return;                 // Optional&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Command line arguments may be passed to&lt;br /&gt;
&amp;lt;tt&amp;gt;main(int argc, char** argv)&amp;lt;/tt&amp;gt; where &amp;lt;tt&amp;gt;argv&amp;lt;/tt&amp;gt; is&lt;br /&gt;
an array of &amp;lt;tt&amp;gt;argc&amp;lt;/tt&amp;gt; elements of type char* ('\0' terminated array&lt;br /&gt;
of char), one element for each word (separated by white spaces).&lt;br /&gt;
In UNIX, the command line is expanded before being passed (* becomes&lt;br /&gt;
a directory listing, etc).  The following program prints the command&lt;br /&gt;
line.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // echo.cpp&lt;br /&gt;
  #include &amp;amp;lt;iostream&amp;gt;&lt;br /&gt;
  using namespace std;&lt;br /&gt;
  int main(int argc, char** argv) {&lt;br /&gt;
    for (int i=0; i&amp;amp;lt;argc; ++i)&lt;br /&gt;
      cout &amp;amp;lt;&amp;amp;lt; argv[i] &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;b&amp;gt;g++ echo.cpp&lt;br /&gt;
  ./a.out hello world&amp;lt;/b&amp;gt;&lt;br /&gt;
  ./a.out&lt;br /&gt;
  hello&lt;br /&gt;
  world&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Function parameters have local scope.  They are initialized by&lt;br /&gt;
copying the argument, which may be an expression.  Reference parameters&lt;br /&gt;
are not copied; they become references to the arguments passed, which&lt;br /&gt;
must be objects that the function may modify.  If the reference is&lt;br /&gt;
const, then the argument may be an expression.  Const reference is&lt;br /&gt;
the most common for passing large objects because it avoids the run&lt;br /&gt;
time overhead of copying.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  void assign_if(bool cond, string&amp;amp; to,  const string&amp;amp; from) {&lt;br /&gt;
              // value      reference    const reference&lt;br /&gt;
    if (cond)&lt;br /&gt;
      to=from;&lt;br /&gt;
  }&lt;br /&gt;
  int main() {&lt;br /&gt;
    string s;&lt;br /&gt;
    assign_if(true, s, &amp;quot;a&amp;quot;);   // OK, s=&amp;quot;a&amp;quot;&lt;br /&gt;
    assign_if(false, &amp;quot;b&amp;quot;, s);  // Error: to refers to a const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions returning a reference must return an object which&lt;br /&gt;
can be assigned to, and that object must exist after returning&lt;br /&gt;
(global or static, but not local).  The function may be called&lt;br /&gt;
on the left side of an assignment.  Functions returning by value&lt;br /&gt;
make a temporary copy which is const.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int  a=1;                           // Global&lt;br /&gt;
  int  f() {return a;}                // OK, returns copy of a&lt;br /&gt;
  int&amp;amp; g() {return a;}                // OK, g() is alias for a&lt;br /&gt;
  int&amp;amp; h() {return a+1;}              // Error, reference to const&lt;br /&gt;
  int&amp;amp; i() {int b; return b;}         // Error, b destroyed after return&lt;br /&gt;
  int&amp;amp; j() {static int b; return b;}  // OK, static has global lifespan&lt;br /&gt;
  int main() {&lt;br /&gt;
    f()=2;    // Error, assignment to const&lt;br /&gt;
    g()=f();  // OK, a=1;&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions with the same name may be overloaded by matching the&lt;br /&gt;
arguments to the parameters.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int abs(int);&lt;br /&gt;
  double abs(double);&lt;br /&gt;
  int main() {&lt;br /&gt;
    abs(3);    // int&lt;br /&gt;
    abs(3.0);  // double&lt;br /&gt;
    abs(&amp;quot;3&amp;quot;);  // Error, no match&lt;br /&gt;
    abs('a');  // Error, ambiguous, could convert char to int or double&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most operators X can be overloaded by defining a function named&lt;br /&gt;
&amp;lt;tt&amp;gt;operator X()&amp;lt;/tt&amp;gt; taking the operands as arguments.  At least one&lt;br /&gt;
argument has to be a class type.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string operator - (const string&amp;amp; s, int i);  // Defines s-i&lt;br /&gt;
  string operator - (const string&amp;amp; s);         // Defines -s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Operators &amp;lt;tt&amp;gt;. :: ?:&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;sizeof&amp;lt;/tt&amp;gt; cannot be overloaded.&lt;br /&gt;
Operators &amp;lt;tt&amp;gt;= [] -&amp;gt;&amp;lt;/tt&amp;gt; cannot be overloaded except as class members.&lt;br /&gt;
Postfix &amp;lt;tt&amp;gt;++ --&amp;lt;/tt&amp;gt;&lt;br /&gt;
are overloaded as binary operators with a second dummy &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;&lt;br /&gt;
parameter to distinguish from the prefix form.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string&amp;amp; operator++(const string&amp;amp; s);      // defines ++s&lt;br /&gt;
  string  operator++(const string&amp;amp; s, int); // defines s++&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions may have default arguments by initializing the parameters.&lt;br /&gt;
Defaults should be specified only once.  Defaulted parameters must&lt;br /&gt;
appear after all non-default parameters.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  void f(int i, int j=0, int k=0);  // OK&lt;br /&gt;
  void g(int i=0, int j);           // Error&lt;br /&gt;
  int main() {&lt;br /&gt;
    f(1, 2);  // f(1, 2, 0);&lt;br /&gt;
    f(1);     // f(1, 0, 0);&lt;br /&gt;
    f();      // Error&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
  void f(int i, int j, int k) {}    // Defaults not specified again&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=templatefunction&amp;gt;&lt;br /&gt;
A &amp;lt;b&amp;gt;template&amp;lt;/b&amp;gt; overloads a function for all types.  The declaration&lt;br /&gt;
&amp;lt;tt&amp;gt;template &amp;amp;lt;class T, class U&amp;gt;&amp;lt;/tt&amp;gt; before a function definition&lt;br /&gt;
allows T and U to be used in the code as types.&lt;br /&gt;
The compiler will figure out appropriate substitutions&lt;br /&gt;
from the arguments.  A non-templated overloaded function takes&lt;br /&gt;
precedence over a template.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt;&lt;br /&gt;
  void swap(T&amp;amp; a, T&amp;amp; b) {&lt;br /&gt;
    T tmp=a;&lt;br /&gt;
    a=b;&lt;br /&gt;
    b=tmp;&lt;br /&gt;
  }&lt;br /&gt;
  void swap(string&amp;amp; a, string&amp;amp; b);  // Overrides the case T=string&lt;br /&gt;
  int main() {&lt;br /&gt;
    int i=1, j=2;&lt;br /&gt;
    string a, b;&lt;br /&gt;
    swap(i, j);        // OK, T is int&lt;br /&gt;
    swap(a, b);        // OK, calls non-templated swap&lt;br /&gt;
    swap(i, a);        // Error, cannot resolve T&lt;br /&gt;
    swap(cout, cerr);  // Error, ostream does not allow =&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;inline&amp;lt;/tt&amp;gt; is a hint to the compiler to optimize for speed&lt;br /&gt;
by expanding the code where it is called, saving a call and return&lt;br /&gt;
instruction.  Unlike a macro, semantics are preserved.&lt;br /&gt;
Only short functions should be inlined.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  inline int min1(int a, int b) {return a&amp;amp;ltb?a:b;}&lt;br /&gt;
  #define min2(a,b) ((a)&amp;amp;lt;(b)?(a):(b))&lt;br /&gt;
  int main() {&lt;br /&gt;
    min1(f(), 0);  // calls f() once&lt;br /&gt;
    min2(f(), 0);  // calls f() twice, expands to ((f())&amp;amp;lt;(0)?(f()):(0))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=pointers&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Pointers&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A pointer stores the address of another object, and unlike a reference,&lt;br /&gt;
may be moved to point elsewhere.  The expression &amp;lt;tt&amp;gt;&amp;amp;amp;x&amp;lt;/tt&amp;gt; means &amp;quot;address of&lt;br /&gt;
x&amp;quot; and has type &amp;quot;pointer to x&amp;quot;.  If &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; has type &amp;lt;tt&amp;gt;T&amp;lt;/tt&amp;gt;,&lt;br /&gt;
then &amp;lt;tt&amp;gt;&amp;amp;x&amp;lt;/tt&amp;gt; has type &amp;lt;tt&amp;gt;T*&amp;lt;/tt&amp;gt;.&lt;br /&gt;
If &amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt; has type &amp;lt;tt&amp;gt;T*&amp;lt;/tt&amp;gt;, then &amp;lt;tt&amp;gt;*p&amp;lt;/tt&amp;gt; is the object&lt;br /&gt;
to which it points, which has type &amp;lt;tt&amp;gt;T&amp;lt;/tt&amp;gt;.&lt;br /&gt;
The * and &amp;amp; operators are inverses, e.g. &amp;lt;tt&amp;gt;*&amp;amp;x == x&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Two pointers are equal if they point to the same object.&lt;br /&gt;
All pointer types are distinct,&lt;br /&gt;
and can only be assigned pointers of the same type or 0 (NULL).&lt;br /&gt;
There are no run time checks against reading or writing the contents&lt;br /&gt;
of a pointer to invalid memory.  This usually causes a segmentation&lt;br /&gt;
fault or general protection fault.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int i=3, *p=&amp;amp;amp;i;    // p points to i, *p == 3&lt;br /&gt;
  *p=5;              // i=5&lt;br /&gt;
  p=new int(6);      // OK, p points to an int with value 6&lt;br /&gt;
  p=new char('a');   // Error, even though char converts to int&lt;br /&gt;
  p=6;               // Error, no conversion from int to pointer&lt;br /&gt;
  p=0;               // OK&lt;br /&gt;
  p=i-5;             // Error, compiler can't know this is 0&lt;br /&gt;
  *p=7;              // Segmentation fault: writing to address 0&lt;br /&gt;
  int *q; *q;        // Segmentation fault: q is not initialized, reading random memory&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A pointer to a const object of type T must also be const, of&lt;br /&gt;
type &amp;lt;tt&amp;gt;const T*&amp;lt;/tt&amp;gt;, meaning that the pointer may be assigned to&lt;br /&gt;
but its contents may not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const double PI=3.1415926535898;&lt;br /&gt;
  double* p=&amp;amp;amp;PI;              // Error, would allow *p=4 to change PI&lt;br /&gt;
  const double* p=&amp;amp;amp;PI;        // OK, can't assign to *p (but may assign to p)&lt;br /&gt;
  double* const p=&amp;amp;amp;PI;        // Error, may assign to *p (but not to p)&lt;br /&gt;
  const double* const p=&amp;amp;amp;PI;  // OK, both *p and p are const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A function name used without parenthesis is a pointer to a function.&lt;br /&gt;
Function pointers can be assigned values and called.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int f(double);     // functions f and g take double and return int&lt;br /&gt;
  int g(double);&lt;br /&gt;
  int *h(double);    // function h takes double and returns pointer to int&lt;br /&gt;
  int (*p)(double);  // p is a pointer to a function that takes double and returns int&lt;br /&gt;
  int main() {&lt;br /&gt;
    p=f; p(3.0);     // calls f(3.0)&lt;br /&gt;
    p=g; p(3.0);     // calls g(3.0)&lt;br /&gt;
    p=h;             // Error, type mismatch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Explicit pointer conversions are allowed but usually unsafe.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int i, *p=&amp;amp;i;&lt;br /&gt;
  i=int(3.0);        // OK, rounds 3.0&lt;br /&gt;
  *(double*)p = 3.0; // Crash, writes beyond end of i&lt;br /&gt;
  *(double*)&amp;amp;PI = 4; // Overwrites a const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
These may also be written (with the same results):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  i=static_cast&amp;amp;lt;int&amp;gt;(3.0);            // Apply standard conversions&lt;br /&gt;
  *reinterpret_cast&amp;amp;lt;double*&amp;gt;p = 3.0;  // Pretend p has type double*&lt;br /&gt;
  *const_cast&amp;amp;lt;double*&amp;gt;&amp;amp;amp;PI = 4;        // Same type except for const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=arrays&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Arrays&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The size of an array must be specified by a constant, and may be left&lt;br /&gt;
blank if the array is initialized from a list.  Array bounds&lt;br /&gt;
start at 0.  There are no run time checks on array bounds.&lt;br /&gt;
Multi-dimensional arrays use a separate bracket for each dimension.&lt;br /&gt;
An array name used without brackets is a pointer to the first element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a[]={0,1,2,3,4};    // Array with elements a[0] to a[4]&lt;br /&gt;
  int b[5]={6,7};         // Implied ={6,7,0,0,0};&lt;br /&gt;
  int c[5];               // Not initialized, c[0] to c[4] could have any values&lt;br /&gt;
  int d[2][3]={{1,2,3},{4,5,6}};  // Initialized 2-D array&lt;br /&gt;
  int i=d[1][2];          // 6&lt;br /&gt;
  d[-1][7]=0;             // Not checked, program may crash&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The bare name of an array is a const pointer to the first element.  If&lt;br /&gt;
p is a pointer to an array element, then p+i points i elements ahead,&lt;br /&gt;
to p[i].  By definition, p[i] is *(p+i).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a[5];               // a[0] through a[4]&lt;br /&gt;
  int* p=a+2;             // *p is a[2]&lt;br /&gt;
  p[1];                   // a[3]&lt;br /&gt;
  p-a;                    // 2&lt;br /&gt;
  p&amp;gt;a;                    // true because p-a &amp;gt; 0&lt;br /&gt;
  p-1 == a+1              // true, both are &amp;amp;a[1]&lt;br /&gt;
  *a;                     // a[0] or p[-2]&lt;br /&gt;
  a=p;                    // Error, a is const (but not *a)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A literal string enclosed in double quotes is an unnamed static array of&lt;br /&gt;
const char with an implied '\0' as the last element.  It may be used either to&lt;br /&gt;
initialize an array of char, or in an expression as a pointer to the&lt;br /&gt;
first char.  Special chars in literals may be escaped with a  backslash&lt;br /&gt;
as before.  Literal strings are concatenated without a + operator&lt;br /&gt;
(convenient to span lines).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  char s[]=&amp;quot;abc&amp;quot;;                       // char s[4]={'a','b','c','\0'};&lt;br /&gt;
  const char* p=&amp;quot;a&amp;quot; &amp;quot;b\n&amp;quot;;              // Points to the 'a' in the 4 element array &amp;quot;ab\n\0&amp;quot;&lt;br /&gt;
  const char* answers[2]={&amp;quot;no&amp;quot;,&amp;quot;yes&amp;quot;};  // Array of pointers to char&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; answers[1];                   // prints yes (type const char*)&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; answers[1][0];                // prints y (type const char)&lt;br /&gt;
  &amp;quot;abc&amp;quot;[1]                              // 'b'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays do not support copying, assignment, or comparison.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a[5], b[5]=a;       // Error: can't initialize b this way&lt;br /&gt;
  b=a;                    // Error: can't assign arrays&lt;br /&gt;
  b==a;                   // false, comparing pointers, not contents&lt;br /&gt;
  &amp;quot;abc&amp;quot;==&amp;quot;abc&amp;quot;            // false, comparing pointers to 2 different locations&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The size of an array created with &amp;lt;tt&amp;gt;new[]&amp;lt;/tt&amp;gt; may be an expression.  The&lt;br /&gt;
elements cannot be initialized with a list.  There is no run time check&lt;br /&gt;
against accessing deleted elements.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int n, *p;&lt;br /&gt;
  cin &amp;gt;&amp;gt; n;&lt;br /&gt;
  p=new int[n];  // Elements p[0] to p[n-1] with values initially undefined&lt;br /&gt;
  delete[] p;    // Use delete with new or new(), delete[] with new[]&lt;br /&gt;
  p[0] = 1;      // May crash&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=static&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;static&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Normally, objects are placed on the stack.  Memory is allocated&lt;br /&gt;
by growing the stack at the top; thus objects are destroyed in&lt;br /&gt;
the reverse order in which they are created.  An object's life span&lt;br /&gt;
is the same as its scope.  If an object comes into scope more than once,&lt;br /&gt;
then it is reinitialized each time, and destroyed when leaving its scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  +----------+&lt;br /&gt;
  |          |&lt;br /&gt;
  |   Heap   |  Allocated with &amp;lt;i&amp;gt;new&amp;lt;/i&amp;gt; until deleted or program exits.&lt;br /&gt;
  |          |&lt;br /&gt;
  +^^^^^^^^^^+  &lt;br /&gt;
  |   Stack  |  Local objects, parameters, temporaries, function return addresses.&lt;br /&gt;
  +----------+     +---------+&lt;br /&gt;
  |   Data   | &amp;amp;lt;-- |  Data   |  Initial values for static and global objects.&lt;br /&gt;
  +----------+     +---------+&lt;br /&gt;
  |   Code   | &amp;amp;lt;-- |  Code   |  Executable machine instructions.&lt;br /&gt;
  +----------+     +---------+  (Cannot be read or written by program.)&lt;br /&gt;
  | Reserved |    a.out on disk&lt;br /&gt;
  | for OS   |&lt;br /&gt;
  | and other|  Cannot be read or written by program, will cause segmentation&lt;br /&gt;
  | programs |  fault or general protection fault.&lt;br /&gt;
  +----------+&lt;br /&gt;
     Memory&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;static&amp;lt;/tt&amp;gt; objects are placed in the data segment.  They are&lt;br /&gt;
initialized from values stored in the executable file, and therefore&lt;br /&gt;
these values must be known at compile time.  Initialization occurs only&lt;br /&gt;
once.  Values are maintained when the object is out of scope (e.g.&lt;br /&gt;
between function calls), and it is safe to return a pointer or reference&lt;br /&gt;
to them.  Numeric values not explicitly initialized are set to 0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int&amp;amp; f() {        // Return by reference, f() is an alias for s, not a temporary copy&lt;br /&gt;
    static int s=1; // Initialized only once&lt;br /&gt;
    ++s;&lt;br /&gt;
    return s;       // Safe to return by reference&lt;br /&gt;
  }&lt;br /&gt;
  int main() {&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; f();    // 2&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; f();    // 3&lt;br /&gt;
    f()=5;          // OK, s=5;&lt;br /&gt;
    s=6;            // Error, s is not in scope&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=register&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;lt;tt&amp;gt;register&amp;lt;/tt&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
(Rare) A hint to the compiler to optimize an int or pointer for speed.&lt;br /&gt;
It is no longer used because most optimizers can do a better job.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  register int x;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=volatile&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;lt;tt&amp;gt;volatile&amp;lt;/tt&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
(Rare) Indicates that an object might be modified from outside the&lt;br /&gt;
program (e.g. a hardware input port) and that the optimizer should not&lt;br /&gt;
make copies of it.  Its use is machine dependent.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  const volatile unsigned short&amp;amp; port=*(const short*)0xfffe; // 16 bit port at address xfffe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=standardlibrarytypes&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Standard Library Types&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Standard library types (string, vector, map...) and objects&lt;br /&gt;
(cin, cout...) require a&lt;br /&gt;
&amp;lt;tt&amp;gt;#include &amp;amp;lt;&amp;lt;i&amp;gt;header&amp;lt;/i&amp;gt;&amp;amp;gt;&amp;lt;/tt&amp;gt; and must be extracted from&lt;br /&gt;
namespace &amp;lt;tt&amp;gt;std&amp;lt;/tt&amp;gt;, either with a &amp;lt;tt&amp;gt;using namespace std;&amp;lt;/tt&amp;gt;&lt;br /&gt;
statement or by using the fully qualified names preceded with &amp;lt;tt&amp;gt;std::&amp;lt;/tt&amp;gt;,&lt;br /&gt;
as in &amp;lt;tt&amp;gt;std::cout&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #include &amp;amp;lt;iostream&amp;gt;                    #include &amp;amp;lt;iostream&amp;gt;&lt;br /&gt;
  int main() {                           using namespace std;&lt;br /&gt;
    std::cout &amp;amp;lt;&amp;amp;lt; &amp;quot;Hello\n&amp;quot;;              int main() {&lt;br /&gt;
    return 0;                              cout &amp;amp;lt;&amp;amp;lt; &amp;quot;Hello\n&amp;quot;;&lt;br /&gt;
  }                                        return 0;&lt;br /&gt;
                                        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=iostream&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;iostream&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The header &amp;amp;lt;iostream&amp;gt; defines global object &amp;lt;tt&amp;gt;cin&amp;lt;/tt&amp;gt; of&lt;br /&gt;
type &amp;lt;tt&amp;gt;istream&amp;lt;/tt&amp;gt;, and global objects &amp;lt;tt&amp;gt;cout, cerr, clog&amp;lt;/tt&amp;gt;&lt;br /&gt;
of type &amp;lt;tt&amp;gt;ostream&amp;lt;/tt&amp;gt;.  &amp;lt;tt&amp;gt;cin&amp;lt;/tt&amp;gt; represents standard input,&lt;br /&gt;
normally the keyboard, unless redirected to a file or piped on the&lt;br /&gt;
command line.  &amp;lt;tt&amp;gt;cout&amp;lt;/tt&amp;gt; represents standard output, which is&lt;br /&gt;
normally the screen unless redirected or piped.  Writing to&lt;br /&gt;
&amp;lt;tt&amp;gt;cerr&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;clog&amp;lt;/tt&amp;gt; both write to the screen even if output&lt;br /&gt;
is redirected.  The difference is that writing a newline ('\n') flushes&lt;br /&gt;
any buffered output to &amp;lt;tt&amp;gt;cerr&amp;lt;/tt&amp;gt; but not to &amp;lt;tt&amp;gt;cout&amp;lt;/tt&amp;gt; or&lt;br /&gt;
&amp;lt;tt&amp;gt;clog&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In the following, &amp;lt;tt&amp;gt;in&amp;lt;/tt&amp;gt; is an istream (cin),&lt;br /&gt;
&amp;lt;tt&amp;gt;out&amp;lt;/tt&amp;gt; is an ostream (cout, cerr, clog), i is int, c is char, and cp is char*.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  in &amp;gt;&amp;gt; x;               // Read 1 word to numeric, string, or char* x, return in&lt;br /&gt;
  in.get();              // Read 1 char (0-255) or EOF (-1) as an int&lt;br /&gt;
  in.get(c);             // Read 1 char into c, return in&lt;br /&gt;
  in.unget();            // Put back last char read, return in&lt;br /&gt;
  in.getline(cp, i);     // Read up to i chars into char cp[i] or until '\n', return in&lt;br /&gt;
  in.getline(cp, i, c);  // Read to c instead of '\n', return in&lt;br /&gt;
  getline(in, s);        // Read up to '\n' into string s, return in&lt;br /&gt;
  in.good();             // true if no error or EOF&lt;br /&gt;
  bool(in);              // in.good();&lt;br /&gt;
  in.bad();              // true if unexpected char in formatted input&lt;br /&gt;
  in.clear();            // Allow more input after bad, or throw an ios::failure&lt;br /&gt;
  in.eof();              // true if end of file&lt;br /&gt;
  in.fail();             // true if system input error&lt;br /&gt;
&lt;br /&gt;
  out &amp;amp;lt;&amp;amp;lt; x;                // Formatted output, redirected with &amp;gt;&lt;br /&gt;
  out &amp;amp;lt;&amp;amp;lt; endl;             // Print '\n' and flush&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Input with &amp;amp;gt;&amp;amp;gt; reads a contiguous sequence of non-whitespace&lt;br /&gt;
characters.  If x is numeric and the next word contains invalid&lt;br /&gt;
characters (such as &amp;quot;1.5&amp;quot; or &amp;quot;foo&amp;quot; for an int), then the first&lt;br /&gt;
offending character remains unread, in.bad() is set, and no further&lt;br /&gt;
input can occur until in.clear() is called.  Input into a char*&lt;br /&gt;
array is not bounds checked.  Input returns the istream to allow&lt;br /&gt;
chaining, and has a conversion to bool to test for success.  Output&lt;br /&gt;
also returns the ostream to allow chaining.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Read and print pairs of strings and ints until something goes wrong&lt;br /&gt;
  // Input:  hi 3 there 5 this is 1 test&lt;br /&gt;
  // Output: hi 3&lt;br /&gt;
             there 5&lt;br /&gt;
&lt;br /&gt;
  string s; int i;&lt;br /&gt;
  while (cin &amp;gt;&amp;gt; s &amp;gt;&amp;gt; i)&lt;br /&gt;
    cout &amp;lt;&amp;lt; s &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cin.clear();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The get() methods read one character&lt;br /&gt;
including whitespace.  The various getline() functions read up through&lt;br /&gt;
the next newline character and discard the newline.&lt;br /&gt;
The methods &amp;lt;tt&amp;gt;good(), bad(), eof(), fail(), clear()&amp;lt;/tt&amp;gt;, and&lt;br /&gt;
implicit conversion to bool are available in &amp;lt;tt&amp;gt;ostream&amp;lt;/tt&amp;gt;,&lt;br /&gt;
just as in &amp;lt;tt&amp;gt;istream&amp;lt;/tt&amp;gt;, but are seldom used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=iomanip&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;iomanip&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Defines manipulators for formatted output of numeric types.&lt;br /&gt;
They have no effect on strings.  &amp;lt;tt&amp;gt;setw()&amp;lt;/tt&amp;gt; applies only to the&lt;br /&gt;
next object printed, but the others remain in effect until changed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  out &amp;amp;lt;&amp;amp;lt; setw(i);          // Pad next output to i chars, then back to 0&lt;br /&gt;
  out &amp;amp;lt;&amp;amp;lt; setfill(c);       // Pad with c (default ' ')&lt;br /&gt;
  out &amp;amp;lt;&amp;amp;lt; setprecision(i);  // Use i significant digits for all float, double&lt;br /&gt;
&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; setw(6) &amp;amp;lt;&amp;amp;lt; setprecision(3) &amp;amp;lt;&amp;amp;lt; setfill('0') &amp;amp;lt;&amp;amp;lt; 3.1; // print &amp;quot;003.10&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=fstream&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;fstream&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Defines types &amp;lt;tt&amp;gt;ifstream&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;ofstream&amp;lt;/tt&amp;gt; representing&lt;br /&gt;
input and output files respectively.&lt;br /&gt;
&amp;lt;tt&amp;gt;ifstream&amp;lt;/tt&amp;gt; is derived from &amp;lt;tt&amp;gt;istream&amp;lt;/tt&amp;gt;,&lt;br /&gt;
inheriting all its operations (such as &amp;gt;&amp;gt;).  In addition,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ifstream in(cp);          // Open file named cp for reading&lt;br /&gt;
  ifstream in(cp, ios::in | ios::binary);  // Open in binary mode&lt;br /&gt;
  bool(in);                 // true if open successful&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;cp&amp;lt;/tt&amp;gt; is the file name.  It must be a char*, not string (use&lt;br /&gt;
&amp;lt;tt&amp;gt;s.c_str()&amp;lt;/tt&amp;gt; to convert string &amp;lt;tt&amp;gt;s&amp;lt;/tt&amp;gt;).&lt;br /&gt;
Input is normally in text mode.  In Windows, carriage returns ('\r') are&lt;br /&gt;
discarded, and an ASCII 26 ('\032') signals end of file.  In binary&lt;br /&gt;
mode and in UNIX, no such translation occurs.  The file is closed&lt;br /&gt;
when the ifstream is destroyed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  {&lt;br /&gt;
    ifstream f(&amp;quot;input.dat&amp;quot;, ios::in | ios::binary);&lt;br /&gt;
    if (!f)&lt;br /&gt;
      cerr &amp;amp;lt;&amp;amp;lt; &amp;quot;File not found\n&amp;quot;;&lt;br /&gt;
    else {&lt;br /&gt;
      int i=f.get();  // First byte or EOF if empty&lt;br /&gt;
    }&lt;br /&gt;
  } // f closed here&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;ofstream&amp;lt;/tt&amp;gt; is derived from &amp;lt;tt&amp;gt;ostream&amp;lt;/tt&amp;gt;,&lt;br /&gt;
inheriting all its operations (such as &amp;amp;lt;&amp;amp;lt;).  In addition,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ofstream os(cp);          // Open file named cp for writing&lt;br /&gt;
  ofstream os(cp, ios::out | ios::binary);  // Open in binary mode&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;In text mode in Windows, writing '\n' actually writes &amp;quot;\r\n&amp;quot;.&lt;br /&gt;
The file named cp is overwritten if it exists, or created otherwise.&lt;br /&gt;
The file is flushed and closed when the ofstream is destroyed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=string&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;string&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt; is like an array of char, but it also supports&lt;br /&gt;
copying, assignment, and comparison, and its size may be set or changed&lt;br /&gt;
at run time.&lt;br /&gt;
'\0' has no special meaning.  There is implicit conversion from char*&lt;br /&gt;
to string in mixed type expressions.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string()           // Empty string&lt;br /&gt;
  string(cp)         // Convert char* cp to string&lt;br /&gt;
  string(n, c)       // string of n copies of char c&lt;br /&gt;
  s=s2               // Assign char* or string s2 to string s&lt;br /&gt;
  s1&amp;amp;lt;s2              // Also ==, !=, &amp;gt;, &amp;amp;lt;=, &amp;amp;gt;=, either s1 or s2 may be char*&lt;br /&gt;
  s.size()           // Length of string s&lt;br /&gt;
  string::size_type  // Type of s.size(), usually unsigned int&lt;br /&gt;
  s.empty()          // True if s.size() == 0&lt;br /&gt;
  s[i]               // i'th char, 0 &amp;lt;= i &amp;lt; s.size() (unchecked), may be assigned to&lt;br /&gt;
  s.at(i)            // s[i] with bounds check, throws out_of_range&lt;br /&gt;
  s1+s2              // Concatenate strings, either s1 or s2 may be char or char*&lt;br /&gt;
  s+=s2              // Append string, char, or char* s2 to string s&lt;br /&gt;
  s.c_str()          // string s as a const char* with trailing '\0'&lt;br /&gt;
  s.substr(i, j)     // Substring of string s of length j starting at s[i]&lt;br /&gt;
  s.substr(i)        // Substring from s[i] to the end&lt;br /&gt;
  s.find(s2)         // Index of char, char*, or string s2 in s, or string::npos if not found&lt;br /&gt;
  s.rfind(s2)        // Index of last occurrence of s2 in s&lt;br /&gt;
  s.find_first_of(s2)     // Index of first char in s that occurs in s2&lt;br /&gt;
  s.find_last_of(s2)      // Index of last char in s that occurs in s2&lt;br /&gt;
  s.find_first_not_of(s2) // Index of first char in s not found in s2&lt;br /&gt;
  s.find_last_not_of(s2)  // Index of last char in s not found in s2&lt;br /&gt;
  s.replace(i, j, s2)     // Replace s.substr(i, j) with s2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;s.size()&amp;lt;/tt&amp;gt; should be converted to &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;&lt;br /&gt;
to avoid unsigned comparison.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string s(3,'a');   // &amp;quot;aaa&amp;quot;&lt;br /&gt;
  s += &amp;quot;b&amp;quot;+s;        // &amp;quot;aaabaaa&amp;quot;&lt;br /&gt;
  for (int i=0; i!=int(s.size()); ++i) {  // print s one char at a time&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; s[i];&lt;br /&gt;
  s.size() &amp;gt; -1;     // false!  -1 is converted to unsigned&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt; supports standard container operations with regard to&lt;br /&gt;
iterators.  &amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt; iterators are random, supporting all the&lt;br /&gt;
pointer operators of &amp;lt;tt&amp;gt;char*&amp;lt;/tt&amp;gt;.  The notation &amp;lt;tt&amp;gt;[b,e)&amp;lt;/tt&amp;gt; means&lt;br /&gt;
the sequence such that pointer or iterator b points to the first element&lt;br /&gt;
and e points one past the last element.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  s.begin()          // Iterator pointing to s[0]&lt;br /&gt;
  s.end()            // Iterator pointing 1 past last char&lt;br /&gt;
  string::iterator   // Iterator type, like char*&lt;br /&gt;
  string::const_iterator  // Type if s is const, like const char*&lt;br /&gt;
  string(b, e)       // string initialized from sequence [b,e)&lt;br /&gt;
  s.erase(b)         // Remove char in s pointed to by b&lt;br /&gt;
  s.erase(b, e)      // Remove substring [b,e) from s&lt;br /&gt;
  s.replace(b, e, s2)  // Replace substring [b,e) with string s2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Conversion from &amp;lt;tt&amp;gt;iterator&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;const_iterator&amp;lt;/tt&amp;gt; is&lt;br /&gt;
allowed, but not the other way.  &amp;lt;tt&amp;gt;const_iterator&amp;lt;/tt&amp;gt; should be&lt;br /&gt;
used if the string is not going to be modified.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  char* cp=&amp;quot;ABCDE&amp;quot;;&lt;br /&gt;
  string s(cp, cp+5); // &amp;quot;ABCDE&amp;quot;&lt;br /&gt;
  string s2(s.begin()+1, s.end()-1);  // &amp;quot;BCD&amp;quot;&lt;br /&gt;
  for (string::const_iterator p=s.begin(); p!=s.end(); ++p)  // Print s one char at a time&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; *p;       // or p[0] &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As with arrays and pointers, indexing and iterator dereferencing are&lt;br /&gt;
not checked at run time.  Creating a string with a negative or very&lt;br /&gt;
large size is also trouble.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  string s(-1, 'x');              // Crash, negative size&lt;br /&gt;
  string s2(s.end(), s.begin());  // Crash, negative size&lt;br /&gt;
  s[-1]='x';                      // Crash, out of bounds&lt;br /&gt;
  *s.end()='x';                   // Crash, out of bounds&lt;br /&gt;
  string::iterator p; *p='x';     // Crash, dereferencing uninitialized iterator&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=vector&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;vector&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;vector&amp;amp;lt;T&amp;gt;&amp;lt;/tt&amp;gt; is like an array of T, but supports copying,&lt;br /&gt;
assignment, and comparison.  Its size can be set and changed at run&lt;br /&gt;
time, and it can efficiently implement a stack (O(1) time to push or pop).&lt;br /&gt;
It has random iterators like &amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt;, which behave like type T*&lt;br /&gt;
(or const T* if the vector is const).  If T is numeric, elements are&lt;br /&gt;
initialized to 0.  It is not possible to have an initialization list&lt;br /&gt;
such as {1,2,3}.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;()            // Empty vector, elements of type T&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;(n)           // n elements, default initialized&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;(n, x)        // n elements each initialized to x&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt; v2=v;        // Copy v to v2&lt;br /&gt;
  v2=v;                  // Assignment&lt;br /&gt;
  v2&amp;amp;lt;v                   // Also &amp;gt;, ==, !=, &amp;amp;lt;=, &amp;amp;gt;= if defined for T&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;(b, e)        // Initialize to sequence [b, e)&lt;br /&gt;
  v.size()               // n&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;::size_type   // Type of v.size(), usually unsigned int&lt;br /&gt;
  v.empty()              // true if v.size() == 0&lt;br /&gt;
  v[i]                   // i'th element, 0 &amp;lt;= i &amp;lt; v.size() (unchecked), may be assigned to&lt;br /&gt;
  v.at(i)                // v[i] with bounds check, throws out_of_range&lt;br /&gt;
  v.begin(), v.end()     // Iterators [b, e)&lt;br /&gt;
  vector&amp;amp;lt;T&amp;gt;::iterator    // Iterator type, also const_iterator&lt;br /&gt;
  v.back()               // v[v.size()-1] (unchecked if empty)&lt;br /&gt;
  v.push_back(x)         // Increase size by 1, copy x to last element&lt;br /&gt;
  v.pop_back()           // Decrease size by 1 (unchecked if empty)&lt;br /&gt;
  v.front()              // v[0] (unchecked)&lt;br /&gt;
  v.resize(n)            // Change size to n &amp;gt;= 0 (unchecked)&lt;br /&gt;
  v.insert(d, x)         // Insert x in front of iterator d, shift, increase size by 1&lt;br /&gt;
  v.insert(d, n, x)      // Insert n copies of x in front of d&lt;br /&gt;
  v.insert(d, b, e)      // Insert copy of [b, e) in front of d&lt;br /&gt;
  v.erase(d)             // Remove *d, shift, decrease size by 1&lt;br /&gt;
  v.erase(d, e)          // Remove subsequence [d, e)&lt;br /&gt;
  v.clear()              // v.erase(v.begin(), v.end())&lt;br /&gt;
  v.reserve(n)           // Anticipate that v will grow to size n &amp;gt;= v.size()&lt;br /&gt;
  v.capacity()           // Reserved size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For insert and erase, d and e must point into v (and d &amp;amp;lt;= e) or&lt;br /&gt;
the program may crash.  Elements from *d to the end are shifted and&lt;br /&gt;
the size is changed as needed.  Saved copies of iterators may become invalid&lt;br /&gt;
after any change of size or capacity (not checked).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;To implement &amp;lt;tt&amp;gt;push_back()&amp;lt;/tt&amp;gt; efficiently, a vector typically&lt;br /&gt;
doubles the reserved space when it runs out in order to minimize&lt;br /&gt;
memory reallocation and copying.  &amp;lt;tt&amp;gt;reserve()&amp;lt;/tt&amp;gt; allows this&lt;br /&gt;
strategy to be optimized.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Read words from input into a stack, print in reverse order&lt;br /&gt;
  string s;&lt;br /&gt;
  vector&amp;amp;lt;string&amp;gt; v;&lt;br /&gt;
  while (cin &amp;gt;&amp;gt; s)&lt;br /&gt;
    v.push_back(s);&lt;br /&gt;
  while (!v.empty()) {&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; v.back() &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
    v.pop_back();&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=deque&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;deque&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;deque&amp;lt;/tt&amp;gt; (double ended queue) is just like a vector, but&lt;br /&gt;
optimized for adding and removing elements at either end in O(1) time.&lt;br /&gt;
It lacks &amp;lt;tt&amp;gt;reserve()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;capacity()&amp;lt;/tt&amp;gt; and adds&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  v.push_front(x)        // v.insert(v.begin(), x)&lt;br /&gt;
  v.pop_front()          // v.erase(v.begin())&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=list&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;list&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt; is like a deque but optimized for insert and erase at&lt;br /&gt;
any point at the cost of random access.  It lacks [] (indexing),&lt;br /&gt;
and its iterators are &amp;lt;i&amp;gt;bidirectional&amp;lt;/i&amp;gt;, not supporting [], +, -,&lt;br /&gt;
&amp;amp;lt;, &amp;gt;, &amp;amp;lt;=, or &amp;gt;=.  &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt; adds&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  v.splice(d, v2, b);  // Move *b from list v2 to in front of d in v&lt;br /&gt;
  v.splice(d, v2);     // Move all elements of list v2 to in front of d in v&lt;br /&gt;
  v.splice(d, v2, b, e); // Move [b,e) in v2 to in front of d at v&lt;br /&gt;
  v.remove(x);         // Remove all elements equal to x&lt;br /&gt;
  v.remove_if(f);      // Remove elements x where f(x) is true&lt;br /&gt;
  v.sort();            // Sort list&lt;br /&gt;
  v.sort(f);           // Sort list using function bool f(x,y) instead of x &amp;amp;lt; y&lt;br /&gt;
  v.merge(v2);         // Merge sorted list v2 into sorted list v&lt;br /&gt;
  v.merge(v2, f);      // Merge using f(x,y) instead of x &amp;amp;lt; y to sort v&lt;br /&gt;
  v.unique();          // Remove duplicates from sorted list&lt;br /&gt;
  v.unique(f);         // Use f(x,y) instead of x == y&lt;br /&gt;
  v.reverse();         // Reverse order of elements&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Iterators can only be moved one element at a time using ++ or --, and&lt;br /&gt;
compared using == or !=.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  char* cp=&amp;quot;ABCDE&amp;quot;;&lt;br /&gt;
  list&amp;amp;lt;char&amp;gt; v(cp, cp+5);  // v.size() is 5&lt;br /&gt;
  for (list&amp;amp;lt;char&amp;gt;::const_iterator p=v.begin(); p!=v.end(); ++p)  // Print ABCDE&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; *p;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=map&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;map&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;map&amp;amp;lt;K,V&amp;gt; m&amp;lt;/tt&amp;gt; is a set of key-value pairs with unique, sorted&lt;br /&gt;
keys of type K and values of type V.  m[k] efficiently (O(log n) time)&lt;br /&gt;
returns the value associated with k (as an lvalue), or creates a default&lt;br /&gt;
value (0 if V is numeric) if k is used for the first time.&lt;br /&gt;
A map iterator points to a &amp;lt;tt&amp;gt;pair&amp;amp;lt;const K, V&amp;gt;&amp;lt;/tt&amp;gt;, which has&lt;br /&gt;
members &amp;lt;tt&amp;gt;first&amp;lt;/tt&amp;gt; of type const K and &amp;lt;tt&amp;gt;second&amp;lt;/tt&amp;gt; of type V.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  pair&amp;amp;lt;K,V&amp;gt; x(k,v);    // Create a pair x containing copies of k and v&lt;br /&gt;
  x.first              // k&lt;br /&gt;
  x.second             // v&lt;br /&gt;
  x=make_pair(k,v)     // x.first=k; x.second=v;&lt;br /&gt;
&lt;br /&gt;
  map&amp;amp;lt;K,V&amp;gt; m;          // map sorted by &amp;amp;lt; on K&lt;br /&gt;
  map&amp;amp;lt;K,V,f&amp;gt;()         // map sorted by f(x,y) instead of x&amp;amp;lt;y on K&lt;br /&gt;
  m[k]=v;              // Associate v (type V) with unique key k of type K&lt;br /&gt;
  m[k]                 // Retrieve v, or associate V() with k if new&lt;br /&gt;
  m.size()             // Number of unique keys&lt;br /&gt;
  m.empty()            // true if m.size() == 0&lt;br /&gt;
  map&amp;amp;lt;K,V&amp;gt;::iterator   // bidirectional, points to a pair&amp;amp;lt;const K, V&amp;gt;&lt;br /&gt;
  map&amp;amp;lt;K,V&amp;gt;::const_iterator   // points to a pair&amp;amp;lt;const K, const V&amp;gt;&lt;br /&gt;
  m.begin()            // Points to first pair (lowest k)&lt;br /&gt;
  m.end()              // Points 1 past last pair&lt;br /&gt;
  m.find(k)            // Points to pair containing k or m.end() if not found&lt;br /&gt;
  m.erase(k)           // Remove key K and its associated value&lt;br /&gt;
  m.erase(b)           // Remove pair pointed to by iterator b&lt;br /&gt;
  m.erase(b, e)        // Remove sequence [b, e)&lt;br /&gt;
  m.clear()            // Make empty: m.erase(m.begin(), m.end())&lt;br /&gt;
  m==m2                // Compare maps, also !=, &amp;amp;lt;, &amp;amp;lt;=, &amp;gt;, &amp;gt;=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We use &amp;lt;tt&amp;gt;m.find(k)&amp;lt;/tt&amp;gt; rather than m[k] when we wish to look up k&lt;br /&gt;
without increasing the size of m if k is not found.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Read words, print an alphabetical index of words with their counts&lt;br /&gt;
  string s;&lt;br /&gt;
  map&amp;amp;lt;string, int&amp;gt; m;&lt;br /&gt;
  while (cin &amp;gt;&amp;gt; s)&lt;br /&gt;
    ++m[s];&lt;br /&gt;
  for (map&amp;amp;lt;string, int&amp;gt;::const_iterator p=m.begin(); p!=m.end(); ++p)&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; p-&amp;gt;first &amp;amp;lt;&amp;amp;lt; &amp;quot; &amp;quot; &amp;amp;lt;&amp;amp;lt; p-&amp;gt;second &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;multimap&amp;lt;/tt&amp;gt; is a &amp;lt;tt&amp;gt;map&amp;lt;/tt&amp;gt; that allows duplicate keys.&lt;br /&gt;
It support all &amp;lt;tt&amp;gt;map&amp;lt;/tt&amp;gt; operations except [].  Elements are added&lt;br /&gt;
by inserting a pair&amp;amp;lt;K,V&amp;gt; and retrieved by &amp;lt;tt&amp;gt;m.equal_range(k)&amp;lt;/tt&amp;gt; which&lt;br /&gt;
returns a pair of iterators defining the sequence of pairs matching k.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  multimap&amp;amp;lt;K,V,f&amp;gt; m;   // f defaults to &amp;amp;lt; on K&lt;br /&gt;
  m.insert(make_pair(k,v))  // Insert a pair&lt;br /&gt;
  pair&amp;amp;lt;multimap&amp;amp;lt;K,V,f&amp;gt;::iterator, multimap&amp;amp;lt;K,V,f&amp;gt;::iterator&amp;gt; p&lt;br /&gt;
    = m.equal_range(k) // Sequence with key k is [p-&amp;gt;first, p-&amp;gt;second)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;f (when used as a template argument) is a &amp;lt;i&amp;gt;functoid&amp;lt;/i&amp;gt; (or&lt;br /&gt;
function object), a class&lt;br /&gt;
that looks like a function by overloading ().  For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt; class GreaterThan {&lt;br /&gt;
  public:&lt;br /&gt;
    bool operator()(const T&amp;amp; a, const T&amp;amp; b) const {return b &amp;amp;lt; a;}&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  map&amp;amp;lt;string, int, GreaterThan&amp;amp;lt;T&amp;gt; &amp;gt; m;  // keys sorted in reverse order&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some function objects can be found in &amp;lt;a href=#functional&amp;gt;&amp;amp;lt;functional&amp;gt;&amp;lt;/a&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=set&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;set&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;set&amp;amp;lt;K&amp;gt;&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;multiset&amp;amp;lt;K&amp;gt;&amp;lt;/tt&amp;gt; are like a map&lt;br /&gt;
and multimap, but without values.  Iterators point to a K rather&lt;br /&gt;
than a pair.  There is no [] operator.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  set&amp;amp;lt;K&amp;gt; m;            // Elements are sorted by &amp;amp;lt; on K&lt;br /&gt;
  m.insert(k)          // Add an element&lt;br /&gt;
  m.erase(k)           // Remove an element&lt;br /&gt;
  m.find(k)!=m.end()   // Test if k is in m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=queue&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;queue&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;queue&amp;lt;/tt&amp;gt; is a container in which elements are inserted at the&lt;br /&gt;
back and removed from the front.  This could also be done with a&lt;br /&gt;
&amp;lt;tt&amp;gt;deque&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt;, so no new capabilities are provided.&lt;br /&gt;
A &amp;lt;tt&amp;gt;queue&amp;lt;/tt&amp;gt; does not support iterators or indexing.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  queue&amp;amp;lt;T&amp;gt; q;          // Queue of type T&lt;br /&gt;
  q.size()             // Number of items in q&lt;br /&gt;
  q.empty()            // true if q.size() == 0&lt;br /&gt;
  q.push(x)            // Put x in the back&lt;br /&gt;
  x=q.back()           // The item last pushed, may be assigned to&lt;br /&gt;
  x=q.front()          // The next item to pop, may be assigned to&lt;br /&gt;
  q.pop()              // Remove the front item&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;priority_queue&amp;lt;/tt&amp;gt; is more useful.  It sorts the items as they&lt;br /&gt;
are pushed so that the largest is on top and removed first.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  priority_queue&amp;amp;lt;T&amp;gt; q; // Element type is T&lt;br /&gt;
  priority_queue&amp;amp;lt;T, vector&amp;amp;lt;T&amp;gt;, f&amp;gt; q;  // Use functoid f(x,y) instead of x &amp;amp;lt; y to sort&lt;br /&gt;
  q.size(), q.empty()  // As before&lt;br /&gt;
  q.push(x)            // Insert x&lt;br /&gt;
  x=q.top()            // Largest item in q, cannot be assigned to&lt;br /&gt;
  q.pop()              // Remove top item&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=stack&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;stack&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Items are popped from the top of a &amp;lt;tt&amp;gt;stack&amp;lt;/tt&amp;gt; in the reverse order&lt;br /&gt;
in which they were pushed.  It does not provide any new functionality&lt;br /&gt;
beyond a vector, deque, or list, and does not support iterators or indexing.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  stack&amp;amp;lt;T&amp;gt; s;          // Stack with elements of type T&lt;br /&gt;
  s.size(), s.empty()  // As with queue&lt;br /&gt;
  s.push(x);           // Put x on top&lt;br /&gt;
  x=s.top();           // Last item pushed, may be assigned to&lt;br /&gt;
  s.pop();             // Remove the top item&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=bitset&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;bitset&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;bitset&amp;amp;lt;N&amp;gt;&amp;lt;/tt&amp;gt; is like a &amp;lt;tt&amp;gt;vector&amp;amp;lt;bool&amp;gt;&amp;lt;/tt&amp;gt; with fixed&lt;br /&gt;
size N, but without iterators, and supporting logical operators like&lt;br /&gt;
an N-bit &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;.  Its elements have the values 0 or 1.  It is&lt;br /&gt;
implemented efficiently, with 8 elements per byte.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  bitset&amp;amp;lt;N&amp;gt; b;         // N-bit bitset, N must be a compile time constant&lt;br /&gt;
  bitset&amp;amp;lt;N&amp;gt; b=x;       // Initialize b[0]..b[31] from bits of long x&lt;br /&gt;
  b[i]                 // i'th bit, 0 &amp;amp;lt;= i &amp;amp;lt; N or throw out_of_range()&lt;br /&gt;
  b.size()             // N, cannot be changed&lt;br /&gt;
  b.set(i)             // b[i] = 1&lt;br /&gt;
  b.reset(i)           // b[i] = 0&lt;br /&gt;
  b.flip(i)            // b[i] = 1 - b[i]&lt;br /&gt;
  b.test(i)            // true if b[i] == 1&lt;br /&gt;
  b.set()              // Set all bits, also b.reset(), b.flip()&lt;br /&gt;
  b &amp;amp; b2               // Bitwise AND, also | ^ ~ &amp;amp;lt;&amp;amp;lt; &amp;gt;&amp;gt; &amp;amp;= |= ^= &amp;amp;lt;&amp;amp;lt;= &amp;gt;&amp;gt;= == !=&lt;br /&gt;
  b.count()            // Number of bits set to 1&lt;br /&gt;
  b.any()              // true if b.count() &amp;gt; 0&lt;br /&gt;
  b.none()             // true if b.count() == 0&lt;br /&gt;
  cin &amp;gt;&amp;gt; b             // Read bits as '0' and '1' e.g. &amp;quot;10101&amp;quot;&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; b            // Write bits as '0' and '1'&lt;br /&gt;
  bitset&amp;amp;lt;N&amp;gt; b(s);      // Initialize from string s of '0' and '1' or throw invalid_argument()&lt;br /&gt;
  s=b.template to_string&amp;amp;lt;char&amp;gt;()  // Convert to string&lt;br /&gt;
  x=b.to_ulong()       // Convert to unsigned long, throw overflow_error() if bits &amp;gt; 31 set&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=valarray&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;valarray&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;valarray&amp;lt;/tt&amp;gt; is like a fixed sized array or vector that supports&lt;br /&gt;
arithmetic operations on all the elements at once.  For instance, if&lt;br /&gt;
x and y are valarrays of the same size, then x+y is a valarray containing&lt;br /&gt;
the sums of the corresponding elements.&lt;br /&gt;
Likewise, y=sqrt(x) assigns y[i]=sqrt(x[i]) to each element of y.&lt;br /&gt;
In mixed type expressions,&lt;br /&gt;
a scalar (element of type T) is promoted to a valarray of the same size&lt;br /&gt;
by duplicating it, e.g. x+1 adds 1 to all elements of x.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  valarray&amp;amp;lt;T&amp;gt; v(n);    // n elements of type T, initially T() or 0&lt;br /&gt;
  valarray&amp;amp;lt;T&amp;gt; v(x, n); // n copies of x (note arguments are backwards)&lt;br /&gt;
  valarray&amp;amp;lt;T&amp;gt; v(a, n); // Initialize from array a[0]..a[n-1]&lt;br /&gt;
  valarray&amp;amp;lt;T&amp;gt; v;       // size is 0&lt;br /&gt;
  v.size()             // Number of elements, n&lt;br /&gt;
  v[i]                 // i'th element, 0 &amp;lt;= i &amp;lt; n, not checked&lt;br /&gt;
  v+=x, v+=v           // Add x or v[i] to all v[i], also = -= *= /= %= ^= &amp;amp;= |= &amp;lt;&amp;lt;= &amp;gt;&amp;gt;=&lt;br /&gt;
  v+v, v+x, x+v        // Also - * / % ^ &amp;amp; | &amp;lt;&amp;lt; &amp;gt;&amp;gt; and unary + - ~ !&lt;br /&gt;
  sqrt(v)              // Also all functions in &amp;lt;a href=#cmath&amp;gt;cmath&amp;lt;/a&amp;gt;&lt;br /&gt;
  x=v.sum()            // Sum of all elements&lt;br /&gt;
  v.shift(n)           // Move all v[i] to v[i+n], shift in 0&lt;br /&gt;
  v.cshift(n)          // Move v[i] to v[(i+n) % v.size()]&lt;br /&gt;
  v.resize(n)          // Change size to n, but reset all elements to 0&lt;br /&gt;
  v.resize(n, x)       // Change size to n, set all elements to x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=complex&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;complex&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;complex&amp;lt;/tt&amp;gt; supports complex arithmetic.  It has real and&lt;br /&gt;
imaginary parts of type T.  Mixed type expressions promote real&lt;br /&gt;
to complex (e.g. double to complex&amp;amp;lt;double&amp;gt; and lower precision&lt;br /&gt;
to higher precision (e.g. complex&amp;amp;lt;int&amp;gt; to complex&amp;amp;lt;double&amp;gt;).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  complex&amp;amp;lt;T&amp;gt; x;        // (0,0), T is a numeric type&lt;br /&gt;
  complex&amp;amp;lt;T&amp;gt; x=r;      // (r,0), convert real r to complex&lt;br /&gt;
  complex&amp;amp;lt;T&amp;gt; x(r, i);  // (r,i)&lt;br /&gt;
  x=polar&amp;amp;lt;T&amp;gt;(rho, theta); // Polar notation: radius, angle in radians&lt;br /&gt;
  x.real()             // r&lt;br /&gt;
  x.imag()             // i&lt;br /&gt;
  abs(x)               // rho = sqrt(r*r+i*i)&lt;br /&gt;
  arg(x)               // tan(theta) = i/r&lt;br /&gt;
  norm(x)              // abs(x)*abs(x)&lt;br /&gt;
  conj(x)              // (r,-i)&lt;br /&gt;
  x+y                  // Also - * / == != = += -= *= /= and unary + -&lt;br /&gt;
  sin(x)               // Also sinh, sqrt, tan, tanh, cos, cosh, exp, log, log10, pow(x,y)&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; x            // Prints in format &amp;quot;(r,i)&amp;quot;&lt;br /&gt;
  cin &amp;gt;&amp;gt; x             // Expects &amp;quot;r&amp;quot;, &amp;quot;(r)&amp;quot;, or &amp;quot;(r,i)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=stdexcept&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;stdexcept&amp;gt;, &amp;amp;lt;exception&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The standard library provides a hierarchy of exception types.  Not all&lt;br /&gt;
of them are used by the library, but any may be thrown.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;b&amp;gt;Type                   Header                   Thrown by&amp;lt;/b&amp;gt;&lt;br /&gt;
  exception              stdexcept, exception&lt;br /&gt;
    logic_error          stdexcept&lt;br /&gt;
      length_error       stdexcept&lt;br /&gt;
      domain_error       stdexcept&lt;br /&gt;
      out_of_range       stdexcept                .at(i) (vector/string/deque index out of bounds)&lt;br /&gt;
      invalid_argument   stdexcept, bitset        bitset(&amp;quot;xxx&amp;quot;) (not '0' or '1')&lt;br /&gt;
    runtime_error        stdexcept&lt;br /&gt;
      range_error        stdexcept    &lt;br /&gt;
      overflow_error     stdexcept&lt;br /&gt;
      underflow_error    stdexcept&lt;br /&gt;
    bad_alloc            new                      new, new[] (out of memory)&lt;br /&gt;
    bad_cast             typeinfo                 dynamic_cast&amp;amp;lt;T&amp;amp;&amp;gt; (can't convert to derived)&lt;br /&gt;
    bad_typeid           typeinfo                 typeid(*p) when p==0&lt;br /&gt;
    bad_exception        exception&lt;br /&gt;
    ios_base::failure    ios, iostream, fstream   istream::clear(), ostream::clear()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Catching a base class catches all derived classes, thus &amp;lt;tt&amp;gt;catch(exception&lt;br /&gt;
e)&amp;lt;/tt&amp;gt; catches all of the above types.  However, C++ allows throwing&lt;br /&gt;
exceptions not derived from &amp;lt;tt&amp;gt;exception&amp;lt;/tt&amp;gt;, so this may not catch&lt;br /&gt;
everything.  All exceptions provide the following interface:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  throw exception(msg)   // Throw exception with char* or string msg&lt;br /&gt;
  throw exception();     // Default msg&lt;br /&gt;
  catch(exception e) {e.what();}  // msg as a char*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;New exceptions may be derived from existing types to maintain this&lt;br /&gt;
interface (see &amp;lt;a href=#inheritance&amp;gt;inheritance&amp;lt;/a&amp;gt;).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class MyError: public exception {&lt;br /&gt;
  public:&lt;br /&gt;
    MyError(const string&amp;amp; msg=&amp;quot;&amp;quot;): exception(msg) {}&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cpplibrary&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;C++ Standard Library Functions&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Many C++ standard library functions operate on sequences denoted by&lt;br /&gt;
iterators or pointers.  &amp;lt;b&amp;gt;Iterators&amp;lt;/b&amp;gt; are a family of types that&lt;br /&gt;
include pointers.  They are classified by the operators they support.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;input:&amp;lt;/b&amp;gt; &amp;lt;tt&amp;gt;++p, p++, p=q, p==q, p!=q, *p&amp;lt;/tt&amp;gt; (read-only)&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;output:&amp;lt;/b&amp;gt; &amp;lt;tt&amp;gt;p=q, p==q, p!=q, *p++ = x&amp;lt;/tt&amp;gt; (alternating write/increment)&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;forward:&amp;lt;/b&amp;gt; input and output and &amp;lt;tt&amp;gt;p-&amp;gt;m, *p&amp;lt;/tt&amp;gt; (multiple read-write)&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;bidirectional:&amp;lt;/b&amp;gt; forward and &amp;lt;tt&amp;gt;--p, p--&amp;lt;/tt&amp;gt;, implemented by&lt;br /&gt;
list, map, multimap, set, multiset.&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;b&amp;gt;random:&amp;lt;/b&amp;gt; bidirectional and &amp;lt;tt&amp;gt;p&amp;amp;lt;q, p&amp;gt;q, p&amp;amp;lt;=q, p&amp;gt;=q, p+i, i+p, p-i, p-q, p[i]&amp;lt;/tt&amp;gt;,&lt;br /&gt;
implemented by arrays (as pointers), string, vector, deque.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Some algorithms require certain iterator types, but will accept more&lt;br /&gt;
powerful types.  For example, &amp;lt;tt&amp;gt;copy(b, e, d)&amp;lt;/tt&amp;gt; require b and e&lt;br /&gt;
to be at least input iterators and d to be at least an output iterator.  But&lt;br /&gt;
it will accept forward, bidirectional, or random iterators because these&lt;br /&gt;
all support input and output operations.  &amp;lt;tt&amp;gt;sort()&amp;lt;/tt&amp;gt; requires random&lt;br /&gt;
iterators and will accept no other type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The notation [b,e) denotes&lt;br /&gt;
the sequence of e-b objects from b[0] to e[-1], i.e. b points to the&lt;br /&gt;
beginning of the sequence and e points one past the end.  For most&lt;br /&gt;
containers, v, the sequence is [v.begin(), v.end()).  For an array of&lt;br /&gt;
n elements, the sequence is [a, a+n).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=algorithm&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;algorithm&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In the following, b and e are input iterators, and d is an output iterator,&lt;br /&gt;
unless otherwise specified.  Parameters eq and lt are optional,&lt;br /&gt;
and default to functions that take 2 arguments x and y and return x==y&lt;br /&gt;
and x&amp;amp;lt;y respectively, e.g. &amp;lt;tt&amp;gt;bool eq(x,y) {return x==y;}&amp;lt;/tt&amp;gt;.&lt;br /&gt;
x and y are objects of the type pointed to by the iterators.&lt;br /&gt;
p is a pair of iterators.  f is a function or function object as noted.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Operations on ordinary objects&lt;br /&gt;
  swap(x1, x2);              // Swap values of 2 objects of the same type&lt;br /&gt;
  min(x1, x2);               // Smaller of x1 or x2, must be same type&lt;br /&gt;
  max(x1, x2);               // Larger of x1 or x2, must be same type&lt;br /&gt;
&lt;br /&gt;
  // Properties of sequences (input iterators)&lt;br /&gt;
  equal(b, e, b2, eq);       // true if [b,e)==[b2,...)&lt;br /&gt;
  lexicographical_compare(b, e, b2, e2, lt);  // true if [b,e)&amp;amp;lt;[b2,e2)&lt;br /&gt;
  i=min_element(b, e);       // Points to smallest in [b,e)&lt;br /&gt;
  i=max_element(b, e);       // Points to largest&lt;br /&gt;
  n=count(b, e, x);          // Number of occurrences of x in [b,e)&lt;br /&gt;
  n=count_if(b, e, f);       // Number of f(x) true in [b,e)&lt;br /&gt;
&lt;br /&gt;
  // Searching, i points to found item or end (e) if not found&lt;br /&gt;
  i=find(b, e, x);           // Find first x in [b,e)&lt;br /&gt;
  i=find_if(b, e, f);        // Find first x where f(x) is true&lt;br /&gt;
  i=search(b, e, b2, e2, eq);// Find first [b2,e2) in [b,e) (forward)&lt;br /&gt;
  i=find_end(b, e, b2, e2, eq); // Find last [b2,e2) in [b,e) (forward)&lt;br /&gt;
  i=search_n(b, e, n, x, eq);// Find n copies of x in [b,e) (forward)&lt;br /&gt;
  p=mismatch(b, e, b2, eq);  // Find first *p.first in [b,e) != *p.second in [b2,.) (forward)&lt;br /&gt;
  i=adjacent_find(b, e, eq); // Find first of 2 equal elements (forward)&lt;br /&gt;
&lt;br /&gt;
  // Modifying elements&lt;br /&gt;
  i=copy(b, e, d);           // Copy [b,e) to [d,i)&lt;br /&gt;
  fill(d, i, x);             // Set all in [d,i) to x (forward)&lt;br /&gt;
  i=fill_n(d, n, x);         // Set n elements in [d,i) to x&lt;br /&gt;
  generate(d, i, f);         // Set [d,i) to f() (e.g. rand) (forward)&lt;br /&gt;
  i=generate_n(d, n, f);     // Set n elements in [d,i) to f()&lt;br /&gt;
  f=for_each(b, e, f);       // Call f(x) for each x in [b,e)&lt;br /&gt;
  i=transform(b, e, d, f);   // For x in [b,e), put f(x) in [d,i)&lt;br /&gt;
  i=transform(b, e, b2, d, f);  // For x in [b,e), y in [b2,.), put f(x,y) in [d,i)&lt;br /&gt;
  replace(b, e, x, y)        // Replace x with y in [b,e)&lt;br /&gt;
  replace_if(b, e, f, y);    // Replace with y in [b,e) where f(x) is true&lt;br /&gt;
  i=replace_copy(b, e, d, x, y);    // Copy [b,e) to [d,i) replacing x with y&lt;br /&gt;
  i=replace_copy_if(b, e, d, f, y); // Copy replacing with y where f(x) is true&lt;br /&gt;
&lt;br /&gt;
  // Rearranging sequence elements&lt;br /&gt;
  sort(b, e, lt);            // Sort [b,e) by &amp;amp;lt; (random)&lt;br /&gt;
  stable_sort(b, e, lt);     // Sort slower, maintaining order of equal elements (random)&lt;br /&gt;
  partial_sort(b, m, e, lt); // Sort faster but leave [m,e) unsorted (random)&lt;br /&gt;
  nth_element(b, m, e, lt);  // Sort fastest but only *m in proper place (random)&lt;br /&gt;
  iter_swap(b, e);           // swap(*b, *e) (forward)&lt;br /&gt;
  i=swap_ranges(b, e, b2);   // swap [b,e) with [b2,i) (forward)&lt;br /&gt;
  i=partition(b, e, f);      // Moves f(x) true to front, [i,e) is f(x) false (bidirectional)&lt;br /&gt;
  i=stable_partition(b, e, f);  // Maintains order within each partition&lt;br /&gt;
  i=remove(b, e, x);         // Move all x to end in [i,e) (forward)&lt;br /&gt;
  i=remove_if(b, e, f);      // Move f(x) true to front in [b,i) (forward)&lt;br /&gt;
  i=remove_copy(b, e, d, x); // Copy elements matching x to [d,i)&lt;br /&gt;
  i=remove_copy_if(b, e, d, f);  // Copy elements x if f(x) is false to [d,i)&lt;br /&gt;
  replace(b, e, x1, x2);     // Replace x1 with x2 in [b,e)&lt;br /&gt;
  i=replace_copy(b, e, d, x1, x2);  // Copy [b,e) to [d,i) replacing x1 with x2&lt;br /&gt;
  reverse(b, e);             // Reverse element order in [b,e) (bidirectional)&lt;br /&gt;
  i=reverse_copy(b, e, d);   // Copy [b,e) to [d,i) reversing the order (b,e bidirectional)&lt;br /&gt;
  rotate(b, m, e);           // Move [b,m) behind [m,e) (forward)&lt;br /&gt;
  i=rotate_copy(b, m, e, d); // Rotate into [d,i)&lt;br /&gt;
  random_shuffle(b, e, f);   // Random permutation, f() defaults to rand()&lt;br /&gt;
  next_permutation(b, e, lt);// Next greater sequence, true if successful (bidirectional)&lt;br /&gt;
  prev_permutation(b, e, lt);// Previous permutation, true if successful (bidirectional)&lt;br /&gt;
&lt;br /&gt;
  // Operations on sorted sequences&lt;br /&gt;
  i=unique(b, e, eq);            // Move unique list to [b,i), extras at end&lt;br /&gt;
  i=unique_copy(b, e, d, eq);    // Copy one of each in [b,d) to [d,i)&lt;br /&gt;
  i=binary_search(b, e, x, lt);  // Find i in [b,e) (forward)&lt;br /&gt;
  i=lower_bound(b, e, x, lt);    // Find first x in [b,e) or where to insert it (forward)&lt;br /&gt;
  i=upper_bound(b, e, x, lt);    // Find 1 past last x in [b,e) or where to insert it (forward)&lt;br /&gt;
  p=equal_range(b, e, x, lt);    // p.first = lower bound, p.second = upper bound (forward)&lt;br /&gt;
  includes(b, e, b2, e2, lt);    // true if [b,e) is a subset of [b2,e2)&lt;br /&gt;
  i=merge(b, e, b2, e2, d, lt);  // Merge [b,e) and [b2,e2) to [d,i)&lt;br /&gt;
  inplace_merge(b, m, e, lt);    // Merge [b,m) and [m,e) to [b,e) (bidirectional)&lt;br /&gt;
  i=set_union(b, e, b2, e2, d, lt);  // [d,i) = unique elements in either [b,e) or [b2,e2)&lt;br /&gt;
  i=set_intersection(b, e, b2, e2, d, lt);  // [d,i) = unique elements in both&lt;br /&gt;
  i=set_difference(b, e, b2, e2, d, lt);    // [d,i) = unique elements in [b,e) but not [b2,e2)&lt;br /&gt;
  i=set_symmetric_difference(b, e, b2, e2, d, lt);  // [d,i) = elements in one but not both&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Algorithms never change the size of a container.  When copying, the&lt;br /&gt;
destination must be large enough to hold the result.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int a[5]={3,1,4,1,6};&lt;br /&gt;
  vector&amp;lt;int&amp;gt; b(5);&lt;br /&gt;
  copy(a, a+5, v.begin());   // Copy a to v&lt;br /&gt;
  remove(a, a+5, 1);         // {3,4,6,1,1}, returns a+3&lt;br /&gt;
  sort(a, a+4);              // {1,3,4,6,1}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=numeric&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;numeric&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the following, &amp;lt;tt&amp;gt;plus, minus,&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;times&amp;lt;/tt&amp;gt; are&lt;br /&gt;
optional functions taking 2 arguments x and y that return x+y, x-y,&lt;br /&gt;
and x*y respectively, e.g. &amp;lt;tt&amp;gt;int plus(int x, int y) {return x+y;}&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  x=accumulate(b, e, x, plus);                // x + sum over [b,e)&lt;br /&gt;
  x=inner_product(b, e, b2, x, plus, times);  // x + sum [b,e)*[b2,e2)&lt;br /&gt;
  adjacent_difference(b, e, minus);           // for i in (b,e) *i -= i[-1]&lt;br /&gt;
  partial_sum(b, e, plus);                    // for i in [b,e) *i += sum [b,i)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=iterator&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;iterator&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An inserter is an output iterator that expands the container it&lt;br /&gt;
points to by calling push_back(), push_front(), or insert().  The container&lt;br /&gt;
must support this operation.  A stream iterator&lt;br /&gt;
can be used to do formatted input or output using &amp;gt;&amp;gt; or &amp;amp;lt;&amp;amp;lt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  back_inserter(c);             // An iterator that appends to container c&lt;br /&gt;
  front_inserter(c);            // Inserts at front of c&lt;br /&gt;
  inserter(c, p);               // Inserts in front of p&lt;br /&gt;
  ostream_iterator&amp;amp;lt;T&amp;gt;(out, cp); // Writes to ostream separated by char* cp (default &amp;quot; &amp;quot;)&lt;br /&gt;
  istream_iterator&amp;amp;lt;T&amp;gt;(in);      // An input iterator that reads T objects from istream&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The most common use is to copy to an empty vector, deque, or list.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  vector&amp;amp;lt;int&amp;gt; from(10), to;&lt;br /&gt;
  copy(from.begin(), from.end(), back_inserter(to));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This header also defines tag types to be used for creating&lt;br /&gt;
iterator types that work with algorithms.  See&lt;br /&gt;
&amp;lt;a href=#defining_iterators&amp;gt;defining iterators&amp;lt;/a&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=functional&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;functional&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions in &amp;amp;lt;functional&amp;gt; create &amp;lt;i&amp;gt;function objects&amp;lt;/i&amp;gt;, which&lt;br /&gt;
are objects that behave like functions by overloading &amp;lt;tt&amp;gt;operator()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
These can be passed to algorithms that take function arguments, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  vector&amp;amp;lt;int&amp;gt; v(10);&lt;br /&gt;
  sort(v.begin(), v.end(), greater&amp;amp;lt;int&amp;gt;());  // Sort v in reverse order&lt;br /&gt;
  int x=accumulate(v.begin(), v.end(), 1, multiplies&amp;amp;lt;T&amp;gt;);  // Product of elements  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following create function objects that take one or two parameters&lt;br /&gt;
x and y of type T and return the indicated expression, i.e.,&lt;br /&gt;
&amp;lt;tt&amp;gt;equal_to&amp;amp;lt;int&amp;gt;()(3,4)&amp;lt;/tt&amp;gt; returns false.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   // Predicates (return bool)&lt;br /&gt;
   equal_to&amp;amp;lt;T&amp;gt;()                 // x==y&lt;br /&gt;
   not_equal_to&amp;amp;lt;T&amp;gt;()             // x!=y&lt;br /&gt;
   greater&amp;amp;lt;T&amp;gt;()                  // x&amp;gt;y&lt;br /&gt;
   less&amp;amp;lt;T&amp;gt;()                     // x&amp;amp;lt;y&lt;br /&gt;
   greater_equal&amp;amp;lt;T&amp;gt;()            // x&amp;gt;=y&lt;br /&gt;
   less_equal&amp;amp;lt;T&amp;gt;()               // x&amp;amp;lt;=y&lt;br /&gt;
   logical_and&amp;amp;lt;bool&amp;gt;()           // x&amp;amp;&amp;amp;y&lt;br /&gt;
   logical_or&amp;amp;lt;bool&amp;gt;()            // x||y&lt;br /&gt;
   logical_not&amp;amp;lt;bool&amp;gt;()           // !x (unary)&lt;br /&gt;
&lt;br /&gt;
   // Arithmetic operations (return T)&lt;br /&gt;
   plus&amp;amp;lt;T&amp;gt;()                     // x+y&lt;br /&gt;
   minus&amp;amp;lt;T&amp;gt;()                    // x-y&lt;br /&gt;
   multiplies&amp;amp;lt;T&amp;gt;()               // x*y&lt;br /&gt;
   divides&amp;amp;lt;T&amp;gt;()                  // x/y&lt;br /&gt;
   modulus&amp;amp;lt;T&amp;gt;()                  // x%y&lt;br /&gt;
   negate&amp;amp;lt;T&amp;gt;()                   // -x (unary)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A &amp;lt;i&amp;gt;binder&amp;lt;/i&amp;gt; converts a 2-argument function object into a 1-argument&lt;br /&gt;
object by binding a fixed value &amp;lt;tt&amp;gt;c&amp;lt;/tt&amp;gt; to the other argument, e.g.&lt;br /&gt;
&amp;lt;tt&amp;gt;bind2nd(less&amp;amp;lt;int&amp;gt;(), 10) returns a function object that takes one&lt;br /&gt;
argument x and returns true if x&amp;amp;lt;10.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  bind1st(f, c)                  // An object computing f(c,y)&lt;br /&gt;
  bind2nd(f, c)                  // An object computing f(x,c)&lt;br /&gt;
&lt;br /&gt;
  i=find_if(v.begin(), v.end(), bind2nd(equal_to&amp;amp;lt;int&amp;gt;(), 0));  // Find first 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following convert ordinary functions and member functions into&lt;br /&gt;
function objects.  All functions must be converted to be passed to&lt;br /&gt;
bind1st and bind2nd.  Member functions must also be converted to be&lt;br /&gt;
passed to algorithms.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ptr_fun(f)                     // Convert ordinary function f to object&lt;br /&gt;
  mem_fun(&amp;amp;T::f)                 // Convert member function of class T&lt;br /&gt;
  mem_fun_ref(T::f)              // Same&lt;br /&gt;
&lt;br /&gt;
  i=find_if(v.begin(), v.end(), mem_fun(&amp;amp;string::empty));  // Find &amp;quot;&amp;quot;&lt;br /&gt;
  transform(v.begin(), v.end(), v.begin(), bind2nd(ptr_fun(pow), 2.0));  // Square elements&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;not1()&amp;lt;/tt&amp;gt; and not2()&amp;lt;/tt&amp;gt; negate a unary or binary function object.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  not1(f)                        // Object computing !f(x)&lt;br /&gt;
  not2(f)                        // Object computing !f(x,y)&lt;br /&gt;
&lt;br /&gt;
  i=find_if(v.begin(), v.end(), not1(bind2nd(equal_to&amp;amp;lt;int&amp;gt;(), 0)));  // Find nonzero&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=new&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;new&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The default behavior of &amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt; is to throw an exception of&lt;br /&gt;
type &amp;lt;tt&amp;gt;bad_alloc&amp;lt;/tt&amp;gt; if&lt;br /&gt;
out of memory.  This can be changed by writing a function (taking&lt;br /&gt;
no parameters and returning void) and passing it to&lt;br /&gt;
&amp;lt;tt&amp;gt;set_new_handler()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  void handler() {throw bad_alloc();} // The default&lt;br /&gt;
  set_new_handler(handler);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;new(nothrow)&amp;lt;/tt&amp;gt; may be used in place of &amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt;.  If&lt;br /&gt;
out of memory, it returns 0 rather than throw bad_alloc.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  int* p = new(nothrow) int[1000000000];  // p may be 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=clibrary&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;C Library Functions&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The C library is provided for backwards compatibility with the C language.&lt;br /&gt;
Because C lacked namespaces, all types and functions were defined globally.&lt;br /&gt;
For each C header, C++ provides an additional header by prefixing &amp;quot;c&amp;quot;&lt;br /&gt;
and dropping the &amp;quot;.h&amp;quot; suffix, which places everything in namespace &amp;lt;tt&amp;gt;std&amp;lt;/tt&amp;gt;.&lt;br /&gt;
For instance, &amp;lt;tt&amp;gt;&amp;amp;lt;stdio.h&amp;gt;&amp;lt;/tt&amp;gt; becomes &amp;lt;tt&amp;gt;&amp;amp;lt;cstdio&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cstdlib&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cstdlib&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Miscellaneous functions.  s is type char*, n is int&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  atoi(s); atol(s); atof(s);// Convert char* s to int, long, double e.g. atof(&amp;quot;3.5&amp;quot;)&lt;br /&gt;
  abs(x); labs(x);          // Absolute value of numeric x as int, long&lt;br /&gt;
  rand();                   // Pseudo-random int from 0 to RAND_MAX (at least 32767)&lt;br /&gt;
  srand(n);                 // Initialize rand(), e.g. srand(time(0));&lt;br /&gt;
  system(s);                // Execute OS command s, e.g. system(&amp;quot;ls&amp;quot;);&lt;br /&gt;
  getenv(s);                // Environment variable or 0 as char*, e.g. getenv(&amp;quot;PATH&amp;quot;); &lt;br /&gt;
  exit(n);                  // Kill program, return status n, e.g. exit(0);&lt;br /&gt;
  void* p = malloc(n);      // Allocate n bytes or 0 if out of memory.  Obsolete, use new.&lt;br /&gt;
  p = calloc(n, 1);         // Allocate and set to 0 or return NULL.  Obsolete.&lt;br /&gt;
  p = realloc(p, n);        // Enlarge to n bytes or return NULL.  Obsolete.&lt;br /&gt;
  free(p);                  // Free memory.  Obsolete: use delete&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cctype&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cctype&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Character tests take a char c and return bool.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  isalnum(c);               // Is c a letter or digit?&lt;br /&gt;
  isalpha(c); isdigit(c);   // Is c a letter?  Digit?&lt;br /&gt;
  islower(c); isupper(c);   // Is c lower case?  Upper case?&lt;br /&gt;
  isgraph(c); isprint(c);   // Printing character except/including space?&lt;br /&gt;
  isspace(c); iscntrl(c);   // Is whitespace?  Is a control character?&lt;br /&gt;
  ispunct(c);               // Is printing except space, letter, or digit?&lt;br /&gt;
  isxdigit(c);              // Is hexadecimal digit?&lt;br /&gt;
  c=tolower(c); c=toupper(c);   // Convert c to lower/upper case&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cmath&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cmath&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions take double and return double.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  sin(x); cos(x); tan(x);   // Trig functions, x in radians&lt;br /&gt;
  asin(x); acos(x); atan(x);// Inverses&lt;br /&gt;
  atan2(y, x);              // atan(y/x)&lt;br /&gt;
  sinh(x); cosh(x); tanh(x);// Hyperbolic&lt;br /&gt;
  exp(x); log(x); log10(x); // e to the x, log base e, log base 10&lt;br /&gt;
  pow(x, y); sqrt(x);       // x to the y, square root&lt;br /&gt;
  ceil(x); floor(x);        // Round up or down (as a double)&lt;br /&gt;
  fabs(x); fmod(x, y);      // Absolute value, x mod y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=ctime&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;ctime&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions for reading the system clock.  &amp;lt;tt&amp;gt;time_t&amp;lt;/tt&amp;gt; is&lt;br /&gt;
an integer type (usually long).  &amp;lt;tt&amp;gt;tm&amp;lt;/tt&amp;gt; is a struct.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  clock()/CLOCKS_PER_SEC;   // Time in seconds since program started&lt;br /&gt;
  time_t t=time(0);         // Absolute time in seconds or -1 if unknown&lt;br /&gt;
  tm* p=gmtime(&amp;amp;t);         // 0 if UCT unavailable, else p-&amp;gt;tm_X where X is:&lt;br /&gt;
    sec, min, hour, mday, mon (0-11), year (-1900), wday, yday, isdst&lt;br /&gt;
  asctime(p);               // &amp;quot;Day Mon dd hh:mm:ss yyyy\n&amp;quot;&lt;br /&gt;
  asctime(localtime(&amp;amp;t));   // Same format, local time&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cstring&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cstring&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Functions for performing string-like operations on arrays of char&lt;br /&gt;
marked with a terminating '\0' (such as &amp;lt;tt&amp;gt;&amp;quot;quoted literals&amp;quot;&amp;lt;/tt&amp;gt;&lt;br /&gt;
or as returned by &amp;lt;tt&amp;gt;string::c_str()&amp;lt;/tt&amp;gt;.  Mostly obsoleted by&lt;br /&gt;
type &amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  strcpy(dst, src);         // Copy src to dst. Not bounds checked&lt;br /&gt;
  strcat(dst, src);         // Concatenate to dst. Not bounds checked&lt;br /&gt;
  strcmp(s1, s2);           // Compare, &amp;amp;lt;0 if s1&amp;amp;lt;s2, 0 if s1==s2, &amp;amp;gt;0 if s1&amp;amp;gt;s2&lt;br /&gt;
  strncpy(dst, src, n);     // Copy up to n chars, also strncat(), strncmp()&lt;br /&gt;
  strlen(s);                // Length of s not counting \0&lt;br /&gt;
  strchr(s,c); strrchr(s,c);// Address of first/last char c in s or 0&lt;br /&gt;
  strstr(s, sub);           // Address of first substring in s or 0&lt;br /&gt;
    // mem... functions are for any pointer types (void*), length n bytes&lt;br /&gt;
  memcpy(dst, src, n);      // Copy n bytes from src to dst&lt;br /&gt;
  memmove(dst, src, n);     // Same, but works correctly if dst overlaps src&lt;br /&gt;
  memcmp(s1, s2, n);        // Compare n bytes as in strcmp&lt;br /&gt;
  memchr(s, c, n);          // Find first byte c in s, return address or 0&lt;br /&gt;
  memset(s, c, n);          // Set n bytes of s to c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cstdio&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cstdio&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The &amp;lt;tt&amp;gt;stdio&amp;lt;/tt&amp;gt; library is made mostly obsolete by the newer&lt;br /&gt;
&amp;lt;tt&amp;gt;iostream&amp;lt;/tt&amp;gt;&lt;br /&gt;
library, but many programs still use it.  There are facilities for&lt;br /&gt;
random access files and greater control over output format,&lt;br /&gt;
error handling, and temporary files.  Mixing both I/O libraries is&lt;br /&gt;
not recommended.  There are no facilities for string I/O.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Global objects &amp;lt;tt&amp;gt;stdin, stdout, stderr&amp;lt;/tt&amp;gt; of type &amp;lt;tt&amp;gt;FILE*&amp;lt;/tt&amp;gt;&lt;br /&gt;
correspond to &amp;lt;tt&amp;gt;cin, cout, cerr&amp;lt;/tt&amp;gt;.  s is type char*, c is char,&lt;br /&gt;
n is int, f is FILE*.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  FILE* f=fopen(&amp;quot;filename&amp;quot;, &amp;quot;r&amp;quot;);  // Open for reading, NULL (0) if error&lt;br /&gt;
    // Mode may also be &amp;quot;w&amp;quot; (write) &amp;quot;a&amp;quot; append, &amp;quot;a+&amp;quot; random access read/append,&lt;br /&gt;
    // &amp;quot;rb&amp;quot;, &amp;quot;wb&amp;quot;, &amp;quot;ab&amp;quot;, &amp;quot;a+b&amp;quot; are binary&lt;br /&gt;
  fclose(f);                // Close file f&lt;br /&gt;
  fprintf(f, &amp;quot;x=%d&amp;quot;, 3);    // Print &amp;quot;x=3&amp;quot;  Other conversions:&lt;br /&gt;
    &amp;quot;%5d %u %-8ld&amp;quot;            // int width 5, unsigned int, long left justified&lt;br /&gt;
    &amp;quot;%o %x %X %lx&amp;quot;            // octal, hex, HEX, long hex&lt;br /&gt;
    &amp;quot;%f %5.1f&amp;quot;                // double: 123.000000, 123.0&lt;br /&gt;
    &amp;quot;%e %g&amp;quot;                   // 1.23e2, use either f or g&lt;br /&gt;
    &amp;quot;%c %s&amp;quot;                   // char, char*&lt;br /&gt;
    &amp;quot;%%&amp;quot;                      // %&lt;br /&gt;
  sprintf(s, &amp;quot;x=%d&amp;quot;, 3);    // Print to array of char s&lt;br /&gt;
  printf(&amp;quot;x=%d&amp;quot;, 3);        // Print to stdout (screen unless redirected)&lt;br /&gt;
  fprintf(stderr, ...       // Print to standard error (not redirected)&lt;br /&gt;
  getc(f);                  // Read one char (as an int, 0-255) or EOF (-1) from f&lt;br /&gt;
  ungetc(c, f);             // Put back one c to f&lt;br /&gt;
  getchar();                // getc(stdin);&lt;br /&gt;
  putc(c, f)                // fprintf(f, &amp;quot;%c&amp;quot;, c);&lt;br /&gt;
  putchar(c);               // putc(c, stdout);&lt;br /&gt;
  fgets(s, n, f);           // Read line including '\n' into char s[n] from f.  NULL if EOF&lt;br /&gt;
  gets(s)                   // fgets(s, INT_MAX, f); no '\n' or bounds check&lt;br /&gt;
  fread(s, n, 1, f);        // Read n bytes from f to s, return number read&lt;br /&gt;
  fwrite(s, n, 1, f);       // Write n bytes of s to f, return number written&lt;br /&gt;
  fflush(f);                // Force buffered writes to f&lt;br /&gt;
  fseek(f, n, SEEK_SET);    // Position binary file f at n&lt;br /&gt;
    // or SEEK_CUR from current position, or SEEK_END from end&lt;br /&gt;
  ftell(f);                 // Position in f, -1L if error&lt;br /&gt;
  rewind(f);                // fseek(f, 0L, SEEK_SET); clearerr(f);&lt;br /&gt;
  feof(f);                  // Is f at end of file?&lt;br /&gt;
  ferror(f);                // Error in f?&lt;br /&gt;
  perror(s);                // Print char* s and last I/O error message to stderr&lt;br /&gt;
  clearerr(f);              // Clear error code for f&lt;br /&gt;
  remove(&amp;quot;filename&amp;quot;);       // Delete file, return 0 if OK&lt;br /&gt;
  rename(&amp;quot;old&amp;quot;, &amp;quot;new&amp;quot;);     // Rename file, return 0 if OK&lt;br /&gt;
  f = tmpfile();            // Create temporary file in mode &amp;quot;wb+&amp;quot;&lt;br /&gt;
  tmpnam(s);                // Put a unique file name in char s[L_tmpnam]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Example: input file name and print its size&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  char filename[100];              // Cannot be a string&lt;br /&gt;
  printf(&amp;quot;Enter filename\n&amp;quot;);      // Prompt&lt;br /&gt;
  gets(filename, 100, stdin);      // Read line ending in &amp;quot;\n\0&amp;quot;&lt;br /&gt;
  filename[strlen(filename)-1]=0;  // Chop off '\n';&lt;br /&gt;
  FILE* f=fopen(filename, &amp;quot;rb&amp;quot;);   // Open for reading in binary mode&lt;br /&gt;
  if (f) {                         // Open OK?&lt;br /&gt;
    fseek(f, 0, SEEK_END);         // Position at end&lt;br /&gt;
    long n=ftell(f);               // Get position&lt;br /&gt;
    printf(&amp;quot;%s has %ld bytes\n&amp;quot;, filename, n);&lt;br /&gt;
    fclose(f);                     // Or would close when program ends&lt;br /&gt;
  }&lt;br /&gt;
  else&lt;br /&gt;
    perror(filename);              // fprintf(stderr, &amp;quot;%s: not found\n&amp;quot;, filename);&lt;br /&gt;
                                   // or permission denied, etc.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;printf(), fprintf()&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;sprintf()&amp;lt;/tt&amp;gt; accept a variable&lt;br /&gt;
number of arguments, one for each &amp;quot;%&amp;quot; in the format string, which must&lt;br /&gt;
be the appropriate type.  The compiler does not check for this.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  printf(&amp;quot;%d %f %s&amp;quot;, 2, 2.0, &amp;quot;2&amp;quot;);  // OK&lt;br /&gt;
  printf(&amp;quot;%s&amp;quot;, 5);  // Crash: expected a char* arg, read from address 5&lt;br /&gt;
  printf(&amp;quot;%s&amp;quot;);     // Crash&lt;br /&gt;
  printf(&amp;quot;%s&amp;quot;, string(&amp;quot;hi&amp;quot;));  // Crash: use &amp;quot;hi&amp;quot; or string(&amp;quot;hi&amp;quot;).c_str()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=cassert&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;amp;lt;cassert&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Provides a debugging function for testing conditions where&lt;br /&gt;
all instances can be turned on or off at once.  &amp;lt;tt&amp;gt;assert(false);&amp;lt;/tt&amp;gt;&lt;br /&gt;
prints the asserted expression, source code file name, and line number,&lt;br /&gt;
then aborts.&lt;br /&gt;
Compiling with &amp;lt;b&amp;gt;&amp;lt;tt&amp;gt;g++ -DNDEBUG&amp;lt;/tt&amp;gt;&amp;lt;/b&amp;gt; effectively removes&lt;br /&gt;
these statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  assert(e);                // If e is false, print message and abort&lt;br /&gt;
  #define NDEBUG            // (before #include &amp;amp;lt;assert.h&amp;gt;), turn off assert&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=classes&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Classes&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Classes provide data abstraction, the ability to create new types and hide&lt;br /&gt;
their implementation in order to improve maintainability.&lt;br /&gt;
A &amp;lt;tt&amp;gt;class&amp;lt;/tt&amp;gt; is a data structure and an associated set of&lt;br /&gt;
&amp;lt;i&amp;gt;member functions&amp;lt;/i&amp;gt; (methods) and related type declarations&lt;br /&gt;
which can be associated with the class or instances (objects) of the&lt;br /&gt;
class.  A class is divided into a &amp;lt;tt&amp;gt;public&amp;lt;/tt&amp;gt; interface, visible&lt;br /&gt;
wherever the class or its instances are visible, and a &amp;lt;tt&amp;gt;private&amp;lt;/tt&amp;gt;&lt;br /&gt;
implementation visible only to member functions of the class.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class T {          // Create a new type T&lt;br /&gt;
  private:           // Members are visible only to member functions of T (default)&lt;br /&gt;
  public:            // Members are visible wherever T is visible&lt;br /&gt;
    // Type, object, and function declarations&lt;br /&gt;
  };&lt;br /&gt;
  T::m;              // Member m of type T&lt;br /&gt;
  T x;               // Create object x of type T&lt;br /&gt;
  x.m;               // Member m of object x&lt;br /&gt;
  T* p=&amp;amp;x; p-&amp;gt;m;     // Member m of object pointed to by p&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Typically the data structure is private, and functionality is provided&lt;br /&gt;
by member functions.  Member function definitions should be separated from&lt;br /&gt;
the declaration and written outside the class definition, or else they&lt;br /&gt;
are assumed to be inline (which is appropriate for short functions).&lt;br /&gt;
A member function should be declared const (before the opening brace)&lt;br /&gt;
if it does not modify any data members.  Only const member functions may&lt;br /&gt;
be called on const objects.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {    // Represents imaginary numbers&lt;br /&gt;
  private:&lt;br /&gt;
    double re, im;   // Data members, represents re + im * sqrt(-1)&lt;br /&gt;
  public:&lt;br /&gt;
    void set(double r, double i) {re=r; im=i;}  // Inlined member function definition&lt;br /&gt;
    double real() const {return re;}            // const - does not modify data members&lt;br /&gt;
    double imag() const;                        // Declaration for non-inlined function&lt;br /&gt;
  };&lt;br /&gt;
  double Complex::imag() const {return im;}     // Definition for imag()&lt;br /&gt;
  int main() {&lt;br /&gt;
    Complex a, b=a;                // Objects of type Complex&lt;br /&gt;
    a.set(3, 4);                   // Call a member function&lt;br /&gt;
    b=a;                           // Assign b.re=a.re; b.im=a.im&lt;br /&gt;
    b==a;                          // Error, == is not defined&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; a.re;                  // Error, re is private&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; a.real();              // OK, 3&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; Complex().real();      // OK, prints an undefined value&lt;br /&gt;
    Complex().set(5, 6);           // Error, non-const member called on const object&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A class has two special member functions, a &amp;lt;i&amp;gt;constructor&amp;lt;/i&amp;gt;, which is called&lt;br /&gt;
when the object is created, and a &amp;lt;i&amp;gt;destructor&amp;lt;/i&amp;gt;, called when destroyed.&lt;br /&gt;
The constructor is named &amp;lt;tt&amp;gt;&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;::&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt;, has no return&lt;br /&gt;
type or value, may be overloaded and have default arguments, and is&lt;br /&gt;
never const.  It is followed by an optional initialization list&lt;br /&gt;
listing each data member and its initial value.  Initialization&lt;br /&gt;
takes place before the constructor code is executed.  Initialization&lt;br /&gt;
might not be in the order listed.  Members not listed&lt;br /&gt;
are default-initialized by calling their constructors with default&lt;br /&gt;
arguments.  If no constructor is written, the compiler provides one which&lt;br /&gt;
default-initializes all members.  The syntax is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;::&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;(&amp;lt;i&amp;gt;parameter list&amp;lt;/i&amp;gt;): &amp;lt;i&amp;gt;member&amp;lt;/i&amp;gt;(&amp;lt;i&amp;gt;value&amp;lt;/i&amp;gt;), &amp;lt;i&amp;gt;member&amp;lt;/i&amp;gt;(&amp;lt;i&amp;gt;value&amp;lt;/i&amp;gt;) { &amp;lt;i&amp;gt;code...&amp;lt;/i&amp;gt;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The destructor is named &amp;lt;tt&amp;gt;&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;::~&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt;, has no&lt;br /&gt;
return type or value, no parameters, and is never const.  It is usually&lt;br /&gt;
not needed except to return shared resources by closing files or&lt;br /&gt;
deleting memory.  After the code executes, the data members are&lt;br /&gt;
destroyed using their respective destructors in the reverse order&lt;br /&gt;
in which they were constructed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
  public:&lt;br /&gt;
    Complex(double r=0, double i=0): re(r), im(i) {}  // Constructor&lt;br /&gt;
    ~Complex() {}                                     // Destructor&lt;br /&gt;
    // Other members...&lt;br /&gt;
  };&lt;br /&gt;
  Complex a(1,2), b(3), c=4, d;  // (1,2) (3,0) (4,0) (0,0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A constructor defines a conversion function for creating temporary&lt;br /&gt;
objects.  A constructor that allows 1 argument allows implicit conversion&lt;br /&gt;
wherever needed, such as in expressions, parameter passing, assignment,&lt;br /&gt;
and initialization.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Complex(3, 4).real();  // 3&lt;br /&gt;
  a = 5;                 // Implicit a = Complex(5) or a = Complex(5, 0)&lt;br /&gt;
&lt;br /&gt;
  void assign_if(bool, Complex&amp;amp;amp;, const Complex&amp;amp;amp;);&lt;br /&gt;
  assign_if(true, a, 6); // Implicit Complex(6) passed to third parameter&lt;br /&gt;
  assign_if(true, 6, a); // Error, non-const reference to Complex(6), which is const&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Operators may be overloaded as members.  The expression &amp;lt;tt&amp;gt;aXb&amp;lt;/tt&amp;gt; for&lt;br /&gt;
operator X can match either &amp;lt;tt&amp;gt;operator X(a, b)&amp;lt;/tt&amp;gt; (global)&lt;br /&gt;
or &amp;lt;tt&amp;gt;a.operator X(b)&amp;lt;/tt&amp;gt; (member function), but not both.&lt;br /&gt;
Unary operators omit b.&lt;br /&gt;
Operators =, [], and -&amp;gt; can only be overloaded as member functions.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
  public:&lt;br /&gt;
    Complex operator + (const Complex&amp;amp; b) const { // const because a+b doesn't change a&lt;br /&gt;
      return Complex(re+b.re, im+b.im);&lt;br /&gt;
    }&lt;br /&gt;
    // ...&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  Complex operator - (const Complex&amp;amp; a, const Complex&amp;amp; b) {&lt;br /&gt;
    return Complex(a.real()-b.real(), a.imag()-b.imag());&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  Complex a(1, 2), b(3, 4);&lt;br /&gt;
  a+b;                    // OK, a.operator+(b) == Complex(4, 6)&lt;br /&gt;
  a-b;                    // OK, operator-(a, b) == Complex(-2, -2)&lt;br /&gt;
  a+10;                   // OK, Complex(1, 12), implicit a+Complex(10, 0)&lt;br /&gt;
  10+a;                   // Error, 10 has no member operator+(Complex)&lt;br /&gt;
  a-10;                   // OK, Complex(1, -8)&lt;br /&gt;
  10-a;                   // OK, Complex(7, -4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;The member function (+) has the advantage of private access (including to&lt;br /&gt;
other objects of the same class), but can only do&lt;br /&gt;
implicit conversions on the right side.  The global function (-) is&lt;br /&gt;
symmetrical, but lacks private access.  A &amp;lt;tt&amp;gt;friend&amp;lt;/tt&amp;gt; declaration&lt;br /&gt;
(in either the private or public section) allows private access to&lt;br /&gt;
a global function.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
    friend Complex operator-(const Complex&amp;amp;, const Complex&amp;amp;);&lt;br /&gt;
    friend class T;       // All member functions of class T are friends&lt;br /&gt;
    // ...&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A conversion operator allows implicit conversion to another type.&lt;br /&gt;
It has the form of a member function named &amp;lt;tt&amp;gt;operator T() const&amp;lt;/tt&amp;gt; with&lt;br /&gt;
implied return type T.  It is generally a good idea to allow implicit&lt;br /&gt;
conversions in only one direction, preferably with constructors, so&lt;br /&gt;
this member function is usually used to convert to pre-existing types.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
  public:&lt;br /&gt;
    operator double() const {return re;}&lt;br /&gt;
    // ...&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  Complex a(1, 2);&lt;br /&gt;
  a-10;                  // Error, double(a)-10 or a-Complex(10) ?&lt;br /&gt;
  a-Complex(10);         // Complex(-9, 2);&lt;br /&gt;
  double(a)-10;          // -9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An &amp;lt;tt&amp;gt;explicit&amp;lt;/tt&amp;gt; constructor does not allow implicit conversions.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
    explicit Complex(double r=0, double i=0);&lt;br /&gt;
    // ...&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  Complex a=1;           // Error&lt;br /&gt;
  Complex a(1);          // OK&lt;br /&gt;
  a-10;                  // OK, double(a)-10 = -9&lt;br /&gt;
  a-Complex(10);         // OK, Complex(-9, 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=templateclass&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;A class or member function may be &amp;lt;b&amp;gt;templated&amp;lt;/b&amp;gt;.&lt;br /&gt;
The type parameter must be passed in&lt;br /&gt;
the declaration for objects of the class.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
    T re, im;&lt;br /&gt;
  public:&lt;br /&gt;
    T real() const {return re;}&lt;br /&gt;
    T imag() const {return im;}&lt;br /&gt;
    Complex(T r=0, T i=0);&lt;br /&gt;
    friend Complex&amp;amp;lt;T&amp;gt; operator - (const Complex&amp;amp;lt;T&amp;gt;&amp;amp;, const Complex&amp;amp;lt;T&amp;gt;&amp;amp;);&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt;&lt;br /&gt;
  Complex&amp;amp;lt;T&amp;gt;::Complex(T r, T i): re(r), im(i) {}&lt;br /&gt;
&lt;br /&gt;
  Complex&amp;amp;lt;int&amp;gt; a(1, 2);               // Complex of int&lt;br /&gt;
  Complex&amp;amp;lt;double&amp;gt; b(1.0, 2.0);        // Complex of double&lt;br /&gt;
  a=a-Complex&amp;amp;lt;int&amp;gt;(3, 4);             // Complex&amp;amp;lt;int&amp;gt;(-2, -2)&lt;br /&gt;
  Complex&amp;amp;lt;Complex&amp;amp;lt;double&amp;gt; &amp;gt; c(b, b);  // Note space, not &amp;gt;&amp;gt;&lt;br /&gt;
  c.real().imag();                    // 2.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Templates can have default arguments and int parameters.  The argument&lt;br /&gt;
to an int parameter must be a value known at compile time.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  template &amp;amp;lt;class T, class U=T, int n=0&amp;gt; class V {};&lt;br /&gt;
  V&amp;amp;lt;double, string, 3&amp;gt; v1;&lt;br /&gt;
  V&amp;amp;lt;char&amp;gt; v2;  // V&amp;amp;lt;char, char, 0&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Classes define default behavior for copying and assignment, which is&lt;br /&gt;
to copy/assign each data member.  This behavior can be overridden by&lt;br /&gt;
writing a &amp;lt;i&amp;gt;copy constructor&amp;lt;/i&amp;gt; and &amp;lt;tt&amp;gt;operator=&amp;lt;/tt&amp;gt; as members,&lt;br /&gt;
both taking arguments of the same type, passed by const reference.&lt;br /&gt;
They are usually required in classes that have destructors, such as the&lt;br /&gt;
&amp;lt;tt&amp;gt;vector&amp;amp;lt;T&amp;gt;&amp;lt;/tt&amp;gt;-like class below.  If we did not overload these,&lt;br /&gt;
the default behavior would be to copy the data pointer, resulting in&lt;br /&gt;
two Vectors pointing into the same array.  The assignment operator&lt;br /&gt;
normally returns itself (&amp;lt;tt&amp;gt;*this&amp;lt;/tt&amp;gt;) by reference to allow&lt;br /&gt;
expressions of the form &amp;lt;tt&amp;gt;a=b=c;&amp;lt;/tt&amp;gt;, but is not required to do so.&lt;br /&gt;
&amp;lt;tt&amp;gt;this&amp;lt;/tt&amp;gt; means the address of the current object; thus any member&lt;br /&gt;
&amp;lt;tt&amp;gt;m&amp;lt;/tt&amp;gt; may also be called &amp;lt;tt&amp;gt;this-&amp;gt;m&amp;lt;/tt&amp;gt; within a member function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt;&lt;br /&gt;
  class Vector {&lt;br /&gt;
  private:&lt;br /&gt;
    T* data;  // Array of n elements&lt;br /&gt;
    int n;    // size()&lt;br /&gt;
  public:&lt;br /&gt;
    typedef T* iterator;                      // Vector&amp;lt;T&amp;gt;::iterator means T*&lt;br /&gt;
    typedef const T* const_iterator;          // Iterators for const Vector&lt;br /&gt;
    int size() const {return n;}              // Number of elements&lt;br /&gt;
    T&amp;amp; operator[](int i) {return data[i];}    // i'th element&lt;br /&gt;
    const T&amp;amp; operator[](int i) const {return data[i];}  // i'th element of const Vector&lt;br /&gt;
    iterator begin() {return data;}           // First, last+1 elements&lt;br /&gt;
    iterator end() {return data+size();}&lt;br /&gt;
    const_iterator begin() const {return data;}  // Const versions&lt;br /&gt;
    const_iterator end() const {return data+size();}&lt;br /&gt;
    Vector(int i=0): data(new T[i]), n(i) {}  // Create with size i&lt;br /&gt;
    ~Vector() {delete[] data;}                // Return memory&lt;br /&gt;
    Vector(const Vector&amp;amp;lt;T&amp;gt;&amp;amp; v): data(new T[v.n]), n(v.n) {  // Copy constructor&lt;br /&gt;
      copy(v.begin(), v.end(), begin());&lt;br /&gt;
    }&lt;br /&gt;
    Vector&amp;amp; operator=(const Vector&amp;amp; v) {      // Assignment&lt;br /&gt;
      if (&amp;amp;amp;v != this) {                       // Assignment to self?&lt;br /&gt;
        delete[] data;                        // If not, resize and copy&lt;br /&gt;
        data=new T[n=v.n];&lt;br /&gt;
        copy(v.begin(), v.end(), begin());&lt;br /&gt;
      }&lt;br /&gt;
      return *this;                           // Allow a=b=c;&lt;br /&gt;
    }&lt;br /&gt;
    template &amp;amp;lt;class P&amp;gt; Vector(P b, P e): data(new T[e-b]), n(e-b) {  // Templated member&lt;br /&gt;
      copy(b, e, data);                       // Initialize from sequence [b, e)&lt;br /&gt;
    }&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A type defined in a class is accessed through&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;::&amp;lt;/i&amp;gt;type&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Vector&amp;amp;lt;int&amp;gt;::iterator p;        // Type is int*&lt;br /&gt;
  Vector&amp;amp;lt;int&amp;gt;::const_iterator cp; // Type is const int*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Member functions may be overloaded on &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Overloaded member functions need&lt;br /&gt;
not have the same return types.  &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt; member functions should not&lt;br /&gt;
return non-const references or pointers to data members.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Vector&amp;amp;lt;int&amp;gt; v(10);              // Uses non-const [], begin(), end()&lt;br /&gt;
  const Vector&amp;amp;lt;int&amp;gt; cv(10);       // Uses const [], begin(), end()&lt;br /&gt;
  cv=v;                           // Error, non-const operator= called on cv&lt;br /&gt;
  v[5]=cv[5];                     // OK. assigns to int&amp;amp;&lt;br /&gt;
  cv[5]=v[5];                     // Error, assigns to const int&amp;amp;&lt;br /&gt;
  p=cv.begin();                   // Error, would allow *p=x to write into cv&lt;br /&gt;
  cp=cv.begin();                  // OK because can't assign to *cp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=defining_iterators&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Defining Iterators&amp;lt;/b&amp;gt;.&lt;br /&gt;
Sometimes a container's iterator types must be defined as nested&lt;br /&gt;
classes overloading the usual pointer operations rather than typedef'ed&lt;br /&gt;
to pointers.&lt;br /&gt;
In order to work properly with functions defined in&lt;br /&gt;
&amp;lt;a href=#algorithm&amp;gt;&amp;amp;lt;algorithm&amp;gt;&amp;lt;/a&amp;gt;, iterators should define the following&lt;br /&gt;
5 public typedefs:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;iterator_category&amp;lt;/tt&amp;gt;: one of the following (defined in &amp;lt;tt&amp;gt;&amp;amp;lt;iterator&amp;gt;&amp;lt;/tt&amp;gt;):&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;output_iterator_tag&amp;lt;/tt&amp;gt;  (if sequential writing is supported)&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;input_iterator_tag&amp;lt;/tt&amp;gt;   (if sequential reading is supported)&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;forward_iterator_tag&amp;lt;/tt&amp;gt; (if both are supported)&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;bidirectional_iterator_tag&amp;lt;/tt&amp;gt;  (if the iterator can be decremented)&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;random_access_iterator_tag&amp;lt;/tt&amp;gt;  (if all pointer operations are supported)&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;value_type&amp;lt;/tt&amp;gt;: the type of the elements, for example, &amp;lt;tt&amp;gt;T&amp;lt;/tt&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;difference_type&amp;lt;/tt&amp;gt;: the result of iterator subtraction, usually &amp;lt;tt&amp;gt;ptrdiff_t&amp;lt;/tt&amp;gt; (a signed int type)&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;pointer&amp;lt;/tt&amp;gt;: the type returned by &amp;lt;tt&amp;gt;operator-&amp;gt;()&amp;lt;/tt&amp;gt;, usually &amp;lt;tt&amp;gt;T*&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;const T*&amp;lt;/tt&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;reference&amp;lt;/tt&amp;gt;: the type returned by &amp;lt;tt&amp;gt;operator*()&amp;lt;/tt&amp;gt;, usually &amp;lt;tt&amp;gt;T&amp;amp;&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;const T&amp;amp;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Operator -&amp;gt; should be overloaded as a unary function returning a&lt;br /&gt;
pointer to a class to which -&amp;gt; will be applied, i.e. &amp;lt;tt&amp;gt;x-&amp;gt;m&amp;lt;/tt&amp;gt; is&lt;br /&gt;
interpreted as &amp;lt;tt&amp;gt;x.operator-&amp;gt;()-&amp;gt;m&amp;lt;/tt&amp;gt;.  Nested class members&lt;br /&gt;
are named Outer::Inner::member.  Outer and inner classes cannot access&lt;br /&gt;
each other's private members.  Templated members defined outside the&lt;br /&gt;
class need their own template declarations.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt; class Vector {&lt;br /&gt;
  public:&lt;br /&gt;
&lt;br /&gt;
    // Reverse iterator for Vector, i.e. ++p goes to the previous element.&lt;br /&gt;
    class reverse_iterator {&lt;br /&gt;
    private:&lt;br /&gt;
      T* p;                                // Points to current element&lt;br /&gt;
    public:&lt;br /&gt;
&lt;br /&gt;
      // typedefs needed to work with &amp;amp;lt;algorithm&amp;gt; functions&lt;br /&gt;
      typedef std::random_access_iterator_tag iterator_category;  // Defined in &amp;amp;lt;iterator&amp;gt;&lt;br /&gt;
      typedef T value_type;                // Type of element&lt;br /&gt;
      typedef ptrdiff_t difference_type;   // Result of iterator subtraction, usually int&lt;br /&gt;
      typedef T* pointer;                  // Type returned by operator -&amp;gt;&lt;br /&gt;
      typedef T&amp;amp; reference;                // Type returned by operator *&lt;br /&gt;
&lt;br /&gt;
      reverse_iterator(T* a=0): p(a) {}    // Implicit conversion from T* and iterator&lt;br /&gt;
      iterator base() const {return p;}    // Convert to normal iterator&lt;br /&gt;
&lt;br /&gt;
      // Forward operators&lt;br /&gt;
      reverse_iterator&amp;amp; operator++() {--p; return *this;} // prefix&lt;br /&gt;
      reverse_iterator  operator++(int);                  // postfix, we pretend it's binary&lt;br /&gt;
      reference operator*() const {return *p;}&lt;br /&gt;
      pointer operator-&amp;gt;() const {return p;}              // We pretend it's unary&lt;br /&gt;
      bool operator==(Vector&amp;amp;lt;T&amp;gt;::reverse_iterator b) const {return p==b.p;}&lt;br /&gt;
      bool operator!=(Vector&amp;amp;lt;T&amp;gt;::reverse_iterator b) const {return p!=b.p;}&lt;br /&gt;
      // Also, bidirectional and random operators&lt;br /&gt;
    };&lt;br /&gt;
    reverse_iterator rbegin() {return end()-1;}&lt;br /&gt;
    reverse_iterator rend() {return begin()-1;}&lt;br /&gt;
    // Other members...&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  // Code for postfix ++&lt;br /&gt;
  template &amp;amp;lt;class T&amp;gt;&lt;br /&gt;
  inline Vector&amp;amp;lt;T&amp;gt;::reverse_iterator Vector::reverse_iterator::operator++(int dummy) {&lt;br /&gt;
    Vector&amp;amp;lt;T&amp;gt;::reverse_iterator result = *this;&lt;br /&gt;
    ++*this;&lt;br /&gt;
    return result;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  // Print a Vector in reverse order&lt;br /&gt;
  int main() {&lt;br /&gt;
    Vector&amp;amp;lt;int&amp;gt; a(10);&lt;br /&gt;
    for (Vector&amp;amp;lt;int&amp;gt;::reverse_iterator p=a.rbegin(); p!=a.rend(); ++p)&lt;br /&gt;
      cout &amp;amp;lt;&amp;amp;lt; *p &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;vector&amp;amp;lt;T&amp;gt;&amp;lt;/tt&amp;gt; supplies random&lt;br /&gt;
&amp;lt;tt&amp;gt;reverse_iterator&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;const_reverse_iterator&amp;lt;/tt&amp;gt;&lt;br /&gt;
as above.  Const iterators would typedef &amp;lt;tt&amp;gt;pointer&amp;lt;/tt&amp;gt; as &amp;lt;tt&amp;gt;const T*&amp;lt;/tt&amp;gt;&lt;br /&gt;
and &amp;lt;tt&amp;gt;reference&amp;lt;/tt&amp;gt; as &amp;lt;tt&amp;gt;const T&amp;amp;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A &amp;lt;tt&amp;gt;static&amp;lt;/tt&amp;gt; data member is shared by all instances of a class.&lt;br /&gt;
It must be initialized in a separate declaration, not in the class definition&lt;br /&gt;
or in the constructor initialization list.  A &amp;lt;tt&amp;gt;static&amp;lt;/tt&amp;gt; member function&lt;br /&gt;
cannot refer to &amp;lt;tt&amp;gt;this&amp;lt;/tt&amp;gt; or any&lt;br /&gt;
non-static members (and therefore it makes no sense to make them&lt;br /&gt;
&amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt;).  Static members may be referenced either as&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;i&amp;gt;object.member&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;&amp;lt;i&amp;gt;class&amp;lt;/i&amp;gt;::&amp;lt;i&amp;gt;member&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Counter {&lt;br /&gt;
    static int count;  // Number of Counters that currently exist (private)&lt;br /&gt;
  public:&lt;br /&gt;
    static int get() {return count;}&lt;br /&gt;
    Counter() {++count;}&lt;br /&gt;
    ~Counter() {--count;}&lt;br /&gt;
    Counter(const Counter&amp;amp; c) {++count;}  // Default would be wrong&lt;br /&gt;
    Counter&amp;amp; operator=(const Counter&amp;amp; c) {return *this;}  // Default would be OK&lt;br /&gt;
  };&lt;br /&gt;
  int Counter::count = 0;  // Initialize here, OK if private&lt;br /&gt;
  main() {&lt;br /&gt;
    Counter a, b, c;&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; b.get();         // 3&lt;br /&gt;
    cout &amp;amp;lt;&amp;amp;lt; Counter::get();  // 3&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=inheritance&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Inheritance&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inheritance is used to write a specialized or enhanced version of&lt;br /&gt;
another class.  For example, an &amp;lt;tt&amp;gt;ofstream&amp;lt;/tt&amp;gt; is a type of&lt;br /&gt;
&amp;lt;tt&amp;gt;ostream&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;tt&amp;gt;class &amp;lt;i&amp;gt;D&amp;lt;/i&amp;gt;: public &amp;lt;i&amp;gt;B&amp;lt;/i&amp;gt;&amp;lt;/tt&amp;gt; defines class D as&lt;br /&gt;
&amp;lt;i&amp;gt;derived&amp;lt;/i&amp;gt; from (subclass of) &amp;lt;i&amp;gt;base&amp;lt;/i&amp;gt; class (superclass) B,&lt;br /&gt;
meaning that D &amp;lt;i&amp;gt;inherits&amp;lt;/i&amp;gt;&lt;br /&gt;
all of B's members, except the constructors, destructor, and assignment&lt;br /&gt;
operator.  The default behavior of these special member functions is to treat&lt;br /&gt;
the base class as a data member.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class String: public Vector&amp;amp;lt;char&amp;gt; {&lt;br /&gt;
  public:&lt;br /&gt;
    String(const char* s=&amp;quot;&amp;quot;): Vector&amp;amp;lt;char&amp;gt;(strlen(s)) {&lt;br /&gt;
      copy(s, s+strlen(s), begin());  // Inherits Vector&amp;amp;lt;char&amp;gt;::begin()&lt;br /&gt;
    }&lt;br /&gt;
  };&lt;br /&gt;
  String a=&amp;quot;hello&amp;quot;; // Calls Vector&amp;amp;lt;char&amp;gt;::Vector(5);&lt;br /&gt;
  a.size();         // 5, inherits Vector&amp;amp;lt;char&amp;gt;::size()&lt;br /&gt;
  a[0]='j';         // &amp;quot;jello&amp;quot;, inherits Vector&amp;amp;lt;char&amp;gt;::operator[]&lt;br /&gt;
  String b=a;       // Default copy constructor uses Vector's copy constructor on base part&lt;br /&gt;
  b=a;              // Default = calls Vector's assignment operator on base part&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The default destructor &amp;lt;tt&amp;gt;String::~String() {}&amp;lt;/tt&amp;gt; is correct,&lt;br /&gt;
since in the process of destroying a String, the base is also&lt;br /&gt;
destroyed, calling &amp;lt;tt&amp;gt;Vector&amp;amp;lt;char&amp;gt;::~Vector() {delete data[];}&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Since there is no need to write a destructor, there is no need to&lt;br /&gt;
redefine copying or assignment either.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Although &amp;lt;tt&amp;gt;String&amp;lt;/tt&amp;gt; inherits &amp;lt;tt&amp;gt;Vector&amp;amp;lt;char&amp;gt;::data&amp;lt;/tt&amp;gt;,&lt;br /&gt;
it is private&lt;br /&gt;
and inaccessible.  A &amp;lt;tt&amp;gt;protected&amp;lt;/tt&amp;gt; member is accessible to derived&lt;br /&gt;
classes but private elsewhere.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class B {&lt;br /&gt;
  protected:&lt;br /&gt;
    int x;&lt;br /&gt;
  } b;                            // Declare class B and object b&lt;br /&gt;
  b.x=1;                          // Error, x is protected&lt;br /&gt;
&lt;br /&gt;
  class D: public B {&lt;br /&gt;
    void f() {x=1;}               // OK&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, a base class is private, making all inherited members&lt;br /&gt;
private.  Private base classes are rare and typically used as&lt;br /&gt;
implementations rather than specializations (A string is a vector,&lt;br /&gt;
but a stack is not).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Stack: Vector&amp;amp;lt;int&amp;gt; {  // or class Stack: private Vector&amp;amp;lt;int&amp;gt;&lt;br /&gt;
  public:&lt;br /&gt;
    bool empty() const {return size()==0;}  // OK&lt;br /&gt;
  } s;&lt;br /&gt;
  s.size();   // Error, private&lt;br /&gt;
  s.empty();  // OK, public&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A class may have more than one base class (called &amp;lt;i&amp;gt;multiple&lt;br /&gt;
inheritance&amp;lt;/i&amp;gt;).  If both bases are in&lt;br /&gt;
turn derived from a third base, then we derive from this root class using&lt;br /&gt;
&amp;lt;tt&amp;gt;virtual&amp;lt;/tt&amp;gt; to avoid inheriting its members twice further on.&lt;br /&gt;
Any indirectly derived class treats the virtual root as a direct base&lt;br /&gt;
class in the constructor initialization list.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class ios {...};                                      // good(), binary, ...&lt;br /&gt;
  class fstreambase: public virtual ios {...};          // open(), close(), ...&lt;br /&gt;
  class istream: public virtual ios {...};              // get(), operator&amp;gt;&amp;gt;(), ...&lt;br /&gt;
  class ifstream: public fstreambase, public istream {  // Only 1 copy of ios&lt;br /&gt;
    ifstream(): fstreambase(), istream(), ios() {...}   // Normally ios() would be omitted&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=polymorphism&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Polymorphism&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Polymorphism is the technique of defining a common interface for a&lt;br /&gt;
hierarchy of classes.  To support this, a derived object is allowed&lt;br /&gt;
wherever a base object is expected.  For example,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  String s=&amp;quot;Hello&amp;quot;;&lt;br /&gt;
  Vector&amp;amp;lt;char&amp;gt; v=s;    // Discards derived part of s to convert&lt;br /&gt;
  Vector&amp;amp;lt;char&amp;gt;* p=&amp;amp;s;  // p points to base part of s&lt;br /&gt;
  try {throw s;} catch(Vector&amp;amp;lt;char&amp;gt; x) {}  // Caught with x set to base part of s&lt;br /&gt;
  s=Vector&amp;amp;lt;char&amp;gt;(5);   // Error, can't convert base to derived&lt;br /&gt;
&lt;br /&gt;
  // Allow output of Vector&amp;amp;lt;char&amp;gt; using normal notation&lt;br /&gt;
  ostream&amp;amp; operator &amp;amp;lt;&amp;amp;lt; (ostream&amp;amp; out, const Vector&amp;amp;lt;char&amp;gt;&amp;amp; v) {&lt;br /&gt;
    copy(v.begin(), v.end(), ostream_iterator&amp;amp;lt;char&amp;gt;(out, &amp;quot;&amp;quot;));  // Print v to out&lt;br /&gt;
    return out;        // To allow (cout &amp;amp;lt;&amp;amp;lt; a) &amp;amp;lt;&amp;amp;lt; b;&lt;br /&gt;
  }&lt;br /&gt;
  cout &amp;amp;lt;&amp;amp;lt; s;           // OK, v refers to base part of s&lt;br /&gt;
  ofstream f(&amp;quot;file.txt&amp;quot;);&lt;br /&gt;
  f &amp;amp;lt;&amp;amp;lt; s;              // OK, ofstream is derived from ostream&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A derived class may redefine inherited member functions, overriding any&lt;br /&gt;
function&lt;br /&gt;
with the same name, parameters, return type, and const-ness (and hiding&lt;br /&gt;
other functions with the same name, thus the overriding function should&lt;br /&gt;
not be overloaded).&lt;br /&gt;
The function call is resolved at compile time.  This is incorrect in case&lt;br /&gt;
of a base pointer or reference to a derived object.  To allow run time&lt;br /&gt;
resolution, the base member function should be declared &amp;lt;tt&amp;gt;virtual&amp;lt;/tt&amp;gt;.  Since&lt;br /&gt;
the default destructor is not virtual, a virtual destructor should&lt;br /&gt;
be added to the base class.  If empty, no copy constructor or assignment&lt;br /&gt;
operator is required.  Constructors and = are never virtual.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Shape {&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void draw() const;&lt;br /&gt;
    virtual ~Shape() {}&lt;br /&gt;
  };&lt;br /&gt;
  class Circle: public Shape {&lt;br /&gt;
  public:&lt;br /&gt;
    void draw() const;      // Must use same parameters, return type, and const&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  Shape s; s.draw();        // Shape::draw()&lt;br /&gt;
  Circle c; c.draw();       // Circle::draw()&lt;br /&gt;
  Shape&amp;amp; r=c; r.draw();     // Circle::draw() if virtual&lt;br /&gt;
  Shape* p=&amp;amp;c; p-&amp;gt;draw();   // Circle::draw() if virtual&lt;br /&gt;
  p=new Circle; p-&amp;gt;draw();  // Circle::draw() if virtual&lt;br /&gt;
  delete p;                 // Circle::~Circle() if virtual&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An &amp;lt;i&amp;gt;abstract&amp;lt;/i&amp;gt; base class defines an interface for one or&lt;br /&gt;
more derived classes, which are allowed to instantiate objects.&lt;br /&gt;
Abstractness can be enforced by using protected (not private) constructors&lt;br /&gt;
or using &amp;lt;i&amp;gt;pure virtual&amp;lt;/i&amp;gt; member functions, which must be overridden in&lt;br /&gt;
the derived class or else that class is abstract too.  A pure virtual&lt;br /&gt;
member function is declared &amp;lt;tt&amp;gt;=0;&amp;lt;/tt&amp;gt; and has no code defined.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Shape {&lt;br /&gt;
  protected:&lt;br /&gt;
    Shape();                 // Optional, but default would be public&lt;br /&gt;
  public:&lt;br /&gt;
    virtual void draw() const = 0; // Pure virtual, no definition&lt;br /&gt;
    virtual ~Shape() {}&lt;br /&gt;
  };&lt;br /&gt;
  // Circle as before&lt;br /&gt;
&lt;br /&gt;
  Shape s;                   // Error, protected constructor, no Shape::draw()&lt;br /&gt;
  Circle c;                  // OK&lt;br /&gt;
  Shape&amp;amp; r=c; r.draw();      // OK, Circle::draw()&lt;br /&gt;
  Shape* p=new Circle();     // OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=runtimetype&amp;gt;&lt;br /&gt;
&amp;lt;h4&amp;gt;Run time type identification&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
C++ provides for run time type identification, although this usually&lt;br /&gt;
indicates a poor design.&lt;br /&gt;
&amp;lt;tt&amp;gt;dynamic_cast&amp;amp;lt;T&amp;gt;&amp;lt;/tt&amp;gt;(x) checks at run time whether a base pointer&lt;br /&gt;
or reference is to a derived object, and if so, does a conversion.&lt;br /&gt;
The base class must have at least one virtual function to use run time&lt;br /&gt;
type checking.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #include &amp;amp;lt;typeinfo&amp;gt;    // For typeid()&lt;br /&gt;
  typeid(*p)==typeid(T)  // true if p points to a T&lt;br /&gt;
  dynamic_cast&amp;amp;lt;T*&amp;gt;(p)    // Convert base pointer to derived T* or 0.&lt;br /&gt;
  dynamic_cast&amp;amp;lt;T&amp;amp;&amp;gt;(r)    // Convert base reference to derived T&amp;amp; or throw bad_cast()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For example,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class B {public: virtual void f(){}};&lt;br /&gt;
  class D: public B {public: int x;} d;  // Bad design, public member in D but not B&lt;br /&gt;
  B* p=&amp;amp;d; p-&amp;gt;x;                         // Error, no B::x&lt;br /&gt;
  D* q=p; q-&amp;gt;x;                          // Error, can't convert B* to D*&lt;br /&gt;
  q=(D*)p;  q-&amp;gt;x;                        // OK, but reinterpret_cast, no run time check&lt;br /&gt;
  q=dynamic_cast&amp;amp;lt;D*&amp;gt;(p); if (q) q-&amp;gt;x;    // OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=othertypes&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Other Types&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=typedef&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;b&amp;gt;typedef&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt; defines a synonym for a type.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  typedef char* Str;  // Str is a synonym for char*&lt;br /&gt;
  Str a, b[5], *c;    // char* a; char* b[5]; char** c;&lt;br /&gt;
  char* d=a;          // OK, really the same type&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=enum&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;tt&amp;gt;&amp;lt;b&amp;gt;enum&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt; defines a type and a set of symbolic&lt;br /&gt;
values for it.  There is an implicit conversion to int and explicit&lt;br /&gt;
conversion from int to enum.  You can specify the int equivalents of&lt;br /&gt;
the symbolic names, or they default to successive values beginning&lt;br /&gt;
with 0.  Enums may be anonymous,&lt;br /&gt;
specifying the set of symbols and possibly objects without giving the&lt;br /&gt;
type a name.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  enum Weekday {MON,TUE=1,WED,THU,FRI};  // Type declaration&lt;br /&gt;
  enum Weekday today=WED;                // Object declaration, has value 2&lt;br /&gt;
  today==2                               // true, implicit int(today)&lt;br /&gt;
  today=Weekday(3);                      // THU, conversion must be explicit&lt;br /&gt;
  enum {N=10};                           // Anonymous enum, only defines N&lt;br /&gt;
  int a[N];                              // OK, N is known at compile time&lt;br /&gt;
  enum {SAT,SUN} weekend=SAT;            // Object of anonymous type&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=struct&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;A &amp;lt;tt&amp;gt;&amp;lt;b&amp;gt;struct&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt; is a class where the default protection is&lt;br /&gt;
public instead of private.  A &amp;lt;tt&amp;gt;struct&amp;lt;/tt&amp;gt; can be initialized like an&lt;br /&gt;
array.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  struct Complex {double re, im;};     // Declare type&lt;br /&gt;
  Complex a, b={1,2}, *p=&amp;amp;amp;b;           // Declare objects&lt;br /&gt;
  a.re = p-&amp;gt;im;                        // Access members&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=union&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;A &amp;lt;tt&amp;gt;&amp;lt;b&amp;gt;union&amp;lt;/b&amp;gt;&amp;lt;/tt&amp;gt; is a struct whose fields overlap in memory.&lt;br /&gt;
Unions can also be anonymous.  They may be used to implement variant records.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  union U {int i; double d;};  // sizeof(U) is larger of int or double&lt;br /&gt;
  U u; u.i=3;                  // overwrites u.d&lt;br /&gt;
&lt;br /&gt;
  // A variant record&lt;br /&gt;
  class Token {&lt;br /&gt;
    enum {INT, DOUBLE} type;   // which field is in use?&lt;br /&gt;
    union {int i; double d;} value;  // An anonymous union&lt;br /&gt;
  public:&lt;br /&gt;
    void print() const {&lt;br /&gt;
      if (type==INT) cout &amp;amp;lt;&amp;amp;lt; value.i;&lt;br /&gt;
      else cout &amp;amp;lt;&amp;amp;lt; value.d;&lt;br /&gt;
    }&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;An enum, struct, class, or union type and a list of objects may&lt;br /&gt;
be declared together in a single statement.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {public: double re, im;} a, b={1,2}, *p=&amp;amp;amp;b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=programorganization&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Program Organization&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;For C++ programs that only use one source code file and the&lt;br /&gt;
standard library, the only rule is to declare things before using them:&lt;br /&gt;
type declarations before object declarations, and function declarations&lt;br /&gt;
or definitions before calling them.  However, implicitly inlined member&lt;br /&gt;
functions&lt;br /&gt;
may use members not yet declared, and templates may use names as long&lt;br /&gt;
as they are declared before instantiation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  class Complex {&lt;br /&gt;
    double real() const {return re;}  // OK&lt;br /&gt;
    double re, im;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Global and member functions (unless inlined or templated) and global&lt;br /&gt;
or class static objects are separately compilable units, and may appear&lt;br /&gt;
in separate source code (.cpp) files.  If they are defined and used&lt;br /&gt;
in different files, then a declaration is needed.  To insure that&lt;br /&gt;
the declaration and definition are consistent, the declaration should&lt;br /&gt;
be in a shared header file.  A shared header conventionally has a&lt;br /&gt;
&amp;lt;tt&amp;gt;.h&amp;lt;/tt&amp;gt; extension, and is inserted with a&lt;br /&gt;
&amp;lt;tt&amp;gt;#include &amp;quot;&amp;lt;i&amp;gt;filename&amp;lt;/i&amp;gt;.h&amp;quot;&amp;lt;/tt&amp;gt;, using double quotes to indicate&lt;br /&gt;
that the file is in the current directory.  Global variables are&lt;br /&gt;
declared with &amp;lt;tt&amp;gt;extern&amp;lt;/tt&amp;gt; without initialization.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// prog.h         // prog1.cpp        // prog2.cpp&lt;br /&gt;
extern int x;     #include &amp;quot;prog.h&amp;quot;   #include &amp;quot;prog.h&amp;quot;&lt;br /&gt;
int f();          int x=0;            int f() {&lt;br /&gt;
                  int main() {          return x;&lt;br /&gt;
                    f();              }&lt;br /&gt;
                    return 0;&lt;br /&gt;
                  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To compile,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;b&amp;gt;g++ prog1.cpp prog2.cpp -o prog&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This produces two object files (&amp;lt;tt&amp;gt;prog1.o, prog2.o&amp;lt;/tt&amp;gt;), and then links&lt;br /&gt;
them to produce the executable &amp;lt;tt&amp;gt;prog&amp;lt;/tt&amp;gt;.  g++ also accepts &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt;&lt;br /&gt;
files, which are linked only, saving time if the &amp;lt;tt&amp;gt;.cpp&amp;lt;/tt&amp;gt;&lt;br /&gt;
file was not changed.  To compile without linking, use &amp;lt;tt&amp;gt;-c&amp;lt;/tt&amp;gt;.&lt;br /&gt;
To optimize (compile slower but run faster), use &amp;lt;tt&amp;gt;-O&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The UNIX &amp;lt;tt&amp;gt;make&amp;lt;/tt&amp;gt; command updates the executable as needed based&lt;br /&gt;
on the timestamps of source and &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt; files.  It requires a file&lt;br /&gt;
named &amp;lt;tt&amp;gt;Makefile&amp;lt;/tt&amp;gt; containing a set of dependencies of the form:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;lt;i&amp;gt;file: files which should be older than file&amp;lt;/i&amp;gt;&lt;br /&gt;
  (tab) &amp;lt;i&amp;gt;commands to update file&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Dependencies may be in any order.  The Makefile is executed repeatedly&lt;br /&gt;
until all dependencies are satisfied.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Makefile comment&lt;br /&gt;
  prog: prog1.o prog2.o&lt;br /&gt;
        g++ prog1.o prog2.o -o prog&lt;br /&gt;
&lt;br /&gt;
  prog1.o: prog1.cpp prog.h&lt;br /&gt;
        g++ -c prog1.cpp&lt;br /&gt;
&lt;br /&gt;
  prog2.o: prog2.cpp prog.h&lt;br /&gt;
        g++ -c prog2.cpp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compiler options for g++.  Other compilers may vary.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  g++ file1.cpp              Compile, produce executable a.out in UNIX&lt;br /&gt;
  g++ file1.cpp file2.o      Compile .cpp and link .o to executable a.out&lt;br /&gt;
  g++ -Wall                  Turn on all warnings&lt;br /&gt;
  g++ -c file1.cpp           Compile to file1.o, do not link&lt;br /&gt;
  g++ -o file1               Rename a.out to file1&lt;br /&gt;
  g++ -O                     Optimize executable for speed&lt;br /&gt;
  g++ -v                     Verbose mode&lt;br /&gt;
  g++ -DX=Y                  Equivalent to #define X Y&lt;br /&gt;
  g++ --help                 Show all g++ options&lt;br /&gt;
  gxx file1.cpp              Compile in Windows MS-DOS box (DJGPP) to A.EXE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Anything which is not a separately compilable unit may appear in&lt;br /&gt;
a header file, such as class definitions (but not function code unless&lt;br /&gt;
inlined), templated classes (including function code), templated&lt;br /&gt;
functions, and other &amp;lt;tt&amp;gt;#include&amp;lt;/tt&amp;gt; statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=namespaces&amp;gt;&lt;br /&gt;
&amp;lt;h3&amp;gt;Creating Libraries (namespaces)&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Libraries usually come in the form of a header and an object (&amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt;)&lt;br /&gt;
file.  To use them, &amp;lt;tt&amp;gt;#include &amp;quot;header.h&amp;quot;&amp;lt;/tt&amp;gt; and link the &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt;&lt;br /&gt;
file using g++.  If the &amp;lt;tt&amp;gt;.o&amp;lt;/tt&amp;gt; was compiled in C rather than C++,&lt;br /&gt;
then indicate this with &amp;lt;tt&amp;gt;extern &amp;quot;C&amp;quot; {}&amp;lt;/tt&amp;gt; to turn off name mangling.&lt;br /&gt;
C++ encodes or &amp;quot;mangles&amp;quot; overloaded function names to allow them to be linked,&lt;br /&gt;
but C does not since it doesn't allow overloading.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  extern &amp;quot;C&amp;quot; {          // Turn off name mangling&lt;br /&gt;
  #include &amp;quot;header.h&amp;quot;   // Written in C&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When writing your own library, use a unique namespace name to prevent&lt;br /&gt;
conflicts with other libraries.  A namespace may span multiple&lt;br /&gt;
files.  Types, objects, and functions declared in a namespace N must&lt;br /&gt;
be prefixed with N:: when used outside the namespace, or there must&lt;br /&gt;
be a &amp;lt;tt&amp;gt;using namespace N;&amp;lt;/tt&amp;gt; in the current scope.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Also, to guard against possible multiple&lt;br /&gt;
inclusions of the header file, &amp;lt;tt&amp;gt;#define&amp;lt;/tt&amp;gt; some symbol and test&lt;br /&gt;
for it with &amp;lt;/tt&amp;gt;#ifndef ... #endif&amp;lt;/tt&amp;gt; on the first and last lines.&lt;br /&gt;
Don't have a &amp;lt;tt&amp;gt;using&lt;br /&gt;
namespace std;&amp;lt;/tt&amp;gt;, since the user may not want &amp;lt;tt&amp;gt;std&amp;lt;/tt&amp;gt; visible.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #ifndef MYLIB_H       // mylib.h, or use #if !defined(MYLIB_H)&lt;br /&gt;
  #define MYLIB_H&lt;br /&gt;
  #include &amp;amp;lt;string&amp;gt;&lt;br /&gt;
  // No using statement&lt;br /&gt;
  namespace mylib {&lt;br /&gt;
    class B {&lt;br /&gt;
    public:&lt;br /&gt;
      std::string f();  // No code&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  #endif&lt;br /&gt;
&lt;br /&gt;
  // mylib.cpp, becomes mylib.o&lt;br /&gt;
  #include &amp;amp;lt;string&amp;gt;&lt;br /&gt;
  #include &amp;quot;mylib.h&amp;quot;&lt;br /&gt;
  using namespace std;  // OK&lt;br /&gt;
  namespace mylib {&lt;br /&gt;
    string B::f() {return &amp;quot;hi&amp;quot;;}&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;#define&amp;lt;/tt&amp;gt; could be used to create constants through text substitution,&lt;br /&gt;
but it is better to use &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt; to allow type checking.&lt;br /&gt;
&amp;lt;tt&amp;gt;#define X Y&amp;lt;/tt&amp;gt; has the effect of replacing symbol X with&lt;br /&gt;
arbitrary text Y before compiling, equivalent to the g++ option &amp;lt;tt&amp;gt;-DX=Y&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Each compiler usually defines a different set of symbols, which&lt;br /&gt;
can be tested with &amp;lt;tt&amp;gt;#if, #ifdef, #ifndef, #elsif, #else&amp;lt;/tt&amp;gt;,&lt;br /&gt;
and &amp;lt;tt&amp;gt;#endif&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #ifdef unix  // Defined by most UNIX compilers&lt;br /&gt;
  // ...&lt;br /&gt;
  #else&lt;br /&gt;
  // ...&lt;br /&gt;
  #endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Preprocessor statements are one line (no semicolon).  They perform&lt;br /&gt;
text substitutions in the source code prior to compiling.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #include &amp;amp;lt;header&amp;gt;          // Standard header&lt;br /&gt;
  #include &amp;quot;header.h&amp;quot;        // Include header file from current directory&lt;br /&gt;
  #define X Y                // Replace X with Y in source code&lt;br /&gt;
  #define f(a,b) a##b        // Replace f(1,2) with 12&lt;br /&gt;
  #define X \                // Continue a # statement on next line&lt;br /&gt;
  #ifdef X                   // True if X is #defined&lt;br /&gt;
  #ifndef X                  // False if X is #defined&lt;br /&gt;
  #if !defined(X)            // Same&lt;br /&gt;
  #else                      // Optional after #if...&lt;br /&gt;
  #endif                     // Required&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=history&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;History of C++&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;C++ evolved from C, which in turn evolved from B, written by Ken&lt;br /&gt;
Thompson in 1970 as a variant of BCPL.  C was developed in the 1970's&lt;br /&gt;
by Brian Kernighan and Dennis Ritchie as a &amp;quot;portable assembly language&amp;quot;&lt;br /&gt;
to develop UNIX.  C became widely available when they published &amp;quot;The&lt;br /&gt;
C Programming Language&amp;quot; in 1983.  C lacked standard containers (string,&lt;br /&gt;
vector, map), iostreams, bool, const, references, classes, exceptions,&lt;br /&gt;
namespaces, new/delete, function and operator overloading, and&lt;br /&gt;
object-oriented capabilities.&lt;br /&gt;
I/O was done using &amp;lt;tt&amp;gt;&amp;amp;lt;stdio.h&amp;gt;&amp;lt;/tt&amp;gt;.  Strings were implemented as&lt;br /&gt;
fixed sized char[] arrays requiring functions to assign or compare them&lt;br /&gt;
(strcpy(), strcmp()).  Structs could not be assigned, and had to be&lt;br /&gt;
copied using memcpy().  Function arguments were not type checked.&lt;br /&gt;
Functions could only modify arguments by passing their addresses.&lt;br /&gt;
Memory allocation was done using malloc(), which requires the number of&lt;br /&gt;
bytes to allocate and returns an untyped pointer or NULL if it fails.&lt;br /&gt;
The language allowed unsafe implicit conversions such as int to pointers.&lt;br /&gt;
Variables had to be declared before the first statement.  There was&lt;br /&gt;
no &amp;lt;tt&amp;gt;inline&amp;lt;/tt&amp;gt;, so macros were often used in place of small functions.&lt;br /&gt;
Hardware was slow and optimizers were not very good, so it was common&lt;br /&gt;
to declare &amp;lt;tt&amp;gt;register&amp;lt;/tt&amp;gt; variables.  There were no // style comments.&lt;br /&gt;
For instance,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  /* Copy argv[1] to buf and print it */&lt;br /&gt;
  #include &amp;amp;lt;stdio.h&amp;gt;         /* No cout, use printf()                             */&lt;br /&gt;
  #include &amp;amp;lt;string.h&amp;gt;        /* No string type, use char*                         */&lt;br /&gt;
  #include &amp;amp;lt;stdlib.h&amp;gt;        /* No new/delete, use malloc/free                    */&lt;br /&gt;
  main(argc, argv)           /* Return type defaults to int */&lt;br /&gt;
  int argc;                  /* Old style parameter declaration, no type checking */&lt;br /&gt;
  char** argv;&lt;br /&gt;
  {                          /* No namespace std                                  */&lt;br /&gt;
    char* buf;               /* All declarations before the first statement       */&lt;br /&gt;
    if (argc&amp;gt;1) {&lt;br /&gt;
      buf=(char*)malloc((strlen(argv[1])+1)*sizeof(char));  /* Cast optional      */&lt;br /&gt;
      strcpy(buf, argv[1]);  /* Can't assign, no range check                      */&lt;br /&gt;
      printf(&amp;quot;%s\n&amp;quot;, buf);   /* Arguments not type checked                        */&lt;br /&gt;
      free(buf);             /* No delete */&lt;br /&gt;
    }&lt;br /&gt;
  }                          /* Return value is undefined (unchecked)             */&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The ANSI C standard was finished in 1988.  It added &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt;,&lt;br /&gt;
new style function declaration with type checking, &amp;lt;tt&amp;gt;struct&amp;lt;/tt&amp;gt; assignment,&lt;br /&gt;
strict type checking of pointer assignments,&lt;br /&gt;
and specified the standard C library, which until now was widely used&lt;br /&gt;
but with minor, annoying variations.  However, many compilers did not&lt;br /&gt;
become ANSI compliant until the early 1990's.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;In the 1980's Bjarne Stroustrup at AT&amp;amp;T developed &amp;quot;C with Classes&amp;quot;, later C++.&lt;br /&gt;
Early implementations were available for UNIX as &amp;lt;tt&amp;gt;cfront&amp;lt;/tt&amp;gt; (cc), a&lt;br /&gt;
C++ to C translator around 1990.&lt;br /&gt;
It added object oriented programming with&lt;br /&gt;
classes, inheritance, and polymorphism, also references, the iostream&lt;br /&gt;
library, and minor enhancements such as // style comments and the ability&lt;br /&gt;
to declare variables anywhere.  Because there were no namespaces,&lt;br /&gt;
the iostream header was named &amp;amp;lt;iostream.h&amp;gt; and no &amp;lt;tt&amp;gt;using&amp;lt;/tt&amp;gt;&lt;br /&gt;
statement was required.  Unlike C programs which always have a .c extension,&lt;br /&gt;
C++ didn't say, so .cpp, .cc  and .C were all common, and .hpp for headers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;GNU gcc and g++, which compiled C and C++&lt;br /&gt;
directly to machine code, were developed in the early 1990's.  Templates&lt;br /&gt;
were added in 1993.  Exceptions were added in 1994.&lt;br /&gt;
The standard&lt;br /&gt;
container library (originally called the standard template library&lt;br /&gt;
or STL) was developed by researchers at Hewlett-Packard and made&lt;br /&gt;
available free as&lt;br /&gt;
a separate download in the mid 1990's and ported to several compilers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;ANSI standard C++ compilers became available in 1998.  This added&lt;br /&gt;
STL to the standard library, added multiple inheritance, namespaces,&lt;br /&gt;
type bool, and run time type checking (dynamic_cast, typeid).  The&lt;br /&gt;
&amp;lt;tt&amp;gt;.h&amp;lt;/tt&amp;gt; extension on headers was dropped.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;C++ most likely succeeded where other early object oriented languages&lt;br /&gt;
failed (Simula67, Actor, Eiffel, SmallTalk) because it was backwards&lt;br /&gt;
compatible with C, allowing old code to be used, and because C programmers&lt;br /&gt;
could use it immediately without learning the new features.  However, there&lt;br /&gt;
are a few incompatibilities.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Old style function declarations are not allowed.&lt;br /&gt;
&amp;lt;li&amp;gt;Conversion from &amp;lt;tt&amp;gt;void*&amp;lt;/tt&amp;gt; (returned by &amp;lt;tt&amp;gt;malloc()&amp;lt;/tt&amp;gt;) requires&lt;br /&gt;
a cast.&lt;br /&gt;
&amp;lt;li&amp;gt;There are many new reserved words.&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;There are also some incompatibilities between old (before 1998)&lt;br /&gt;
and new versions of C++.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt; was changed to throw type &amp;lt;tt&amp;gt;bad_alloc&amp;lt;/tt&amp;gt; if out&lt;br /&gt;
of memory, instead of returning 0.&lt;br /&gt;
&amp;lt;li&amp;gt;The scope of a variable declared in a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop was changed&lt;br /&gt;
to be local to the loop and not beyond it (not yet implemented by&lt;br /&gt;
Microsoft Visual C++)&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;g++ does not yet implement all ANSI C++ features.  For instance,&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Type &amp;lt;tt&amp;gt;ostringstream&amp;lt;/tt&amp;gt; allowing formatted writing to strings.&lt;br /&gt;
&amp;lt;li&amp;gt;Run time bounds checking of vector indexes using v.at(i)&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The largest integer type is 32 bits in most implementations, but&lt;br /&gt;
as 64 bit machines become common it is possible that type &amp;lt;tt&amp;gt;long&amp;lt;/tt&amp;gt;&lt;br /&gt;
could become a 64 bit type (as in Java) in the future.&lt;br /&gt;
g++ supports the nonstandard 64-bit integer type &amp;lt;tt&amp;gt;long long&amp;lt;/tt&amp;gt;, e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  unsigned long long bigzero=0LLU;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Most implementations of &amp;lt;tt&amp;gt;time()&amp;lt;/tt&amp;gt; return the number of seconds since&lt;br /&gt;
Jan. 1, 1970 as a &amp;lt;tt&amp;gt;time_t&amp;lt;/tt&amp;gt;, normally a signed 32-bit &amp;lt;tt&amp;gt;long&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Programs that use this implementation will fail on Jan. 19,&lt;br /&gt;
2038 at 3:14:08 AM as this value overflows and becomes negative.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a name=furtherreading&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;Further Reading&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Brian W. Kernighan, &amp;lt;i&amp;gt;The C Programming Language&amp;lt;/i&amp;gt;, 2nd Ed.,&lt;br /&gt;
Prentice Hall, 1988.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Bjarne Stroustrup, &amp;lt;i&amp;gt;The C++ Programming Language&amp;lt;/i&amp;gt;, 3rd Ed,,&lt;br /&gt;
Addison Wesley, 1997.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Andrew Koenig, Barbara E. Moo, &amp;lt;i&amp;gt;Accelerated C++&amp;lt;/i&amp;gt;,&lt;br /&gt;
Addison Wesley, 2000.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Template:Warning&amp;diff=355</id>
		<title>Template:Warning</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Template:Warning&amp;diff=355"/>
		<updated>2015-08-30T05:14:42Z</updated>

		<summary type="html">&lt;p&gt;Benargee: Created page with &amp;quot;&amp;lt;div style=&amp;quot;text-align: left; margin: 1em&amp;quot;&amp;gt; {| style=&amp;quot;width: 3;text-align:left; background-color: #ff6666; border: 1px solid #000000; padding: 0.1em; margin: 0; border-radius:...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;text-align: left; margin: 1em&amp;quot;&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width: 3;text-align:left; background-color: #ff6666; border: 1px solid #000000; padding: 0.1em; margin: 0; border-radius: 10px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; style=&amp;quot;padding:0.05em; width:0;&amp;quot;|&lt;br /&gt;
| style=&amp;quot;padding: 0.1em;&amp;quot; | ''Warning:{{{1}}}''&lt;br /&gt;
|}&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;[[Category:Stubs]]&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[:Category:Stubs]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Wiki_Tools&amp;diff=354</id>
		<title>Wiki Tools</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Wiki_Tools&amp;diff=354"/>
		<updated>2015-08-30T04:37:20Z</updated>

		<summary type="html">&lt;p&gt;Benargee: http://pandoc.org/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[category:Benargee]]&lt;br /&gt;
&lt;br /&gt;
* http://www.tablesgenerator.com/mediawiki_tables&lt;br /&gt;
* http://pandoc.org/ (HTML to MediaWiki)&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Main_Page&amp;diff=353</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Main_Page&amp;diff=353"/>
		<updated>2015-07-26T18:21:27Z</updated>

		<summary type="html">&lt;p&gt;Benargee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
Hello and welcome to my wiki. This is a semi private wiki. I will be filling this wiki with projects that interest me. I will mostly add stuff that has no place in other wiki's. This wiki is a work in progress so please do not shoot me D:&lt;br /&gt;
===Content===&lt;br /&gt;
*[[:category:Games|Games]]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=User:Benargee&amp;diff=352</id>
		<title>User:Benargee</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=User:Benargee&amp;diff=352"/>
		<updated>2015-07-18T16:20:39Z</updated>

		<summary type="html">&lt;p&gt;Benargee: /* Other Web Presence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Benargee]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
====DCS====&lt;br /&gt;
*[http://forums.eagle.ru/member.php?u=96654 Forum Profile]&lt;br /&gt;
====Arma====&lt;br /&gt;
*[https://community.bistudio.com/wiki/User:Benargee Wiki Profile]&lt;br /&gt;
*[http://forums.bistudio.com/member.php?105006-Benargee Forum Profile]&lt;br /&gt;
====Twitter====&lt;br /&gt;
*[https://twitter.com/benargee Benargee]&lt;br /&gt;
==Other Web Presence==&lt;br /&gt;
===DCS===&lt;br /&gt;
*[http://en.wiki.eagle.ru/wiki/User:Benargee Wiki]&lt;br /&gt;
**[http://en.wiki.eagle.ru/wiki/Special:Contributions/Benargee Contributions]&lt;br /&gt;
===Wikipedia===&lt;br /&gt;
*[http://en.wikipedia.org/wiki/User:Benargee User Page]&lt;br /&gt;
**[http://en.wikipedia.org/wiki/Special:Contributions/Benargee Contributions]&lt;br /&gt;
===[https://github.com/Benargeez GitHub]===&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=351</id>
		<title>KSP - Mods</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=351"/>
		<updated>2015-07-15T01:25:11Z</updated>

		<summary type="html">&lt;p&gt;Benargee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ksp}}&lt;br /&gt;
=Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/18230 KerbalEngineer Redux] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/113111 Kerbal Inventory System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92514 Kerbal Attachment System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/47863 Precise Node] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/86677 Stage Recovery] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/104758 Waypoint Manager] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/68089 kOS]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/83305 RemoteTech]&lt;br /&gt;
**[http://forum.kerbalspaceprogram.com/threads/108669 RemoteTech XF]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/80369 SCANsat]&lt;br /&gt;
----&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/40667 TAC Life Support]&lt;br /&gt;
=Not Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92324 Chatterer]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/24786 Kerbal Alarm Clock]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/43901 Docking Port Alignment Indicator]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/96497 PlanetShine]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/20451 Ferram Aerospace Research]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/74195 Action Groups Extended]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/117471 RasterPropMonitor]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/50736  Automate Vertical Velocity and Altitude Control]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/50524 Enhanced Navball ]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=Kerbal_Space_Program&amp;diff=350</id>
		<title>Kerbal Space Program</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=Kerbal_Space_Program&amp;diff=350"/>
		<updated>2015-07-13T02:04:47Z</updated>

		<summary type="html">&lt;p&gt;Benargee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}{{ksp}}&lt;br /&gt;
=Mods=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/24786 Kerbal Alarm Clock]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/68089 kOS Scriptable Autopilot System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/18230-0-23-Kerbal-Engineer-Redux-v0-6-2-2 Kerbal Engineer Redux]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/86677-1-0-2-StageRecovery-Recover-Funds-from-Dropped-Stages-v1-5-5-%285-2-15%29  StageRecovery]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/47863-1-0-2-Precise-Node-1-1-3-Precisely-edit-your-maneuver-nodes Precise Node]&lt;br /&gt;
&lt;br /&gt;
=Useful links=&lt;br /&gt;
*[http://alexmoon.github.io/ksp/ Launch Window Planner (GIT)]&lt;br /&gt;
*[https://docs.google.com/document/d/1IX6ykVb0xifBrB4BRFDpqPO6kjYiLvOcEo3zwmZL0sQ/edit Timing the Hohmann Transfer in Kerbal Space Program]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=349</id>
		<title>KSP - Mods</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=349"/>
		<updated>2015-07-13T01:21:40Z</updated>

		<summary type="html">&lt;p&gt;Benargee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ksp}}&lt;br /&gt;
=Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/18230 KerbalEngineer Redux] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/113111 Kerbal Inventory System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92514 Kerbal Attachment System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/47863 Precise Node] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/86677 Stage Recovery] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/104758 Waypoint Manager] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/68089 kOS]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/83305 RemoteTech]&lt;br /&gt;
**[http://forum.kerbalspaceprogram.com/threads/108669 RemoteTech XF]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/80369 SCANsat]&lt;br /&gt;
----&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/40667 TAC Life Support]&lt;br /&gt;
=Not Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92324 Chatterer]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/24786 Kerbal Alarm Clock]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/43901 Docking Port Alignment Indicator]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/96497 PlanetShine]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/20451 Ferram Aerospace Research]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/74195 Action Groups Extended]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/117471 RasterPropMonitor]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/50736  Automate Vertical Velocity and Altitude Control]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
	<entry>
		<id>http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=348</id>
		<title>KSP - Mods</title>
		<link rel="alternate" type="text/html" href="http://wiki.benargee.com/index.php?title=KSP_-_Mods&amp;diff=348"/>
		<updated>2015-07-06T01:15:11Z</updated>

		<summary type="html">&lt;p&gt;Benargee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ksp}}&lt;br /&gt;
=Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/18230 KerbalEngineer Redux] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/113111 Kerbal Inventory System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92514 Kerbal Attachment System]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/47863 Precise Node] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/86677 Stage Recovery] {{ksppartless}}&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/104758 Waypoint Manager] {{ksppartless}}&lt;br /&gt;
----&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/68089 kOS]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/83305 RemoteTech]&lt;br /&gt;
**[http://forum.kerbalspaceprogram.com/threads/108669 RemoteTech XF]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/80369 SCANsat]&lt;br /&gt;
=Not Installed=&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/92324 Chatterer]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/24786 Kerbal Alarm Clock]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/43901 Docking Port Alignment Indicator]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/96497 PlanetShine]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/20451 Ferram Aerospace Research]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/74195 Action Groups Extended]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/117471 RasterPropMonitor]&lt;br /&gt;
*[http://forum.kerbalspaceprogram.com/threads/50736  Automate Vertical Velocity and Altitude Control]&lt;/div&gt;</summary>
		<author><name>Benargee</name></author>
	</entry>
</feed>