The Basic Operators in C++

Now we know what are variables and constants, Also we know about getting user input in C++. So now lets see how do we operate on these variables and constants. There are many operators in C++. In this post we will understand them one by one. So lets begin ..

Assignment Operator ( = )

The assignment operator assigns the value on its right hand side to the element on its left hand side. Remember that the assignment operation always takes place from right to left. In simple terms, right side is stored in the left side.

For example:

Arithmetic Operators ( +, -, *, /, % )

Addition (+), Subtraction (-), Multiplication (*), Division (/), Modulo (%)

The first four operators are the common ones. Only the Modulo operator might be new for you guys. The Modulo operator simply returns the remainder.

For example:

Compound Assignment ( +=, -=, *=, /= )

Expression Equivalent Expression
Variable Operator= Value Variable = Variable Operator Value
A += 2 A = A + 2
A -= 2 A = A – 2
A *= 2 A = A * 2
A /= 2 A = A / 2

Increment and Decrement Operator

Increment operator (i plus plus) is similar to i+=1 and i=i+1. While Decrement operator (i minus minus) is similar to (i-=1) and i=i-1.

Increment Decrement
i+=1 i-=1
i=i+1 i=i-1

But there are two types of increment and decrement operators. Namely pre and post. So in total there are 4 sets. Pre Increment(++i), Post Increment, Pre Decrement, Post Decrement.

If you are using these operators as a single statement then there is no problem. For example:

If you are about to ‘display’ or ‘assign’ these operators then pre and post comes into picture. For example :

In the above example, you can see i was equal to 1. Then we are storing ++i inside j. Where ++i means pre increment the value of i. So value of i is first increased by 1. Now i becomes 2. And this value is now stored in j. So final values are i is 2 and j is 2.

In the above example, you can see i was equal to 1. Then we are storing i++ inside j. Where i++ means post increment the value of i. So value of i is first stored inside j. So 1 is stored inside j. Now after storing, value of i is increased by 1. Now i becomes 2. So final values are i is 2 and j is 1.

In the similar way you can co-relate the pre and post decrement operators.

Relational Operators ( ==, !=, >, <, >=, <= )

The relational operators help us to relate the value on the right hand side with the value on the left hand side.

== Equal to
!= Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to

Note : (==) operator is not the same as (=) operator. Lets see with the help of an example.

a = 1; // this means that we are storing value 1 inside variable a
a == 1; // this means that we are checking whether a is equal to 1 ?

a==1 will either return true or false value. If the value of a is 1 then a==1 will return TRUE value. If the value of a is not 1 then a==1 will return FALSE value. So it is mostly used in conditional statements such as if (a==1) { do this; } 

  • Similarly, (!=) is opposite of (==) operator. Example, (a!=1) will check whether a is not equal to 1 ? 
  • (>) operator.  For example, (a>1) will check whether a is greater than 1 ?
  • (<) operator. For example, (a<1) will check whether a is less than 1 ?
  • (>=) operator. For example, (a>=1) will check whether a is greater than or equal to 1 ?
  • (<=) operator. For example, (a<=1) will check whether a is less than or equal to 1 ?

You can notice that in all the above examples we are asking a question to check the condition is true or false. So we can conclude that relational operators will always return either a true value or a false value. Also remember (==) is not the same as (=) operator.

Examples with numeric constants :

Lets see more examples with variables and constants, Consider a = 10.

Logical Operators (  !, &&, || )

The operator (!) acts as Logical NOT. It changes true to false and false to true. Lets understand this operator will the help of examples given below.

The operator (&&) acts as Logical AND. Output is true when both inputs are True.

A B A && B

The operator (||) acts as Logical OR. Output is false when both inputs are False.

A B A && B

Lets see some examples :

Difference between normal AND (&) and short circuit AND (&&)

First understand that AND operation returns TRUE value when both conditions are TRUE. Normal AND (&) checks both the conditions even if the first condition turns out to be FALSE. But short-circuit AND (&&) is smart. If it finds the first condition to be FALSE then it does not bother to check the next condition. It rounds up the final answer to be FALSE.

Difference between normal OR (|) and short circuit OR (||)

First understand that OR operation returns FALSE value when both conditions are FALSE. Normal OR (|) checks both the conditions even if the first conditions turns out to be TRUE. But short-circuit OR (||) is smart. If it find the first condition to be TRUE then it does not bother to check the next condition. It rounds up the final answer to be TRUE.

In the next tutorial we will see the conditional operator.

How to protect your Facebook Account

Facebook has become a part of everyone’s life. Almost every individual is there on facebook today. But very few people understand that the most important part of facebook account is security. In this post I will share some tips on how to protect your facebook account from getting hacked. This post will help you to increase the over all security of your facebook account. And i hope you enjoy this post. So lets begin ..



#1. Enable HTTPS on your Profile

First let me tell you the difference between HTTPS and HTTP. Normally you visit your facebook account or any other website on the HTTP (Hyper Text Transfer Protocol). While HTTPS means Hyper Text Transfer Protocol Secure.

HTTP URL’s begin with “http://” and uses the port 80 by default while HTTPS URL’s begin with “https://” and uses the port 443 by default.

HTTP is very much insecure and is prone to eaves dropping (in simple terms prone to man-in-the-middle). So if you are transferring a sensitive information using HTTP from local computer to remote computer or vice versa then your information is prone to leak. But HTTPS is designed in such a manner that it can withstand all such man-in-the-middle attacks.

Now to enable HTTPS on facebook, just follow these steps :

  1. Go to Facebook Account Settings.
  2. Click on Security Tab.
  3. Select Secure Browsing.
  4. Tick the “Browse Facebook on a secure connection (https) when possible‘ option.
  5. click save changes.

#2 Third Party Apps Permissions

Most facebook users use facebook apps. But have you noticed a thing that you have to grant permission to the apps before you can use them. But very few are aware of the fact that these permissions endure even after we stop using that particular app. And this can be really a huge risk for your facebook account. These permitted third party apps can access all your personal information and use it the way they want. They can’t be trusted. Even the fact that you have to Disable HTTPS for using a Facebook App is enough to make you realize how dangerous these apps can be. So I recommend you to remove the granted permissions from the Apps which you no longer use.

#3 Mobile Notifications

There is a feature on facebook which allows you to receive text notifications whenever your facebook account is accessed from a unknown device. For eg. When you log in from your computer, facebook will ask you to enter a name for your device. Just enter the name and log in. Then facebook will send a text notification to your mobile stating that X device has logged in to your account at xyz time. The next time you log in from the same computer, facebook wont send a text notification. Because facebook as already added your device as the ‘known’ device. But if some other device tries to log into your account, facebook will immediately send a text notification to your mobile stating that a unknown device has logged into your account at xyz time. 

To enable facebook log in notifications just follow these steps :

  1. Go to Facebook Account Settings.
  2. Click on Security Tab.
  3. Select Login Notifications.
  4. Tick Text Message/Push Notification.
  5. Click save changes.

#4 Email Address

I recommend you guys to have two separate email addresses, one which can be used with facebook while other for your secure accounts. Like the one which you use with your Paypal account or for any other sensitive information should not be used with facebook. Because just in case if your facebook account gets compromised, then even the email address which you use with facebook possess a high risk of getting hacked.

#5 Security Question

You can set a Facebook account security question to increase the over all security of your facebook account. The answer to this security question will just remain with you. Just in case if a hacker tried to gain access to your account, he will have to answer this security question. So i recommend you to never to share the answer to your security question with anyone – i mean absolutely no-one but you yourself must know the answer.

If you want to set up a security question just click here.

Note that, Once you set up a security question and the answer then after you cant change it. I don’t know if they (the facebook) allow us to change our security question in future or not. But presently we cannot change our security question once we set it up. So we have got only one chance to set it right.

So that’s why i told you not to share your security answer with anyone. Because you cant change your security question later. So keep it safe with you. Do not share it.

#6 Change Password Occasionally

Changing your facebook password occasionally helps you to strengthen the health of your password. This will incredibly minimize the chances of getting your account hacked. Trust me. Keep changing passwords regularly. In this way you can be sure that you are secure.

And if you loved this article. Please do subscribe to the blog feed. Book mark And give us a visit when you are free. Thanks. Take care. 🙂

Why to click safely remove hardware icon on USB drives

When you connect a USB drive to a Computer, it gains the freedom to read/write data on the USB drive. The data which is being written on your USB drive from your Computer is not directly stored on the USB drive. But caching process occurs over here. During caching the data is not directly written on your USB drive. Instead it is stored on a temporary memory (RAM).

And if you are about to yank the USB drive directly without clicking the safely remove option. Then you may end up with a corrupted file on your USB drive. This is because the file was not completely transferred, instead was being cached to your computers memory. This is why users are recommended to click ‘Safely remove hardware icon’ on their windows computer.

However, Windows automatically disables the caching process on USB drives when read / write operations are in idle state. So you don’t have to click the safely remove option if you are not writing or reading anything on the USB drive.

The Safely remove option is there for extra security. To make sure that you wont lose any valuable data. Hence preventing you from destroying your own data.

Yanking out the USB drive directly has rarely caused any serious issues. But there are cases when the USB drive becomes corrupt and unusable. So its always recommended to click safely remove option. Its there for your own good.

Counter-strike run time error – Abnormal program termination

Run time error messages are fairly common problem in computers.

They are basically a way to warn you that there is something wrong with the system.

This can occur if you have installed a program which has higher requirements than what your system can handle. Or this can even occur due to some missing program file.

There might be some program files which were not successfully installed and thus not functioning properly.

You can see the error message dialog box in the image given below. If you are having the same problem, then this post can help you.

How to solve it ?

In this post i am going to tell you how to solve the error which occurs during execution of counter strike game. The run time error which occurred to me while playing counter strike is shown in the image above. Lets see how do we solve it.

  1. Open Task Manager (right click on the task bar and click on Task Manage)
  2. Go to Processes Tab.
  3. Find the process named ‘Explorer‘.
  4. Right click on it and click ‘End Process’.
  5. Note: Now your desktop icons might disappear. Don’t Panic. Go to next step.
  6. Go to Applications Tab.
  7. Click on ‘New Task’
  8. Type: Explorer.exe and press Enter.
  9. You are done.

Now try to run your program (counter strike in this case).  Hopefully it will work now. If the run time error problem persists then try one of the following solutions :

  1. Re-install your program (counter strike in this case)
  2. Or Re-install Microsoft Visual C++ Run time Library.

5 Computer tips about Parental Surveillance

When i was a kid, i learned couple of things to hide content on my computer from my parents. Although in this post I will talk of ways to avoid parental surveillance on your computer, This post is actually meant for parents. This post would help you to know how your kids might use the computer in a way which you didn’t approve of.

#1 Web Browser Privacy Mode

Nowadays every browser has this feature, the privacy mode. In this mode any activity on the browser will not be stored in the form of history. Your browser wont store any browsing data in this mode. As soon as your browser is closed, every single piece of browsing data is deleted. Hence it cannot be retrieved.

Privacy mode doesn’t even store any permanent form of cookies. So even if your parents visit the site which you have logged into previously, they won’t be directly logged into your account. Instead they will be asked to insert the password. For example, if you are using facebook in privacy mode and close the window without logging out. Then your parents cannot access your account on visiting facebook dot com. They will be instead taken to log on page.

Note: In Google Chrome browser, the privacy mode is named as Incognito Mode. While in Mozilla Firefox there is an option saying “Start Private Browsing”.

Tip for parents : Certain High End Routers with built in parental controls can help you to monitor all the activity even if your children use privacy mode.

#2 Proxy Servers

Proxy server act as intermediate between your computer and the remote computer. If you are banned from a certain site and want to access that particular site, you can use a proxy. Suppose you visit a proxy and request for facebook dot com. Then facebook dot com will be loaded on that server first. And then it will be loaded back to you.

So if your parents have blocked a certain site. You can just use a proxy server to access that particular site.

Note that proxies should not be trusted. They can be really dangerous. For example, if you are accessing your facebook account through a proxy then basically you are providing your password to that proxy server. Because all the requests will be first loaded on the proxy server and then sent to the remote computer.

Tip for parents : Well blocking proxy servers can be tricky. You can’t determine which proxy server your kid is using especially if hes switching proxies daily. But you can track which all sites he has been visiting and then figure out what each site does. If its a proxy then use your parental control software to block that specific site. That’s it.

#3 User Account Restrictions

If your parents have a administrative account on your computer and have set your account to limited mode so that you wont be able to install any undesired software on your computer. Then you can use certain boot software to reset the password like Linux Live CD’s, etc or just re-install windows.

Tip for parents : You can set a BIOS password and disable boot from CD option in the BIOS. That would help to stop your kid from doing any undesirable changes to your computer.

Note that : Removing and Reinserting the CMOS battery from the computer will Reset BIOS as well as BIOS password.

#4 Our Secret Desktop

Your parents might know about the CTRL+ALT thing (which has probably saved millions of lives lol). But they don’t know that you are using a software which helps you to hide open applications. And you can just bring ’em back on screen with certain key combinations.

Tip for parents : Check the list of installed programs occasionally and make sure you know what each program does.

#5 File Encryption

File encryption simply means to make or transform a particular information in a format which is unreadable. This is only readable to those who possess the key. The key can be a password. On entering the key, decryption(un-encryption) takes place and the information is converted to readable format.

You can use a third party program to encrypt your required file. And this file will be only accessible on entering the password. Anyone who doesn’t have the password cannot access the file. Well they can, if they have a super computer to check all the possible password combinations (also called as brute forcing).

Tip for parents : If you suspect that your kid is using encrypted files then you can ask them to de-crypt it. Or you can just use a Key logger which will log all the key strokes on your keyboard, thus recording everything which is being typed on the computer by your kid.

I hope these tips were helpful to you. 🙂 Thanks for reading.

SMS limit has been uplifted to 20 sms per day

The Indian Government had put limits on Mobile SMS and made it to 5 SMS per day. You can read more about this on my previous article over here: [ SMS cut down to 5 SMS per day in India – TRAI Rule ]. It was reported that this rule was here to stay for the next 15 days. “We have banned bulk SMS-es and MMS-es for 15 days,” Union Home Secretary RK Singh had said last week.

Today the government has decided to increase the limit to 20 SMS per day. This limit has been increased with immediate effect. Note that, only the limit has been increased to 20 sms per day while the SMS ban is still in effect for the 15 days period.

Additional Info : Along with the SMS ban, Hundreds of websites have been banned by the government in the last week which were involved in spreading rumors and baseless messages.

Why is my Task Manager Disabled?

If you are not able to access your windows task manager by shortcut keys, you may try right clicking on your task-bar. It will display a context menu with the option of task manager in grey text. Which simply means its not clickable and is disabled.

This might happen if your computer user account is set to limited. If you are logged in as administrator and still not able to access task manager then your computer might be infected with spyware. This has changed some values in your system registry, thus disabling the task manager.

Now to enable the task manager all you have to do is access registry editor (regedit) and navigate to the following key (folder) :


In the above image, you can see we have navigated to the System folder, wherein we can find DisableTaskMgr value. Just double click on it to change the value.  The value 0 means enable task manager while the value 1 means disable task manager. You can change the value and save it. Or you might as well delete the value. To delete the value, just click on DisableTaskMgr value and hit delete button.

I have been reported that some users are not having the ‘System’ folder in the specified directory. So here’s an alternative method for them. What we have to do is make use of the Group Policy Editor (gpedit.msc). This alternative method is only for Windows XP Users.

  1. Open start menu > run > type gpedit.msc > hit enter.
  2. Goto User configuration > Administrative Templates > System > Ctrl+Alt+Delete options.
  3. In the right panel, make sure that ‘Remove Task Manager’ is set to ‘disabled’ or ‘not configured’.
  4. If it is enabled. Then click on properties. And just click disable.
  5. Now your task manager must be back.

I hope you loved the post. If you have any doubt, feel free to comment below. Thanks.