This works.
<code>
#include <iostream>
#include <map>
using namespace std;
int main()
{
map<int,int> a;
a[-1] = 0;
cout<<a[-1]<<endl;
}
</code>
On Wed, Jul 20, 2011 at 7:50 PM, ankit sambyal <[email protected]>wrote:
> You can make the following structure :
>
> #define MAX 100
> typedef struct
> {
> int count_positive;
> int count_negative;
> }Element;
>
> typedef Element Map[MAX];
>
> Now you can just create a map as :
> Map map;
>
> Now for every element read, first check whether it is +ve or -ve. Use
> the absolute value of the number read as the key.
> Increment count_positve if key is +ve and increment count -ve if key is -ve
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
regards,
chinna.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.