The Whole File:- Sample C++

  • average.C
  • mult.C (multiplication using addition)
  • fastmult.C (better algorithm for multiplication)
  • more.C (count number of characters and lines in a file)
  • merge.C (merge sort)
  • grade.C
  • grade2.C
  • gcd.C (Euclid’s algorithm)
  • fib.C (Fibonacci numbers)
  • fact.C (factorial)
  • exp.C (exponentiation using multiplication)
  • commute.C (weird behavior from C++ compiler)
  • cin.C (more weird C++)
  • temp.C (convert temperatures)
  • sqrt.C (compute square roots using Newton’s method)
  • sphere.C (compute distance between cities)
  • prime.C (check if a number is prime)
  • prime2.C (faster but probabilistic way)
  • prime3.C (avoid stupid C++ behavior in case of overflow)
  • pp.C (understanding call-by-value and call-by-reference)
  • pp2.C (evaluating expressions with side-effects)
  • ref.C (example of pass-by-reference)
  • oddeven.C (lots of functions)
  • void.C (converting value-returning functions to void functions)
  • side.C (bad style, side-effects, value-returning)
  • sc.C (understanding scope)
  • life.C (understanding life time and scope)
  • object.C (understanding the concept of objects)
Advertisements