C++ Programming Code Examples
C++ > Code Snippets Code Examples
A generic stack that holds two values.
Program Check If a Number is Palindrome -
If a number remains same, even if we reverse its digits then number is Palindrome number. So 10201 is a Palindrome Number because it remains same if we reverse its digits. C codes
Find Sum of First & Last digit of a number -
C program to input a number and find sum of first & last digit of the number using for loop. Input a number from user and store it in some variable say j. Find last digit of given number
C Language Break Statements Switch Case -
Break Statements are useful when you want your program-flow to come out of the switch body. Whenever break is encountered in the switch body, the control comes out of switch
Determine if a given Matrix is a Sparse or -
C Program determines the given matrix is a sparse matrix. Sparse matrix is a matrix with the majority of its elements equal to zero. Accept matrix and checks whether the given
Check the Alphabet is Vowel or Consonant -
C program takes the Character value as input and checks whether that character is a vowel or consonant using if-else statement. Since a user allowed to enter an alphabet Lowercase
User-Defined Functions in C++ Language -
We have already seen user-defined function, the example we have given at the beginning of this tutorial is an example of user-defined function. The functions that we declare and
C Evaluate the Given Polynomial Equation -
C program to evaluate a given polynomial by reading its coefficients in an array. Formula is P(x)=AnXn + An-1Xn-1 + An-2Xn-2+... +A1X + A0. The 'polynomial' can be written as: P(x) =
C Calculate Difference Between Two Time -
C programming code to calculate difference between two time periods. In this program, user is asked to enter two time periods and these two periods are stored in structure...