C++ Programming Code Examples
C++ > Games Code Examples
Maze
C Sum of the Main and Opposite Diagonal -
C Program code finds the sum of the main & opposite diagonal elements of a MxN Matrix. The program accepts an MxN matrix. Then adds main diagonal of matrix as well as the
C++ Program Codes Swaps Two Numbers -
The first program uses temporary variable to swap numbers, whereas the second program doesn't use temporary variables. To perform 'swapping' in above example, three variables
Returns a String representation of Integer -
Converting an integer to a string with a fixed width. If the width is too small, the minimum width is assumed. Generate digit characters in reverse order. Shift the string to the right
C++ Sample How to Use If Else Statement -
In Programming, The "if statement" by itself will execute a single statement, or a group of statements, when the expression following if evaluates to "true". It does nothing when the
Print to Binary Numbers Pyramid Patterns -
C code binary numbers pyramid pattern. First and Third Line is Starting with 1, While 2nd & 4th Line is starting with 0, So for First & Third Line count will be 1 and for even Line Number
Read an Array and Search for an Element -
C code accept an array of N elements and a key to search. If the search is successful, it displays "Successful Search". Otherwise, a message "UNSUCCESSFUL SEARCH" is...
Using Virtual Functions in C++ Language -
See in this case the output is Woof, which is what we expect. What happens in this case? Since we marked the function animalSound() as virtual, the call to the function is resolved
Find the Sum of All Nodes in a Binary Tree -
Program code to find the sum of all nodes in a binary tree. Structure to create the binary tree. Inserting elements in the binary tree. C Code to dynamically create new nodes. Code