#include<iostream>
#include<string>
using namespace std;
int main()
{
int i,j;
int begin = 0;
string str = " /*com*/ //hello";
next:for (i = begin; i < str.length(); i++)
{
if (str.find(" ", i) == i || str.find("\t", i) == i)
{
cout << i << " ";
}
else
{
break;
}
}
if (str.find("/*") == i)
{
for ( j = i; j < str.length(); j++)
{
if (str.find("*/") == j)
{
begin = j;
goto next;
}
}
}
cin.get();
return 0;
}
The values of i are only 0 1 2 3
Why is the control not being transferred to the label 'next'?
Last edited on
It is. You find "*/" at position 6 so when the first loop looks for " " on that position it will not find it because it's two positions away.