последнее, что я хочу минимизировать сегодня - это код, содержащий циклы while и do-while.Вот оригинал:
class Vereinfache3_edit {
public static void main(String [] args) {
int c1 = Integer.parseInt(args[0]) ;
int c2 = Integer.parseInt(args[1]) ;
int c3 = Integer.parseInt(args[2]) ;
/* 1 */ c1 += 7 ;
/* 2 */ System.out.println( c1 ) ;
/* 3 */ while (c1 % 8 != 0)
/* 4 */ if ( c1 % 16 == 0 ) ;
/* 5 */ else
/* 6 */ do
/* 7 */ {
/* 8 */ c1 += 7 ;
/* 9 */ System.out.println( c1 ) ;
/* 10 */ if ( c2 < c3 )
/* 11 */ { c1 = c1+c1 ;
/* 12 */ c3 ++ ;
/* 13 */ c1 /= 2 ;
/* 14 */ c3 -= 1 ;
/* 15 */ }
/* 16 */ }
/* 17 */ while ( c1 % 8 != 0 ) ;
/* 18 */ c1 += 7 ;
/* 19 */ System.out.println( c1 ) ;
}
} // end of class Vereinfache3
А вот моя свернутая версия:
class Vereinfache3 {
public static void main(String [] args) {
int c1 = Integer.parseInt(args[0]);
int c2 = Integer.parseInt(args[1]) ;
int c3 = Integer.parseInt(args[2]) ;
do{
c1 += 7 ;
System.out.println( c1 ) ;
}while (c1 % 8 != 0);
/* 18 */ c1 += 7 ;
/* 19 */ System.out.println( c1 ) ;
}
} // end of class Vereinfache3
Он генерирует тот же вывод для меня.Видите ли вы какие-либо ошибки или вещи, которые можно улучшить?
Особенно этот код кажется хитрым:
/* 3 */ while (c1 % 8 != 0)
/* 4 */ if ( c1 % 16 == 0 ) ;
/* 5 */ else
/* 6 */ do{}
Как мне справиться с этим в то время?Что содержит цикл while?