473,473 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to perform Map Implemantation in C++

93 New Member
Say for example I want to store the name of object and corresponding value
for the same; all in the form of strings.

How can I implement it, so that I would be able to retrieve the value once
I find the Object name.

Please Can anyone explain me with an Example ?

Thanks in advance.
Jun 6 '07 #1
3 1358
gpraghuram
1,275 Recognized Expert Top Contributor
HI,
I presume that u are asking for example with STL map.
Expand|Select|Wrap|Line Numbers
  1. map<string,string> smap;
  2. string s1("index");
  3. string s2("value");
  4. smap[s1]=s2;
  5.  
If u need some thing else then explain more on that..
Thanks
Raghuram
Jun 6 '07 #2
Girish Kanakagiri
93 New Member
HI,
I presume that u are asking for example with STL map.
Expand|Select|Wrap|Line Numbers
  1. map<string,string> smap;
  2. string s1("index");
  3. string s2("value");
  4. smap[s1]=s2;
  5.  
If u need some thing else then explain more on that..
Thanks
Raghuram
Thanks for your response, Your right I am asking for STL map.
The scenario is like this ...
I nead map < objname , map1 > // here map1 is value for objname
map1 < propertyname , value > // actual value comes here.

What exactly I mean is -> I should have a name value pair, in this the value
should again be a map with name value pair and here I will find the actual value

Thanks in advance,
Girish.
Jun 6 '07 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
All map elements must be pairs.

Expand|Select|Wrap|Line Numbers
  1. map<string,string> smap;
  2. pair<string, string> p;
  3. p.first = "index";
  4. p.second = "value";
  5. smap.insert(p);
  6. //
  7. //To retreive:
  8. //
  9. //
  10. map<string, string>::iterator answer;
  11. //
  12. answer = smap.find("index");
  13.  
  14. cout << (*answer).first<< endl; //you see value
  15.  
Jun 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Andreas Forsgren | last post by:
Hi gurus, Anyone knows how to solve this? I was playing around with triggers on my own machine which runs 7.3 and there it works okey, but when trying it on 7.2 I get an error about duplicate...
0
by: Randell D. | last post by:
Folks, I have two tables - one called parent, the other called group. table group is made up of ID,parentID,groupHash and groupName. table parent is made up of...
1
by: xo55ox | last post by:
Hi, Did anyone successfully set up a local package to first ftp a db.bak and second perform an automated db restore? I need to perform an automated task, which ftp nightly backup file to...
8
by: Rene | last post by:
Hi, I'm spend many hour to fix this problem, read many articles about it but no article gave a solution. To isolate the problem I've created in IIS6 (WServer2003) a virtual directory test to...
3
by: Mika | last post by:
Is it possible to perform functions on a recordset (rather than on the source database), e.g. COUNT, MAX etc The reason I would like to do this is because I have a hugely complex view which...
4
by: Lee Chapman | last post by:
Hi, Can anyone tell me why in the code below, the call to ClearChildViewState() has no effect? To paraphrase the code: I'm using view state. I have a textbox and a submit button (and a label...
7
by: | last post by:
Hello, I would like to do the following from a asp.net button click: <form method="POST" action="https://www.1234.com/trans_center/gateway/direct.cgi"> <input type="hidden" name="Merchant"...
0
by: Ed | last post by:
I've attached some VB.NET code I've hacked together (some taken from MS examples & newsgroup postings) that will perform a ping or IcmpSendEcho using the icmp.dll (see this for more info:...
6
by: Rajat Katyal | last post by:
Hi: In postgres documentation its written that if we execute query as PERFORM query inside our stored procedure; then the special variable FOUND is set totrue if the query produced at least one...
0
by: truptidalia | last post by:
Hi, I am not that experienced in VB.NET. I am working on a application where i have to perform mail merge from the application. The application lets the userwrite letters, save them as rtf...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.