# C++ Programming Code Examples

## C++ > Beginners Lab Assignments Code Examples

### Program for Virtual Function:

C++ Table Show the legal values for Mode -
Open a text file for reading. Create a text file for writing. Append to a text file and Open a binary file for reading. Create a binary file for writing. Append to a binary file. Open a text

C Specifies the buffer that Stream will use -
Send to a buffered stream to filep1 and send to an unbuffered stream to filep2. Set buf to null to turn off buffering. The buffer must be BUFSIZ characters long. BUFSIZ is defined in

C Codes Surface Area & Volume of a Cube -
The formula used to find the surface area and volume of the cube is surface_area = 6 * (a*a) and volume = a*a*a. Library Function is used in header file to compute Math Functions. We

Daylight saving time indicator in C coding -
C Program the tm structure contains the following members. Seconds, 0-60, minutes, 0-59, hours, 0-23, day of the month, 1-31, Jan, 0-11, years from 1900, days since Sunday...

C Program Sample Implement Bitonic Sort -
Compare and swap based on dir, sorts bitonic sequence in ascending order dir=1, otherwise in descending order. Code generates "Bitonic Sequence" by Sorting Recursively two halves

Program Print Fibonacci Series in a Range -
Fibonacci series is a series of numbers where the current number is the sum of previous 2 terms. For Example: 0, 1, 1, 2, 3, 5, 8, 13, 21,... Here c is the current term, b is the n-1th term

Using Manipulators to Format I/O In C++ -
'boolalpha' turns on boolapha flag. 'dec' turns on dec flag. 'endl' output a newline character & flush the 'stream'. ends output a null. fixed Turns on fixed flag. flush Flush a stream. hex

Calculating Arithmetic Mean of Numbers -
You enter number size then ask to enter the numbers of that size. To calculate arithmetic 'mean of all numbers', first perform addition of all the numbers, and then make a variable