-5

Python での Freebase クエリの例:

私は失読症で博士号を持っていないことを知っていますが、Google はいつもAPIs理解できないと感じています。次の例が必要です。'/music/genre'リストを取得してからsubgenres...

このプログラムのオペレーター間の違いを説明できる人はいますか

int i=10;j=10;

int n=i++%5;

int k=++j%5;

このプログラムを試してみると、 n=0 、k=1 および i=11、j=11 および ++a および a++ 演算子と他の演算子が得られます。前もって感謝します。

4

3 に答える 3

2

i++「の値を使用してi からインクリメントする」
++iという意味は、「の値をインクリメントしてi から使用する」という意味であり、 「
i%5で割った後の剰余i」という意味です。5

于 2013-12-29T03:56:38.620 に答える
1

i++++iはインクリメントと呼ばれ、どちらも同等ですが、変数がインクリメントされるタイミングi = i + 1が異なります。

int i = 0;
System.out.println(i++); //This prints 0 then increments i to 1
System.out.println(++i); //This prints 2 because i is 
                         //incremented by 1 and then printed

%はモジュラス演算子であり、除算の問題の残りを提供します。

6 % 4 = 2 //This is the same as saying 6 divided by 4,
          //but prints the remainder which is 2

特定の問題について:

int i=10;
int n=i++%5; //Here you have 10 % 5 which is 0, so n = 0.
             //After that i is incremented to 11.
于 2013-12-29T03:59:52.323 に答える