Ugly Code
看到几行令人纠结的代码:
1 2 3 4 5 6 7 | const int size = 1000; // array of 1000 integers int array [size]; int n = 0; // read an integer into the n+1 th element of array while (cin >> array[n++]); n--; // it got incremented once too many times //下面处理array与n的代码省略 |
搞不明白这里
1 2 | while (cin >> array[n++]); n--; // it got incremented once too many times |
为什么要这样,明明可以这样写的
1 | while (cin >> array[n])n++; |
这种代码看的让人蛋疼。