// EQ_COUNT.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int EQ_COUNT(int f[],int nf,int g[],int ng)
{
	int indexf=0;
	int indexg=0;
	int count=0;
	while(indexf<=nf-1 && indexg<=ng-1 )
	{
		if(f[indexf]<g[indexg])
			indexf++;
		else if(f[indexf]==g[indexg])
			count+=1,printf("%3d:%3d-%3d\n",count,f[indexf],g[indexg]),indexf++,indexg++;
		else
			indexg++;
	}

	return count;
}


int main(int argc, char* argv[])
{
	int f[]={1,3,4,7,9};
	int g[]={3,5,7,8,10};
	int nf=sizeof(f)/sizeof(int);
	int ng=sizeof(g)/sizeof(int);

	int EQ_COUNT_=EQ_COUNT(f,nf, g, ng);

	printf("EQ_COUNT_=%3d\n",EQ_COUNT_);

	return 0;
}
/*
  1:  3-  3
  2:  7-  7
EQ_COUNT_=  2
Press any key to continue
*/