Tuesday, May 31, 2011

C,C++ COMMON ESCAPE SEQUENCES

Escape Sequence                        Function
 
\a                                                  Bell (beep)

\b                                                  Backspace

\f                                                   Formfeed

\n                                                  Newline

\r                                                   Return

\t                                                   Tab

\\                                                   Backlash

\'                                                   Single quotation mark

\"                                                   Double Quotation marks

\xdd                                             Hexadecimal notation

Monday, May 30, 2011

HOW TO SEE FILE EXTENTION WINDOWS XP

A file name extension is a set of characters added to the end of a file name that determine which program should open it. Follow these steps to choose whether Windows displays these file extensions.

1. Open My Computer

2. Click on Tools and than click on folder option


3. Click on View tab

4. Now under Advanced settings scroll down and uncheck "Hide extentions for known file type"



5. Click on Ok

Now you will be able to see extention of all types of file

Sunday, May 29, 2011

HIT ZARDARI GAME

Try to win the game :)

THE THREE OOP PRINCIPLES

All the object-oriented programming languages provides mechanisms that help you implement the object-oriented model. They are encapsulation, inheritance, and polymorphism. Lets discuss all these in detail.

Encapsulation

Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. One way to think about encapsulation is as a protective rapper that prevent the code and data from being arbitrarily accessed by other code defined outside the rapper. Access to the code and data inside the rapper is tightly controlled through a well defined interface. To relate this to this real world, consider the automatic transmission on an automobile. It encapsulate hundreds of bits of information about your engine, such as how much your are accelerating, the pitch of the surface you are on, and the position of the shift lever. You, as the user, have only one method of affecting this complex encapsulation. By moving the gear-shift lever you cant affect the transmission by using the turn signal or windshield wipers, for example thus, the gear shift lever is a well defined (Indeed, unique) interface to the transmission. Further, what occurs  inside the transmission doesn't affect  object outside the transmission. For example, shifting gear doesn't turn on the headlights! Because an automatic transmission is encapsulated, dozen of car manufacturers can implement one in any way they please. However, from the driver's point of view, they all work the same. This same idea can be applied to programming. The power of encapsulation is that everyone knows how to access it and thus can use it regardless of the implementation details-and without fear of unexpected side effects.


Inheritance

Inheritance is the process by which one object acquires the properties of another object. This is important because it support the concept of hierarchical classification.

As mentioned earlier, most knowledge is made manageable by hierarchical (that is, top-down) classifications. For example, a Golden Retriever in part of the classification dog, which in turns in part of the mammal class, which is under the larger class animal.

Without the use of hierarchies, each object would need to define all of its characteristics explicitly. However by use of inheritance, an object need only define those qualities that makes it unique within it's class. It can inherit its general attributes from its parent. Thus it is the inheritance mechanism that makes it possible for one object to be a specific instance of a more general case.


Inheritance interacts with encapsulation as well. If a given class encapsulates some attributes, then any subclass will have the same attributes plus any that it adds as part of its specialization.




This is a key concept which lets object-oriented programs grow in complexity linearly rather than geometrically. A new subclass inherits all of the attributes of all of its ancestors. It does not have unpredictable interactions with the majority of the rest of the code in the system.


Polymorphism

Polymorphism (From the Greek, meaning " many forms") is a feature that allows one interface to be used for a general class of actions. The specified action is determined by the exact nature of the situation. Consider a stack ( which is a last-in, first-out list).

You might have a program that requires three types of stack. One stack is used for integer values, one for floating-point values, and one for characters. The algorithm that implement each stack is the same, even though the data being stored is differs. In a non object-oriented language, you would be require to create three different set using different names. However, because of polymorphism, in Java you can specify a general set of stack routine that all share the same names.

More generally, the concept of polymorphism is often expressed by the phrase "one interface, multiple method". This means that it is possible to design a generic interface to a group of related activities. This helps reduce complexity by allowing the same interface to be used to specify a general class of action.

It is compiler's job to select the specific action (i.e., method) as it applies to each situation. You, as a programmer, do not need to make this selection manually. You need only to remember and utilize the general interface.

Friday, May 27, 2011

WHAT IS JOHARI WINDOW

A healthy interpersonal relationship, specially one on a friendship or intimate level, is marked by a balance of self disclosure (sharing by biographical data, personal ideas, and feelings that are unknown to another person) and feedback ( The verbal and physical respnses to people and their messages) within the relationship.
How can you tell wheather you and another are sharing enough to keep the relationship going ?  the best method is to discuss it. As the basis for the worth while discussion, we suggest the use of Johari Window, named after its two originators, Joe Luft (1970) and Harry Ingham

Johari window is divided into four section or panes



The first quardrant is called the "open" pane of the window because it represents the information about you that both you and your partner knows. It includes information that you have disclosed and the observations about you that your partner has shared with you. If you were preparing a Johari windows that represented your side of your relationship with another person, you would include in the open pane all the item of information about yourself that you would fell free to share with that other person.

The second quadrant is called the "secret" pane. It contain all those things that you know about yourself but that your partner does not know about you. This information may run the gamut from where you keep your pencil, or why you don't eat meat, to those secrets whose revelation threatens you. If you were preparing a Johari window that represent your side of a relationship with another person, you would include in the secretpane all the items of information that you have not shared with that other person.

When you choose to disclose the information with your partner, the information moves into the open pane of the window. If, for example, you had been engaged to be married but on the day of the wedding your fiancee had backed out, this information might be in the secret pane of your window.

But when you disclose this to your friend, it would move into the open part of your johari window with this person. through dissclosure, the secret pane of a window becomes smaller and the open pane is enlarged.

The third quadrant is called the blind pane. this is the place for information that the other person knows about you but about which you are unaware. Most people have blind spots - aspects of their behavior about which they are unaware. For example, Charley may not know that he snores when he sleeps or that he frowns when he is concentrating . Both of these behaviors would be known by someone who has slept in the same room with him or being with him when he attends class lecture. Information moves from the blind are of the window to the open area through feed back from other.

If no one has ever told Charley about these behaviors, or if he has refused to believe it when he has been told about them, this information will be in the blind part of his johari window.

when someone tells Charley about them and he accept the feedback, than the information will move into the open pane of Charley's Johari window with this person. Thus, like disclosure, feedback enlarges the open pane of the Johari Window, but in this case it is the blind pane that becomes smaller.

The fourth quadrant is called the "unknown" pane. It contain information about you that you do not know and neither does your partner. Obviously, you cannot develop a list of this information. So how do we know that it exists ? Well, periodically we "discover" it. If, for instance, you have never tried hang gliding, then neither you nor anyone else can really know weather you would chicken out or follow through, do it well or crash, love every minute of it or be paralyzed by fear.


Saturday, May 14, 2011

PROGRAM TO CONVERT ROMAN NUMERALS INTO NUMBERS

This Program will convert roman numerals into numbers

e.g if The input is IV, the ouput will be 4

This program support roman numerals upto M i.e. 1000

#include<conio.h>
#include<stdio.h>
#include<iostream.h>
main()
{
do
{
clrscr();
char ch[10];
int n[11];
n[0]=0,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=0;
int flag[10];
flag[1]=1,flag[2]=1,flag[3]=1,flag[4]=1,flag[5]=1,flag[6]=1,flag[7]=1,flag[8]=1,flag[9]=1,flag[10]=1,flag[11]=1;
printf("Enter roman characters in Capital : ");
gets(ch);

for(int a=0; a<=9; a++)
{
switch(ch[a])
{
case 'I':

n[a]=1;
break;

case'V':
n[a]=5;
break;

case'X':
n[a]=10;
break;

case'L':
n[a]=50;
break;

case'C':
n[a]=100;
break;

case'D':
n[a]=500;
break;

case'M':
n[a]=1000;
break;
}
}

for(a=0; a<=9; a++)
{
if(n[1]>n[0] && flag[1]!=0)
{
n[1]=(n[1]-n[0]);
    n[0]=0;
    flag[1]=0;
}

else if(n[2]>n[1] && flag[2]!=0)
{
n[2]=(n[2]-n[1]);
    n[1]=0;
    flag[2]=0;
}
else if(n[3]>n[2] && flag[3]!=0)
{
n[3]=(n[3]-n[2]);
    n[2]=0;
    flag[3]=0;
}
else if(n[4]>n[3] && flag[4]!=0)
{
n[4]=(n[4]-n[3]);
    n[3]=0;
    flag[4]=0;
}
else if(n[5]>n[4] && flag[5]!=0)
{
n[5]=(n[5]-n[4]);
    n[4]=0;
    flag[5]=0;
}
else if(n[6]>n[5] && flag[6]!=0)
{
n[6]=(n[6]-n[5]);
    n[5]=0;
    flag[6]=0;
}
else if(n[7]>n[6] && flag[7]!=0)
{
n[7]=(n[7]-n[6]);
    n[6]=0;
    flag[7]=0;
}
else if(n[8]>n[7] && flag[8]!=0)
{
n[8]=(n[8]-n[7]);
    n[7]=0;
    flag[8]=0;
    }
else if(n[9]>n[8] && flag[9]!=0)
{
    n[9]=(n[9]-n[8]);
    n[8]=0;
    flag[9]=0;
}
}
if(n[1]==1)
n[1]=0;
printf("\nThat Roman numeral is equivalent to %d",n[0]+n[1]+n[2]+n[3]+n[4]+n[5]+n[6]+n[7]+n[8]+n[9]+n[10]);
printf("\n\nDo you want to run this program again (y/n) ?");
}
while(getche()!='n');
getche();
}

Tuesday, May 10, 2011

PROGRAM TO CONVERT INTEGER INTO BINARY

#include<conio.h>
#include<stdio.h>
main()
{
do
{
clrscr();
int numb[10];
int flag=9;
int counter=0;
int check[9];
printf("Enter any number ");
scanf("%d",&numb[0]);
for(int a=0; flag>1; a++)
{
if(numb[a]%2==0)
{
check[a]=0;
numb[a+1]=numb[a]/2;
flag=numb[a]/2;
counter++;
}
else if(numb[a]%2==1)
{
check[a]=1;
numb[a+1]=numb[a]/2;
flag=numb[a]/2;
counter++;
}
}
counter--;
printf("\n1");
for(a=counter; a>=0; a--)
{
    printf("%d",check[a]);
}
printf("\n\nDo you want to run this program again (y/n) ? ");
}
while(getche()!='n');
printf("\n\nThank You for using this program");
getche();
}

Tuesday, May 3, 2011

PROGRAM TO FIND OUT SQUARE ROOT WITHOUT USING BUILT IN SQRT FUNCTION IN C

This program will find out square root of the given by without using the default sqrt function in C

Click on download button below to get the zip file

DOWNLOAD

Hope you will like it

Monday, May 2, 2011

PROGRAM TO ENCRYPT GIVEN MESSAGE BY USING ROT 13

This Program will encrypt given word or sentence into ROT 13

Click on download button below to get the zip file

DOWNLOAD

Coding

#include<conio.h>
#include<stdio.h>
#include<string.h>
main()
{
do
{
clrscr();
char ch[160];
int length;
printf("\t\tTHIS PROGRAM IS CODED BY SYED MUHAMMED TAQI\n\nVISIT MY blog techgulf.blogspot.com\n\nNOTE:\n1.Please type you word or sentence and press enter to encrypt you input\n\n2.Input is case sensitive");
printf("\n\nEnter your message : ");
gets(ch);
length=strlen(ch);
for(int a=0; a<length; a++)
{
if(ch[a]>=65 && ch[a]<=77)
    ch[a]=ch[a]+13;

else if (ch[a]>=78 && ch[a]<=90)
    ch[a]=ch[a]-13;

else if (ch[a]>=97 && ch[a]<=109)
    ch[a]=ch[a]+13;

else if (ch[a]>=110   && ch[a]<=122)
    ch[a]=ch[a]-13;
}
printf("\nYou meesage after encryption is\n\n");
for(a=0; a<length; a++)
printf("%c",ch[a]);
printf("\n\nDo you want to run this program again (y/n) ?");
}
while(getche()!='n');
printf("\n\nThank You for using the program");
getche();
}




Hope you like it :)

PROGRAM TO DETECT IF A WORD IS PALINDROME OR NOT C

This Program will check if the given word or sentence is palindrome or not

Additional Information is listed in the program

Click on the download button below to get the zip file

DOWNLOAD


Coding

#include<conio.h>
#include<stdio.h>
#include<string.h>
main()
{
int a,t,i,flag;
char ch[50];
do
{
clrscr();
printf("Enter your sentence : ");
gets(ch);
a=strlen(ch);
t=a/2;
a--;
for(i=0; i<t; i++)
{
if(ch[i]==ch[a])
{
    flag=1;
    a--;
}
else
{
flag=0;
a--;
i=t;
}
}
if(flag==1)
printf("Yes, It is paliromee");
else
printf("No, it is not palindrome");
printf("\n\nDo you want to run this program again (y/n) ?");
}
while(getche()!='n');
}