Welcome to the forum, Simplicity.
There is a slick way of doing this, called distribution counting or counting sort or just "binning". Anyway, whatever the name, here's how it works:
Code:
#include <stdio.h>
int main() {
int i;
int num[10] = { 4, 1, 4, 12, 3, 8, 12, 4, 9, 4 };
int count[13] = { 0 };
for(i = 0; i < 10; i++)
count[num[i]]++;
for(i = 0; i < 13; i++) {
if(count[i] > 1)
printf("\n%2d: %2d", count[i], i);
}
printf("\n\n\t\t\t press enter when ready");
getchar();
return 0;
}
When you run it, it shows you have 4 4's and 2 12's, in your num[] array.
Note that the size of cout[] array MUST be able to go to the highest value in num[]. If the highest number in num was 126, then count would have to have at least 127 elements in it (the +1 is because arrays in C start with 0's, not 1's).
Back to your program. After every party, you run this bit of code, and it will quickly tell you which parties have guests with duplicate bdays.
Remember to reset the count array to all zero's, in a for loop, before the next party.
This is a good programming trick to remember, btw.