my program enter an infinite loop if the user inputs invalid data?

I check the FAQ section and I got this code, I say super I fix my problem, but when I try to run my program I get 3 errors:


Code:
#include <limits>

{
	int a = 0;
	while (cout << "Please Enter the Number of Clases Compleated: " && !(cin >> a))
		{
		 cout << "\nInvalid input" <<endl;
		 cin.clear();
		 cin.ignore(std::numeric_limits <int>::max(), '\n');
		}

	cout << "\n";
	if (a < 2)
		info[j].clas[0] = 'C';
	else if (a>=2 && a<=4)
		info[j].clas[0] = 'B';
	else if (a>4)
		info[j].clas[0] = 'A';
	info[j].clas[1] = '\0';
}

-not enough actual parameters for macro 'max'
-error C2589: '(' : illegal token on right side of '::'
-error C2143: syntax error : missing ')' before '::'
-error C2059: syntax error : ')'

Please help, the project is due next week. everything work but this section.