C++ Source Code

Odd/Even determination for a given number.
This is a very basic program that shows, how to determine whether the given
number is even or odd in C++ language. The program simply prompts the user for a number, and displays
whether the given number is odd or even.
eg:

eg:
The program uses a basic mathematical property, that every even number is completely divisible
by 2. If a number is not completely divisible by 2,it is an odd number.
Here we've used the modulo operator (%) to find the remainder after dividing the number by 2.
eg:
It's a very simple program, but using the modulo(%) trick, is very helpful in various, not so obvious problems.

Program in C++ to calculate the series upto the N'th fibonacci number.
The program demonstrates a fast and efficient implementation(for small purposes),
for calculating fibonacci series.

The program also demonstrates the use of memoization technique to calculate fibonacci series
in almost no time. Memoization helps reduce redundant computation by storing the previously calculated
results in memory temporarily,so that they can be used later to speed up the total computation.
This program does not use recursion.

In this example we've used a "long long int" type array to store the fibonacci series.You can get fibonacci
series correct upto 92'nd fibonacci number,after which the overflow occurs as the size of the numbers
exceed the limit which "long long int" data type can hold can hold.

The program demonstrates the implementation of complex number class and performs simple arithmetic operation using operator overloading.The program supports only floating point value for demonstration purposes.The program also uses the math library for power function;therefore make sure to
link it as well while compiling.
The command to compile this file would be of the form:
g++ complex.cpp -o complex -lm
where complex.cpp is the name of the source file.
Since we are using math library in the program we need to explicitly link it using the -l flag at the command line.

Implements various string operations using object orientation and
operator overloading.
String class is created to implement these functions for the string operations.
The program uses the standard C++ library for these functions.The purpose of this
program is just to demonstrate operator overloading to perform these string operations.
Following is the list of the operators overloaded and their effects on the string
objects:
1) == : String copy
2) = : String compare
3) + : String concatenation
4) << : Displaying the string from my_string object
5) >> : Reversing the string
6) / : Finding substring

The program shows an implementation of a student database using the STL library functions.
The student class keeps track of all of a student's personal data.
For each new student, a new student object is instantiated and vectors are used to store them.
Vectors are just like arrays with contiguous memory locations and data can be accessed efficiently as in arrays.
However unlike arrays,vectors can dynamically expand in size which is automatically handeled by the storage container class.
The database program here, does not perform input validation. All inputs are assumed valid.