Page 5 of 18 FirstFirst 123456789101112131415 ... LastLast
Results 41 to 50 of 174

Thread: Вопрос на засыпку (Java, C#)

  1. #41
    Патриот смешно's Avatar
    Join Date
    Apr 2003
    Location
    Страна чудес
    Posts
    55,561

    Default Re: Вопрос на засыпку (Java, C#)

    кстати, эту задачку надо давать на интервью...если чувак не знает..но досвидания.... :rofl: :34:
    4 main reasons why Boston is the best place to live:Red Sox (Baseball), Patriots (Football) World Champions
    Celtics the NBA (Basketball), Bruins Stanley Cup (Hockey)

  2. #42
    Патриот смешно's Avatar
    Join Date
    Apr 2003
    Location
    Страна чудес
    Posts
    55,561

    Default Re: Вопрос на засыпку (Java, C#)

    похоже Марику надо обьяснить на английском языке. ОК.

    The "++" operator is evaluated last. The compiler breaks apart the equation into the following format
    j = j + (j++ % 3). 14 is subtitued into the right hand side j = 14 + ( (14) % 3).
    The value j is then incremented to 15 due to the "++", however it is irrelevant now as original value of 14 was substituted in already. 14 mod 3 = 2 which is added to 14 thus resulting in right hand side of the equation = 16 and getting assigned to j.
    4 main reasons why Boston is the best place to live:Red Sox (Baseball), Patriots (Football) World Champions
    Celtics the NBA (Basketball), Bruins Stanley Cup (Hockey)

  3. #43
    Патриот смешно's Avatar
    Join Date
    Apr 2003
    Location
    Страна чудес
    Posts
    55,561

    Default Re: Вопрос на засыпку (Java, C#)

    народ, вам ещё одна задачка! :grum:


    which version of Cube method will be used? no any reference please, just use your brain. Thanks.

    long Cube(int x)
    {
    return x * x * x ;
    }

    int Cube(int x)
    {
    return x * x * x;
    }

    Cube(5);
    4 main reasons why Boston is the best place to live:Red Sox (Baseball), Patriots (Football) World Champions
    Celtics the NBA (Basketball), Bruins Stanley Cup (Hockey)

  4. #44
    подниматель пингвинов crazy-mike's Avatar
    Join Date
    Nov 2006
    Location
    L'viv
    Posts
    179,963

    Default Re: Вопрос на засыпку (Java, C#)

    Quote Originally Posted by смешно View Post
    кстати, эту задачку надо давать на интервью...если чувак не знает..но досвидания.... :rofl: :34:
    На g++ тоже 17. :grum:

  5. #45

    Default Re: Вопрос на засыпку (Java, C#)

    Quote Originally Posted by crazy-mike View Post
    А вот так 16 получается.
    :grum:
    14 % 3 = 2, т.е. выполняется b % 3 и а = b , но инкремент не выполняется :rofl:
    [/COLOR][/COLOR]
    ну, конечно, если порядок действий поменять получится другой ответ

  6. #46

    Default Re: Вопрос на засыпку (Java, C#)


  7. #47

    Default Re: Вопрос на засыпку (Java, C#)

    Quote Originally Posted by crazy-mike View Post
    мы как раз эти результаты можем объяснить. :grum:
    покажи мне IEEE спеки. если ты например испортил компилятор то можешь и 20 и 30 получить.

  8. #48

    Default Re: Вопрос на засыпку (Java, C#)

    Quote Originally Posted by смешно View Post
    похоже Марику надо обьяснить на английском языке. ОК.

    The "++" operator is evaluated last. The compiler breaks apart the equation into the following format
    j = j + (j++ % 3). 14 is subtitued into the right hand side j = 14 + ( (14) % 3).
    The value j is then incremented to 15 due to the "++", however it is irrelevant now as original value of 14 was substituted in already. 14 mod 3 = 2 which is added to 14 thus resulting in right hand side of the equation = 16 and getting assigned to j.
    это неправильное объяснение, а конкретно выделенная часть

    потомучто J++; equivalent to j=j+1;

  9. #49
    подниматель пингвинов crazy-mike's Avatar
    Join Date
    Nov 2006
    Location
    L'viv
    Posts
    179,963

    Default Re: Вопрос на засыпку (Java, C#)

    Quote Originally Posted by марик - камарик View Post
    ну, конечно, если порядок действий поменять получится другой ответ
    Они там и поменяли. Может быть даже из-за изменения алгоритма грамматического разбора. :wink1:

  10. #50
    подниматель пингвинов crazy-mike's Avatar
    Join Date
    Nov 2006
    Location
    L'viv
    Posts
    179,963

    Default Re: Вопрос на засыпку (Java, C#)

    Quote Originally Posted by марик - камарик View Post
    это неправильное объяснение, а конкретно выделенная часть

    потомучто J++; equivalent to j=j+1;
    Это не так.
    Вообщето:
    mov j,%eax
    inc %eax
    mov %eax,j
    :wink1: это j++
    Ну а j=j+1:
    add j,1
    :grum:
    побочные эффекты выполнения семантических подпрограмм существенно различаются.

Page 5 of 18 FirstFirst 123456789101112131415 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Russian America Top. Рейтинг ресурсов Русской Америки. Terms of Service | Privacy Policy Рейтинг@Mail.ru