LightOJ

[Solved] 1202 – Bishops of LightOJ

Here is LightOJ Main Problem There is an Infinite chessboard. Two bishops are there. (Bishop means the chess piece that moves diagonally). Now you are given the position of the two bishops. You have to find the minimum chess moves to take one to another. With a chess move, a bishop can be moved to…

Wordpress

WP Post Views Count without plugin

Today i am going to share how to add post views counting system on wordpress without any plugin. First, copy this code of php function to yours THEME functions.php file. Basically /wp-content/themes/YOUR-THEME/functions.php <? function getPostViews($postID){ $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); return “0”; } return $count; }…

C++

How To Access private member variables of a class without using its public member functions ? Answerred Using C++

Today i am going to tell you how to access private member variables of a class without using its public function. Method 1:  Using friend function. Consider the following example:- #include<iostream> using namespace std; class A { int a; friend void seta(A &ob,int x); friend int geta(A &ob); }; void seta(A &ob,int x) { ob.a=x;…