Advertisement
Guest User

Untitled

a guest
Aug 30th, 2015
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. void findRepeats(int numbers[], int num)
  2. {
  3. int instances = 0;
  4.  
  5. cout << "Number" << " " << "Occurrences" << endl;
  6. for (int i = 0; i < num; i++)
  7. {
  8. bool matching = false;
  9. instances = 1;
  10. for (int j = 0; (j < i); j++)
  11. {
  12. if (numbers[i] == numbers[j])
  13. {
  14. instances++;
  15. matching = true;
  16.  
  17. }
  18.  
  19. }
  20. if (!matching)
  21. cout << numbers[i] << " " << instances << endl;
  22.  
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement