>THIS CODE IS BEEN TAKEN FROM " THE C++ PROGRAMMING LANGUAGE"BY BJARNE STROUSTRUP.
No it hasn't. The creator of C++ would never code in such an incorrect and haphazard manner. You mean you read something in the book and tried to code it on your own. There are a great number of problems with this code, I'll try to get them all:

>#include<iostream.h>
This is the old header, if your compiler supports namespaces then you should be using <iostream>.

>#include<conio>
This should be <conio.h>.

>struct pair{
The identifier pair is already used by the STL, this should cause an abiguity warning.

>char* name;
Use the string class instead, it is far safer than manually dealing with memory for char *'s.

>double val;
If this is supposed to be a counter for duplicate items then it should be int.

>double &value(const char* &s){
Once again you'd best use the string class to avoid pointer problems.

>if(s==pairs[i].name){return pairs[i].val;}
You can't compare char *'s with the equality operator, either use strcmp in string.h or use the string class, which has the functionality you want.

>void main()
No, main returns an int and nothing else.

>while(cin>>buf)
You're assigning to memory that you don't own, buf is just a pointer and it can't hold a string until you assign enough memory for it to do so. The result is undefined behavior, you don't want this.

>value(buf)++;
I know this feature may look attractive, but it does nothing but make the code more confusing in this case.

>getch();
getch really isn't needed here since cin.get() does the same thing when used in this context.

Here's a quick modification of the program, it's still not great, but at least it works and doesn't exhibit undefined behavior: