C++ Programming Examples

Const member functions C++ example

Constant member functions in C++ class are declared using const keyword, for example, int fun() const. A constant member function of a class cannot modify any non-constant data members of the class and also cannot call non constant member functions. For example, in below C++ program, function getProductId()is constant and hence, if try to modify […]

Check prime number in C++

Check prime number in C++ – Program to check if a number is a prime number or not in C++  with example. What is Prime Number? Prime number is number which is divided by 1 or itself and cannot be divided by other numbers. For example, 2,3,5,7,11 etc. are prime numbers. Important points: Value less […]

Scroll to top