File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
exercises/18_function_template Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,15 @@ int plus(int a, int b) {
6
6
return a + b;
7
7
}
8
8
9
- // ---- 不要修改以下代码 ----
10
9
int main (int argc, char **argv) {
11
- ASSERT (plus (1 , 2 ) == 3 , " plus two int" );
12
- ASSERT (plus (1u , 2u ) == 3u , " plus two unsigned int" );
13
- ASSERT (plus (1 .f , 2 .f ) == 3 .f , " plus two float" );
14
- ASSERT (plus (1.0 , 2.0 ) == 3.0 , " plus two double" );
10
+ ASSERT (plus (1 , 2 ) == 3 , " Plus two int" );
11
+ ASSERT (plus (1u , 2u ) == 3u , " Plus two unsigned int" );
12
+
13
+ // THINK: 浮点数何时可以判断 ==?何时必须判断差值?
14
+ ASSERT (plus (1 .25f , 2 .5f ) == 3 .75f , " Plus two float" );
15
+ ASSERT (plus (1.25 , 2.5 ) == 3.75 , " Plus two double" );
16
+ // TODO: 修改判断条件使测试通过
17
+ ASSERT (plus (0.1 , 0.2 ) == 0.3 , " How to make this pass?" );
18
+
15
19
return 0 ;
16
20
}
You can’t perform that action at this time.
0 commit comments