I'm trying to translate a fortran program to a c++ version, and then I found such code:
100 DO 120 I=2,7
DO 110 J=1,3
IF(IU(J)/I*I-IU(J))120,110,120
110 CONTINUE
GO TO 130
120 CONTINUE
GO TO 150
130 DO 140 J=1,3
140 IU(J)=IU(J)/I
GO TO 100
150 CONTINUE
END
And END
is the end.
My c++ verison is:
bool flag=true;
while(flag){
flag=false;
for (int i = 2; i <= 7; i++) {
for (int j = 0; j < 3; j++) {
if ((IU[j]/i*i==IU[j])) {
flag=true; break;
}
else {
continue;
}
}
if (!flag) {
break;
}
else {
for (int j = 0; j < 3; j++) {
IU[j]=IU[j]/i;
}
}
}
}
I'm sure that it is wrong, but could not figure out the correct one. So how to translate the fortran code to c++?