# C++ Programming Code Examples

## C++ > Mathematics Code Examples

### C++ Program to Display Factors of a Number

C++ Language Samples Separate Chaining -
Internal method to test if a positive number is prime. Not an efficient algorithm and Internal method to return a 'prime number' at least as large as n. Assumes "n > 0". Insert item x into

Reads Input until Enters a Positive Integer -
C Language program to read input until user enters a positive integer. Positive Numbers 1, 2, 3... are known as natural numbers. C code below takes a positive integer (let say n) as...

Check Vowel or Consonant use switch case -
Program to check Vowel or Consonant using switch-case statement. I already explained in sample to print number of days in months, if switch case contains same action for multiple

C++ Implements Queue using Linked List -
C++ program, "using iteration", implements the list of elements removed from the queue in first in first out mode using a Linked list. A linked list is an ordered set of data elements,

C Finds a Year is Leap or not is a bit Tricky -
C Program Code we generally assume that if a year number is evenly divisible by 4 is leap year. But it is not the only case. A year is a leap year if it is evenly divisible by 100. If it is

C Finds All Roots of A Quadratic Equation -
Step by step descriptive logic to find roots of Quadratic Equation using Switch Case. Input coefficients of quadratic equation. Store it in some variable say a, b, c. Find discriminant of

Diameter Circumference & Area of Circle -
C program code input radius of a circle from user and find diameter, circumference and area of the circle. How to calculate diameter, circumference and area of a circle whose...

C++ Programming Copy Strings & Display -
To copy string in C++ language, enter a string to "make copy" to another variable say str2 of same type using Function strcpy() and display the copied string on the screen as shown here