Oh, ok. I think I get it. So no need to create one because it has already been created for me. I then just need to take that iterator that was just created by the std::find and place it into the...
Type: Posts; User: go_loco
Oh, ok. I think I get it. So no need to create one because it has already been created for me. I then just need to take that iterator that was just created by the std::find and place it into the...
I apologize but I'm pretty new to C++ and I'm trying to learn stuff the prof. hasn't taught us yet. I understand an iterator to be like a pointer. So what your saying is that I need to create an...
hm.... so here is what I have of my remove function:
void remove(int x)
{
cout << "What integer would you like to remove from the bag?" << endl;
cin >> x;
int match1 = x;
EDIT:
Hey, sorry I didn't see your post before I replied. I agree I would much rather put the prompts for filling the bag and what not in the main. However, the instructor wants us to prompt the...
Thanks guys I really appreciate the help!!
I have one more question and I should be home free.
I have a function called "remove" I am needing to search the vector and then remove that integer...
Thanks! I had seen that one and messed around with it too but couldn't get it to work. What's the difference between find and search?
Hi,
I am needing to take a vector and search it for a certain integer.
The goal:
To search a vector and confirm or deny if a certain integer is there.
The problem:
Well I really am unclear on maps. I have yet to find an example to actually help me. the examples with strings dont do me any good.
ok well I wasn't really grasping the map issue mostly cause all the examples online never did it for ints and ints. So I tried to go with something else.
Here is what I got:
#include...
ok this map stuff is kinda blowing my mind, but I think after looking at that page I'm a little close.
So when you say:
map<int, int> counts;
Does this just say that you are comparing two...
So would I be correct in using this?
size_type count(const key_type& key) const;
I was thinking I could have it search the vector for the values 0-100? If I did that where would it then...
ok I'm trying to understand this map concept. Would you mind trying to explain it and maybe a small example, unrelated to my assignment. I don't want answers. I want to understand this map concept.
Haha ok....So now that I am using a vector I'm back to the question of " How can I count the occurrences of a certain number and then have it print out how many times that number occurred." This is...
Yea we assume X is non negative. Sorry I failed to mention that.
Right after i posted I found the .begin that you posted above. I just added that to my sort statement and it worked just fine.
...
ok... so I've rewritten my code using a vector instead. Here is what I have so far....
#include <iostream>
#include <vector>
using namespace std;
int main()
{
I'm sorry I'm just starting to use C++. So am I not able to use unique to get rid of the duplicate numbers that may be entered?
I am having the user enter in a series of numbers into an array. I am then wanting to order that set of numbers from lowest to highest while deleting and duplicate numbers they may have entered.
...