Examples C++

Description Code
Introduction
 First C++ program that says hello
 Test arithmetic operations
 Sum from 1 to an upperbound using a while-loop
 Sum the odd and even numbers from 1 to an upperbound
 Convert temperature between Celsius and Fahrenheit
 Testing type cast
 Print Size of Fundamental Types
 Test integer limits in <climits> header
 Testing Primitive Types
 Testing mix-type arithmetic operations
 Test Arithmetic Overflow/Underflow
 Test on increment (++) and decrement (--) Operator
 Test implicit type casting
 Testing Explicit Type Cast
 Test Type Casting
 Sum from 1 to a given upperbound and average
 Statistics of positive integers
 List non-prime from 1 to an upperbound
 List primes from 1 to an upperbound
 List primes from 1 to an upperbound use break
 A mystery series
 Print square pattern
 Testing string class input and output
 Example on C++ string function
 Test Formatting Output
 Test Formatting Input
 Test local array initialization
 FMean and standard deviation in an array
 Testing For-each loop
 Test Multi-dimensional Array
 Test C-string

hello.cpp
TestArithmetics.cpp
SumNumbers.cpp
SumOddEven.cpp
ConvertTemperature.cpp
TestCastingAverage.cpp
SizeofTypes.cpp
TestLimits.cpp
TestLiteral.cpp
TestMixTypeOp.cpp
TestOverflow.cpp
TestIncDec.cpp
TestImplicitTypeCast.cpp
Average1to100.cpp
TestTypeCast.cpp
SumNumbers.cpp
StatNumbers.cpp
NonPrimeList.cpp
PrimeListWithBreak.cpp
PrimeList.cpp
Mystery.cpp
PrintSquarePattern.cpp
TestStringIO.cpp
TestStringOp.cpp
TestFormattedOutput.cpp
TestFormattedInput.cpp
TestArrayInit.cpp
MeanStdArray.cpp
TestForEach.cpp
Test2DArray.cpp
TestCString.cpp
Functions:
 Test Function
 Testing max function
 Test Boolean function
 Test Function default arguments
 Test Function Overloading
 Function to compute the sum of an array
 Types passed by value into Function
 Function to increment each element of an array
 Linear Search an array for the given key
 Test Pass-by-reference parameter
 Test Random Number Generation
 Test rand() distribution (throwing a die)

TestFunction.cpp
TestMaxFunction.cpp
BooleanfunctionTest.cpp
functionDefaultArgument.cpp
FunctionOverloading.cpp
SumArray.cpp
TestPassByValue.cpp
IncrementArray.cpp
LinearSearch.cpp
TestPassByReference.cpp
TestRand.cpp
TestRandomDie.cpp
Test File I/O (Read and write files) TestFileIO.cpp
Example Namespace NamespaceEx.cpp
Struct:
 Testing struct
 Testing struct inside struct
 Testing struct (Person)

TestStruct.cpp
TestStruct1.cpp
TestStructPerson.cpp
Test Inline Function TestInlineFunction.cpp
Test #define macro TestMacro.cpp
Test Ellipses TestEllipses.cpp
Test Scope Resolution Operator TestScopeResolutionOperator.cpp
Command line arguments
 Write command line arguments
 Command line calculator (int): num1 num2 operator

arg_comm.cpp
Arithmetic.cpp
Pointers:
 Test pointer declaration and initialization
 Test reference declaration and initialization
 References vs. Pointers
 Pass-by-value into function
 Pass-by-reference using pointer
 Pass-by-reference using reference

TestPointerInit.cpp
TestReferenceDeclaration.cpp
TestReferenceVsPointer.cpp
TestPassByValue1.cpp
TestPassByPointer.cpp
TestPassByReference1.cpp
Test Function const and non-const parameter FuncationConstParameter.cpp
Passing back return value using reference TestPassByReferenceReturn.cpp
Test passing the result TestPassResultLocal.cpp
Test passing the result TestPassResultNew.cpp
Dynamically allocate global pointers TestDynamicAllocation.cpp
Test dynamic allocation of array TestDynamicArray.cpp
Pointer and Array TestPointerArray.cpp
Passing array in/out function TestArrayPassing.cpp
Passing array in/out function using pointer TestArrayPassingPointer.cpp
Test sizeof array TestSizeofArray.cpp
Lagrange Interpolation: \begin{align} (x_{0}, y_{0}), ..., (x_{k}, y_{k}) \end{align} \begin{align} L(x) = \sum_{j=0}^{k} \prod_{i = 0, i\neq j}^{k} y_{j}\frac{x - x_{i}}{x_{j} - x_{i}} \end{align}
 - arrays
 - dynamic memory
 - dynamic memory and struct








lagrangearr.cpp
lagrangep.cpp
lagrangeps.cpp
Function to compute the sum of a range of an array SumArrayRange.cpp
Testing C-string TestCString1.cpp
Function to count the occurrence of a char in a string FCountChar.cpp
Test Function Pointers TestFunctionPointer.cpp
Search an array for a key using Binary Search BinarySearch.cpp
Sorting an array:
 using Bubble Sort
 using Insertion Sort
 using Selection Sort
 using Merge Sort
 using Merge Sort with bottom-up interactive algorithm
 using Quick Sort
 Bucket Sort (Radix Sort)

BubbleSort.cpp
InsertionSort.cpp
SelectionSort.cpp
MergeSort.cpp
MergeSortInteractive.cpp
QuickSort.cpp
BucketSort.cpp
Testing Simple File IO TestSimpleFileIO.cpp
Testing Binary File IO TestBinaryFileIO.cpp
Strings:
 Strings
 Strings 1
 Guess a secret word

stringcpp.cpp
stringcpp1.cpp
WordGuess.cpp
Numerical methods:
 Calculation of derivative
 Calculation of derivative (central method)
 Calculation of derivative (trick method)
 Calculation of integral (trapezoidal method)
 Calculation of integral (simpson method)
 Calculation of integral (adaptive method)
 Calculation of integral (adaptive simpson method)
 Calculation of integral (gauss-legendre method)
 Calculation of integral (gauss-legendre method break)
 Calculation of integral (montecarlo method)
 Calculation of integral (euler method)
 Root calculation (Newton method)
 Root calculation (Newton + Secant method)
 ODE solution Runge Kutta 4 method

derivada.cpp
derivada1.cpp
derivada2.cpp
integraltrapez.cpp
integralsimpson.cpp
integraladap.cpp
integralsimpsonadap.cpp
integralgaussleg.cpp
integralgausslegbreak.cpp
montecarlo_integ.cpp
euler.cpp
newton_root.cpp
newtondernum_root.cpp
rk4.cpp
Matrices:
 Dynamically Allocate Memory for 2D Array (*)
 Dynamically Allocate Memory for 2D Array (**)
 Dynamically Allocate Memory for 3D Array
 Matrix operations (pointers)
 Image smoothing (pointers)
 Image Histogram (pointers)
 Matrix operations (vector)

array2dp.cpp
array2dpp.cpp
array3dppp.cpp
operac_matric.cpp
suavizado.cpp
histo.cpp
matrix_vector.cpp
Pi calculation:
 Liu-Hui Method
 Liebniz Method

pi_Liu_Hui_meth.cpp
pi_Liebniz_meth.cpp
Recursion, backtracking:
 GCD
 Change base
 Factorial
 Tower of Hanoi
 Branch and Bound
 Knight's tour
 Eight queens
 Sudoku

gcd.cpp
cambiabase.cpp
factorial.cpp
thanoi.cpp
b_b.cpp
knight.cpp
reinas.cpp
sudoku.cpp, Example sudoku