I am using this code that to check a set of values from a text file and show it on the output.

I want to calculate how many times theCode:void MatchNumber(int b) { vector<Rect> rects; ifstream theFile("CheckNumber.txt"); double x1,y1,x2,y2; while(theFile >> x1 >> y1 >> x2 >> y2 ){ rects.push_back(Rect(x1,y1, x2,y2)); } int num=0; int freq[101] = {0}; int adj_count = 0; for (int x = 0; x < rects.size(); ++x) { if (rects[b].isAdjacent(rects[x])) { if (x==b) { continue; } adj_count++; } } freq[num]++; cout<<"The common number is = "<<adj_count<<endl; cout<< "The "<<adj_count<<" repeated = "<< freq[num]<<" times"<<endl; cout<<endl; } int main() { for(int i=0; i<10; i++){ MatchNUmber(i); } return 0; }common numberisrepeated. So I have usedfreq[num]in that function. But I am getting the output like this-

So the freq[num] isCode:The common number is = 5 The 5 repeated = 1 times The common number is = 6 The 6 repeated = 1 times The common number is = 4 The 4 repeated = 1 times The common number is = 5 The 5 repeated = 1 times The common number is = 5 The 5 repeated = 1 times The common number is = 8 The 8 repeated = 1 times The common number is = 9 The 9 repeated = 1 times The common number is = 6 The 6 repeated = 1 times The common number is = 6 The 6 repeated = 1 times The common number is = 8 The 8 repeated = 1 timesonly returning 1instead of counting the total number of repeating which iswrong!!I would like to have somthing like this in my output-

How can I do that?Code:The common number is = 5 The common number is = 6 The common number is = 4 The common number is = 5 The common number is = 5 The common number is = 8 The common number is = 9 The common number is = 6 The common number is = 6 The common number is = 8 The 4 repeated = 1 times The 5 repeated = 3 times The 6 repeated = 3 times The 8 repeated = 2 times The 9 repeated = 1 times