C++ program to check if a sentence is a Palindrome or not

Wikipedia defines Palindrome as, “A palindrome is a word, phrase, number or other sequence of units that can be read the same way in either direction (the adjustment of punctuation and spaces between words is generally permitted).”

There are two different kinds of Palindrome. One is on a character by character basis while the other is on a word by word basis. Examples of these two type of palindromes are “Was it a rat I saw?” and “Fall leaves after leaves fall” respectively.

I have written a program in C++ which can check a word, phrase or sentence if it is a palindrome on a character by character basis. It is capable of handling complex sentences with punctuation marks such as “Dammit, I’m mad!”.

The logic I used in this program is almost self evident but still I have written a short explanation of how it works in the following lines. Continue reading C++ program to check if a sentence is a Palindrome or not

How to select a vertical block of text in Microsoft Word 2007

I was reading a book on Microsoft office Word 2007 when I came across this tip. It was a new piece of information for me so I thought I should share it with you all my friends. The tip is that if you click and drag with your left mouse button while holding down the Alt key on your keyboard, then you can select a vertical block of text in your document. For more explanation, please see the following screenshot.

Vertical Text Selection in MS Word 2007
Vertical Text Selection in MS Word 2007

Isn’t it amazing? However, a little bit of care is required in making such a selection because if you simply Alt+Click a word in MS Word then it launches the Research task pane instead of starting a selection. So, follow the following steps in a sequence to accomplish this task without any hassle:

  1. Press and hold down the Alt key on your keyboard.
  2. Left click in your document where you want the upper left corner of your selection and hold down the mouse button.
  3. Drag your mouse to the point where you want the lower right corner of your selection.
  4. Release the mouse button and then release the Alt key.

You can, however, start the selection from any of the four possible corners and end it on the opposite one.

Generate Random Text in Microsoft Office Word 2003

Sometimes when you want to experiment with some features of Microsoft Office Word while reading a book or tutorial, you need a sufficient amount of text on which you can apply these techniques and observe there effects. Fortunately word 2003 has a built in feature to provide you a good amount of text in a few seconds. It is called the Random Text Generator. To try it, just:

  1. Open a new word document
  2. Type in =rand()
  3. Press Enter

It will generate three paragraphs of text having a sentence repeated five times in each of them. That sentence is:

“The quick brown fox jumps over the lazy dog.”

Now let’s get some more control over the number of paragraphs and sentences generated.
Try typing =rand(2,7) and pressing Enter.
It generates 2 paragraphs of text having the same sentence repeated 7 times in each of them.

So, In general, we can say that when we type =rand(x,y) in Microsoft Office Word 2003 and press Enter, we get x paragraphs of random text and each of them contains y number of sentences i. e. =rand(paragraphs, sentences).

In case you find any thing not working properly for you according to these instructions then, please don’t hesitate to comment and ask me about it.