The numbers correspond to employees id's who participated in a fundraiser. I have 20 employees in total. Therefore I am trying to check the array to see out of the 20 employees who did not participate. In this case it would be 1,4,5,7,9,11,13,14,15,16,17,18,19,20.
I was trying something like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
ins.open(in_file);
int i =0;
while (!ins.eof())
{
ins >> agent[i] >> sales[i] >> value[i];
i++;
}
for (int r = 0; r<i; r++)
{
for (int x=1; x<20; x++)
{
cout << x << endl;
}
}
but it prints out x every time it checks so I get like 20 x i amount of numbers.... help ?
thanks
file.open(where you want it); // opens file
for(int i = 0; file.good(); i++) file >> agentID[i]; // uploaded the id numbers
file.close(); //remember to close file
std::vector<int> not_addented; // vector can use arrays if you want.
for(int i = 0; i < 20; i++){ // moves agentID
for(int j = 0; j < 20; j++){ // moves array a
if(agentID[i] == a[j]){ // if they equal each other do next statement
not_addented.push_back(agentID[i]); break; // adds element to end of vector that records the value of each match.
}
}
}
Awesome thanks ! got it to work ... realized I had closed file input in previous function.. seemed to be one of my problems... My Next problem is this.... I am suppose to add up the sales from each employee and out the top three however, I have to add to employee ID's together..
this is my input
First column employee ID, second sales, third value of each unit
so as you can see employee 1 makes two different sales.. How do I calculate the amounts and combine both of employee 1's sales.. this is what I have.. but. it only sorts the list as is..