
98
(
)
64001
64101
64201
20
!"#$% &'(
)*+,-./0
2B
1234.567$89:4;<6=>?@
34.67ABCD$ EF(
GHIJKLMNOPQ
0
R
9
ST U
×÷% =
+/- C AC TAX+ TAX- GT MU MR MC M+
M-
VWXYZ[']G(
!"#$%
!"#$% !"#$%
!"#$%&
&&
&
(
3
)
4
1.
n
4
m
5
++(n*m);
25
21
20
2
2.
C++
!"
#include<stdio.h>
void swap(int a, int b);
main()
{
int m=5, n=3
swap(m, n);
printf("The value of m=%2d n=%2dn",m,n);
}
void swap(int &x, int &y)
{
int temp = y;
y = x;
x = temp;
}
#$%&'(
m = 5 n = 3
m = 3 n = 5
m = 5 n = 5
m = 3 n = 3
3
5
C++
)*+,- ./0 12
3~5
3"
line 1. #include <iostream>
line 2. using std::cout;
line 3. using std::endl;
line 4. class Test
line 5. {
line 6. public:
line 7. Test( int = 0 ); // default constructor
line 8. void what( );
line 9. private:
line 10. int x;
line 11. }; // end class Test
line 12. // constructor
line 13. Test::Test( int value )
line 14. : x( value )
line 15. {
line 16. // empty body
line 17. } // end constructor Test
line 18. void Test::what( )
line 19. {
line 20. cout << " x = " << x++;
line 21. cout << " this->x = " << this->x;
line 22. cout << " (*this).x = " << ( *this ).x << endl;
line 23. } // end function what
3
3.
456789:
Test a;
Test a(10);
Test a=10;
Test a( );
2
4.
; !
private
x
5
<
what( )
-$%&'(
x=5 this->=5 (*this).x=5
x=5 this->=6 (*this).x=6
x=6 this->=5 (*this).x=5
x=5 this->=6 (*this).x=5
4
5.
:
private
x
=>?
Class Test
@AB
what( )
C
Class Test
DEF
G
14
"
x( value )
CH
x
I
this
CJKLJ
Test
MN
2
6.
OP&"
void what(int *a, int b)
{
*a = b;
}
int main(void)
{
int x[]={10, 12, 5, 8, 2, 15, 14};
int i;
what(&x[0], 5);
what(&x[2], x[5]);
what(&x[5], x[2]);
for(i=0; i<7; i++)
printf("x[%d]=%3dn", i, x[i]);
return(0);
}
10 12 5 8 2 15 14
5 12 15 8 2 15 14
5 12 5 8 2 2 14
5 12 5 8 2 15 14
4
7.
F!Q78
mystery(4, 6)
<1R$CST
int mystery( int a, int b )
{ if ( b == 1 )
return a;
else
return a + mystery( a, b - 1 );
}
4
6
12
24
1
8.
java
U+,VWHI"
int[][] scores = {{54, 68},{67, 78}, {89, 93}};
:
scores[1][2]
93
scores[1][1]
78
VCJ
3 x 2
XYV
scores[1][0]
67
1
9.
!
speed
C
75
if
fee
$ZH[J
?
if (speed > 35)
fee = 20.0;
else if (speed > 50)
fee = 40.0;
else if (speed > 75)
fee = 60.0;
20.0
40.0
60.0