1. Enter the sum of the numbers around an array
Int I, j, a [m] [N], sum = 0;
For (I = 0; I <m; I ++)
{
For (j = 0; j <n; j ++)
{
Scanf ("% d", & A [I] [J]);
If (I = 0 | I = M-1 | j = 0 | j = N-1)
Sum + = A [I] [J];
}
}
For (I = 0; I <m; I ++)
{
For (j = 0; j <n; j ++)
{
Printf ("% d \ t", a [I] [J]);
}
}
Printf ("% d", sum );
2. The input 1 + 1 in the CIN statement cannot be recognized by the computer.
Cin> 1 + 1;
However, the input can be recognized: cout <1 + 1;
3. Int mice = 0;
Mice = 1.6 + 1.7; // The result is 3.
Mice = (INT) 1.6 + (INT) 1.7; // The result is 2.
4. The input character is not carriage return.
While (getchar ()! = '\ N '){};
5. Int B = 7;
Float a = 2.5, c = 4.7;
A = a + (INT) (B/3 * (INT) (A + C)/2) % 4;
Printf ("% F \ n", );
The result is 5.5 (calculated carefully)
6. Determine whether it is an endless loop based on CPU efficiency. Open the Task Manager: performance. If the CPU of a dual-core instance is 50%, it is an endless loop.
7. Use of nsum ++ = I ++;
8. For: expression 1 and expression 3 are mostly comma-separated expressions. Expression 2 is rarely used with a comma ..
All three expressions are optional.
9. If while for cannot contain semicolons unless the loop body is empty.