Jeg kan ikke bruge funktionen count i mine scripts
Hej, nu kommer jeg fra PHP-verdenen og troede at der fandtes en funktion ligesom count() i C++ også. Har også søgt om det på nettet og der er også folk der bruger count() i deres scripts, hvorfor kan jeg ikke?Min kode:
#include <iostream.h>
main ()
{
int x;
int y;
int x_max = 11; // The max that the X axe must show
int y_max = 11; // -------||------- Y -----||------
//Lets print the top of the table
for(x = 0; x != x_max; ++x) {
if(count(x) > 2) {
cout << x << "|";
} else {
cout << x << " | ";
}
}
while(x != x_max && y != y_max)
{
break; // Debugging purpose
}
return(0);
}
Hvad g++ udskriver:
template.cc: In function `int main()':
template.cc:14: error: `count' undeclared (first use this function)
template.cc:14: error: (Each undeclared identifier is reported only once for
each function it appears in.