I'm an IT stutend an we will have a programing exam where a test program will test our program. One of the particle examp is that we get ages and salaries of peoples, we have to count how many differet age people have
My code looks like this The struc:
struct input
{
int emp_age, emp_paid;
};
And this is the code, n is represent the number of all people
int diff_sum (int n, input* t)
{
int uniq_num = n;
for(int i = 0; i < n; i++)
{
for(int j = i; j < n; j++)
{
if((t[j].emp_age == t[i].emp_age) && (i!=j))
{
uniq_num = uniq_num - 1;
}
}
}
cout << uniq_num << endl;
return 0;
}
The program test 10 times, and some of said the out put is good but for some test it said it's wrong out put. I don't know how the test engine works, and i also dont know what the problem coud be.