By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,483 Members | 1,612 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,483 IT Pros & Developers. It's quick & easy.

defining keys

P: n/a
KK
How to define keys in c++??
can anyone help on this?

Jul 11 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"KK" <Ka****************@gmail.comwrites:
How to define keys in c++??
You can e.g. do the following.

int main()
{
int keys = 42;

return 0;
}
can anyone help on this?
Could you give more details on your need?
--
Marco Wahl

Jul 11 '06 #2

P: n/a
"KK" <Ka****************@gmail.comwrote:
How to define keys in c++??

int keys;
Oh, you say that's not what you meant? I guessed it
might not be. But since there is something like a googol
(google "googol") of different ways to interpret your
question, I just chose one at random.

If you would care to elaborate, perhaps I could be of
more help.

--
Cheers,
Robbie Hatley
East Tustin, CA, USA
lone wolf intj at pac bell dot net
(put "[usenet]" in subject to bypass spam filter)
http://home.pacbell.net/earnur/
Jul 11 '06 #3

P: n/a
KK posted:
How to define keys in c++??
can anyone help on this?

My guess wudda been:

#define keys
--

Frederick Gotham
Jul 11 '06 #4

P: n/a
KK wrote:
How to define keys in c++??
class keys { };

--
Salu2
Jul 11 '06 #5

P: n/a

"KK" <Ka****************@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
How to define keys in c++??
can anyone help on this?
In case the abundance of smart-ass answers hasn't clued you in... nobody
knows what you're talking about! :-)

If this is a database questions, then ask in a database newsgroup.

If you think it is actually a C++ _language_ question (the topic of this
newsgroup), then post back with some more details of what you're asking.
The word "keys" is just too general to know what you're referring to, and
isn't a term used in describing anything in the C++ language (at least not
that I'm aware of).

-Howard
Jul 11 '06 #6

P: n/a
"Howard" <al*****@hotmail.comwrote:
"KK" <Ka****************@gmail.comwrote:
How to define keys in c++??
can anyone help on this?

In case the abundance of smart-ass answers hasn't clued you in... nobody
knows what you're talking about! :-)

If this is a database questions, then ask in a database newsgroup.

If you think it is actually a C++ _language_ question (the topic of this
newsgroup), then post back with some more details of what you're asking.
The word "keys" is just too general to know what you're referring to, and
isn't a term used in describing anything in the C++ language (at least not
that I'm aware of).
Well, maps and multimaps use keys. Which can basically be any simple
type for which "<" is defined, so that maps can be ordered by keys.
Which is why I made some smartass comment about "int".

If I remember right, the code for that looks something like this:

typedef unsigned long student_id; // "key" type
typedef std::string student_name; // "value" type

std::map<student_id, student_nameStudentBody;

void AddStudent(student_id id, student_name name)
{
::StudentBody.insert(std::make_pair(id, name));
}

void DeleteStudent(student_id id)
{
::StudentBody.erase(id);
}

std::string GetName(student_id id)
{
return ::StudentBody[id];
}
I don't know if map keys is what the person had in mind though.
--
Cheers,
Robbie Hatley
East Tustin, CA, USA
lone wolf intj at pac bell dot net
(put "[usenet]" in subject to bypass spam filter)
http://home.pacbell.net/earnur/
Jul 11 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.