#include
#include
The template & lt; Typename elementType>
Bool IsEven (const elementType& Number)
{
Return (number % 2==0);
}
Int main ()
{
using namespace std;
vector
For (int nNum=9; NNum & lt; 10; + + nNum)
VecIntergers. Push_back (nNum);
vector
For (iElementLocator=vecIntergers. The begin ();
IElementLocator!=vecIntergers. End ();
+ + iElementLocator)
Cout & lt; <* iElementLocator & lt; <" ";
Cout & lt;
Size_t nNumZeros=count (vecIntergers. The begin (), vecIntergers. The end (), 0).
Cout & lt; <" Vector in the vector "& lt;
Size_t nNumEvenElements=count_if (vecIntergers. The begin (), vecIntergers. The end (), IsEven
}
This is all the code displays - nine to nine the number of the even number and the output of the predicate IsEven but run always wrong he has done
CodePudding user response:
Have a great god help me conveniently solve the noCodePudding user response:
Appreciate for the great godCodePudding user response:
Best to upgrade the compiler, VC6 using templates problems,VS2015 directly compiled through,,
CodePudding user response: