# strange function behaviour

From: muser (charlie12345_at_hotmail.com)
Date: 10/13/03

```Date: 13 Oct 2003 07:24:30 -0700

```

I have written a function that checks the first four characters in an
address are valid; i.e. 1d2 sour st would prove to be invalid.

bool checkdigitsinaddress( const char* string )
{

for( int i =0; i<=1; i++ )
if( !isdigit( string[i] )){}
return false;
for(i=1; i<=2; i++)
if( string[i] != isalpha(string[i]) || string[i] !=
isdigit(string[i])){}
return false;
for(i= 1; i<=2; i++)
if( string[i] == isalpha(string[i])){}
for(i= 2; i <=3; i++)
if(string[i] != isalpha(string[i])){}
return false;
for(i= 1; i<=2; i++)
if( string[i] == isdigit(string[i])){}
for(i= 2; i <=3; i++)
if(string[i] != isalpha(string[i]) || string[i] !=
isdigit(string[i])){}
return false;
for( i= 2; i<=3; i++)
if( string[i] == isalpha(string[i])){}
for(i= 3; i<=4; i++)
if(string[i] != isalpha(string[i]))
return false;
for(i =2; i<=3; i++)
for(i= 3; i<=4; i++)
if(string[i] != isalpha(string[i]) || string[i] !=
isdigit(string[i])){}
return false;
for(i= 3; i<=4; i++)
if(string[i] == isalpha(string[i])){}
for(i=4; i<=5; i++)
if(string[i] != isalpha(string[i])){}
return false;
for(i= 5; i< 25; i++)
if(string[i] != isalpha(string[i]) && string[i] != ';')
return false;

return true;

}

const char* string, is globally declared. const char* string

bool Processcrecord( ofstream& prnfile, ofstream& validdata, char*
record )
{

must begin with numerical format:\n";
prnfile<< record <<endl;
}
return false;

there are entries and validdata is used, but none of thaat is causing
the problem. Record is the string of a file save on disk.

the line I'm reading from is:
c23454stevenlaw 12sceptrerd;Ilford;Essex;IG39By;
00000.0251600000

the address as you can see starts with a numerical entry but i still
get this return as false when I run the program. Any ideas on why that
is?