4 Big Mistakes to Avoid When Learning Programming

Here are the 4 big mistakes which you have to avoid while learning programming. 1) Fear and self doubt: I have put this in the first place because it's the...

C++ inheritance

lets have a look at the below example: // C++ inheritance #include<iostream> using namespace std;   class Point { protected:     int x,y; public:     Point(int ,int);     void display(void); };   Point::Point(int a,int b) {     x=a;     y=b; }   void Point::display(void) {      cout<<"point = "; }   class Circle : public Point {     double radius; public:     Circle(int ,int ,double );     void display(void); };   Circle::Circle(int a,int b,double c):Point(a,b) {     radius = c; }   void Circle :: display(void) {     Point::display();     cout<<" and radius = "<<radius; }   int main(void) {     Circle c(3,4,2.5);     c.display();     cout<<endl;     return 0; } In the above we took a class “point” in which we defined its attributes (its data members and member functions), then we inherited(derived) the...

Creating a Timer in C++

Creating a timer means creating a digital watch, simply. A Digital watch is the one that counts and shows the time in form of digits, In our daily bases software Programming...

Program for Palindrome in C++

Palindrome is a word that reads the same forward or backward. Now how can we check a string that it is a palindrome or not? We can do it by using...

Finding Length of a string in C++

Sometimes we have strings entered by the user and we need to find out the length of a string or size of that length of a string to be used further....

Assignment Operator Overloading in C++

After we do assignment operator overloading, we will then be able to assign two variables of our self-defined datatypes. Lets have a look at the below example: // Operator overloading in C++ //assignment operator overloading #include<iostream> using namespace std;   class Employee { private:     int idNum;     double salary; public:     Employee ( ) {         idNum = 0, salary = 0.0;     }       void setValues (int a, int b);     void operator= (Employee&emp );   };   void Employee::setValues ( int idN , int sal ) {       salary = sal; idNum = idN;   }   void Employee::operator = (Employee&emp)  // Assignment operator function {     salary = emp.salary; }   int main ( ) {       Employee emp1;     emp1.setValues(10,33);     Employee emp2;     emp2 = emp1;        // emp2 is calling object using assignment operator   } Now lets explain this...

Generation of Prime Numbers in C++

Implementing the logic of Prime Numbers into our c++ code, we need simple for loops and conditional statements. This is very easy to implement and print Prime Numbers upto 1000. Lets...

Generating Prime Numbers in C++

Now implementing this logic of Prime Numbers into our c++ code, we need simple for loops and conditional statements. This is very easy to implement and print Prime Numbers upto 1000....

Prime Numbers Generation in C++

Now implementing this logic of Prime Numbers into our c++ code, we need simple for loops and conditional statements. This is very easy to implement and print Prime Numbers upto 1000....

Array Elements summation in C++

Array elements summation is a famous task for programmers, as We can take the array elements from the user also, Similarly we can compute sum of element of array also. Here...