This is one part of my program, I need a loop that checks through the input(specifically the agent numbers) and then outputs the agent numbers that aren't in the input, from 1 to 20(because there should only be 20 agent).
void not_part()
{
ins.open(in_file);
int i=0;
int sum=0;
cout<<"AGENTS WHO DID NOT PARTICIPATE IN THE CAMPAIGN"<<endl;
cout<<fixed<<showpoint;
cout<<setprecision(2);
while(!ins.eof())
{
ins>>agent[i]>>sales[i]>>value[i];
amount[i]=sales[i]*value[i];
for(int j=1; j<=20; j++)
{
for(int t=0; t<=count; t++)
if(j!=agent[t])
{
sum+=1;
if(sum==count)
{
cout<<j<<" ";
sum=0;
}
}
}
i++;
}
cout<<endl;
ins.clear();
ins.close();
}
My input is :
1 3 250.00
2 0 0
15 1 1000.00
3 4 300.00
12 2 500.00
1 2 300.00
3 4 115.00
21 3 400.00
-1 4 250.00
15 1 200.00
9 5 -150.00
18 2 140.00
13 2 550.00
I know my loop is wrong, I need help to correct it.