Блог пользователя fixme

Автор fixme, 15 лет назад, По-английски
In Manthan 2011 Problem A, I first wrote a C++ code which did not compile, and it took me one minute to figure out why it did not.  I proudly declare that I am a C++ newbie.  The following is the relevant part of the code.

for (int i = 0; i < n - 1; ++i)
{
    case (order[i])
    {
    switch 'R':
        lr[i + 1] = lr[i] + 1;
        break;
    switch '=':
        lr[i + 1] = lr[i];
        break;
    switch 'L':
        lr[i + 1] = 1;
        break;
    }
}
  • Проголосовать: нравится
  • +15
  • Проголосовать: не нравится

15 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится
Fun. Me too :) Have you ever used Basic?
15 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится
Took me a couple of seconds. Funny, however.
15 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится
whats the funny thing? it flew over my head. 
  • 15 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится
    It is funny to me because the code which had looked perfectly correct turned out to be just obviously wrong once I realized the error in it.  I guess that you noticed the error immediately without having to stare at the code, in which case it is probably not funny at all.