How can I get values from a map and have the displayed to the console?
up vote
0
down vote
favorite
I want to use a map to store a lot of information and grab it by using getline(cin, Number) to ask for user input.
std::map<int, int, int> Info;
Info[3321] = 3321, 180, 4;
Info[3260] = 3260, 300, 4;
Info[3053] = 3053, 250, 4;
I would like to get the information for from one at a time by typing in a number in the console. So if I type in 3321 in the console I want to get back 3321 180 and 4 into the console. I am not sure if a map is what I need to accomplish this but I am not certain what to use. Any information would be wonderful thanks.
c++ dictionary
add a comment |
up vote
0
down vote
favorite
I want to use a map to store a lot of information and grab it by using getline(cin, Number) to ask for user input.
std::map<int, int, int> Info;
Info[3321] = 3321, 180, 4;
Info[3260] = 3260, 300, 4;
Info[3053] = 3053, 250, 4;
I would like to get the information for from one at a time by typing in a number in the console. So if I type in 3321 in the console I want to get back 3321 180 and 4 into the console. I am not sure if a map is what I need to accomplish this but I am not certain what to use. Any information would be wonderful thanks.
c++ dictionary
Use{}
to create those, switch tostd::map<int, std::tuple<int, int, int>>
orstd::array<int, 3>
as value type.
– Sombrero Chicken
Nov 13 at 20:23
This helped a lot thank you very much for the quick answer.
– creation8383
Nov 15 at 18:54
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to use a map to store a lot of information and grab it by using getline(cin, Number) to ask for user input.
std::map<int, int, int> Info;
Info[3321] = 3321, 180, 4;
Info[3260] = 3260, 300, 4;
Info[3053] = 3053, 250, 4;
I would like to get the information for from one at a time by typing in a number in the console. So if I type in 3321 in the console I want to get back 3321 180 and 4 into the console. I am not sure if a map is what I need to accomplish this but I am not certain what to use. Any information would be wonderful thanks.
c++ dictionary
I want to use a map to store a lot of information and grab it by using getline(cin, Number) to ask for user input.
std::map<int, int, int> Info;
Info[3321] = 3321, 180, 4;
Info[3260] = 3260, 300, 4;
Info[3053] = 3053, 250, 4;
I would like to get the information for from one at a time by typing in a number in the console. So if I type in 3321 in the console I want to get back 3321 180 and 4 into the console. I am not sure if a map is what I need to accomplish this but I am not certain what to use. Any information would be wonderful thanks.
c++ dictionary
c++ dictionary
asked Nov 13 at 20:21
creation8383
6
6
Use{}
to create those, switch tostd::map<int, std::tuple<int, int, int>>
orstd::array<int, 3>
as value type.
– Sombrero Chicken
Nov 13 at 20:23
This helped a lot thank you very much for the quick answer.
– creation8383
Nov 15 at 18:54
add a comment |
Use{}
to create those, switch tostd::map<int, std::tuple<int, int, int>>
orstd::array<int, 3>
as value type.
– Sombrero Chicken
Nov 13 at 20:23
This helped a lot thank you very much for the quick answer.
– creation8383
Nov 15 at 18:54
Use
{}
to create those, switch to std::map<int, std::tuple<int, int, int>>
or std::array<int, 3>
as value type.– Sombrero Chicken
Nov 13 at 20:23
Use
{}
to create those, switch to std::map<int, std::tuple<int, int, int>>
or std::array<int, 3>
as value type.– Sombrero Chicken
Nov 13 at 20:23
This helped a lot thank you very much for the quick answer.
– creation8383
Nov 15 at 18:54
This helped a lot thank you very much for the quick answer.
– creation8383
Nov 15 at 18:54
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53288904%2fhow-can-i-get-values-from-a-map-and-have-the-displayed-to-the-console%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Use
{}
to create those, switch tostd::map<int, std::tuple<int, int, int>>
orstd::array<int, 3>
as value type.– Sombrero Chicken
Nov 13 at 20:23
This helped a lot thank you very much for the quick answer.
– creation8383
Nov 15 at 18:54