Hey guys, I am in the process of a program that counts integers I can do this by looking for the int keywork and then incrementing a variable although if an integers are implemented as:
int j,k,l;
I am not sure how to count this as 3 ints, I know I will need some form of loop that reads until the next comma and ends at the semicolon.
I have come up with the following code but it doesn't work and I was just wondering where I went wrong? Thanks.
char array [200];
ifstream file;
file.open(filel);
if (file.is_open())
{
while (file.getline( array, sizeof(array) ))
{
if ( strstr ( array, "int" ) != 0 )
{
fint++;
for (i =0; i <sizeof(array) ; i++
if (array[i]==',')
fint++
if (array[i]==';')
break;
}
}