diff --git a/.gitignore b/.gitignore index 7e09ec9221a6434f32f31ca2d31312a35c2d1f95..5521f4975a11e444211980cc44590179087b3cce 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ __pycache__ helper.py test.md data_backup/dailycode +test.cpp \ No newline at end of file diff --git "a/data/1.dailycode\345\210\235\351\230\266/1.cpp/1.exercises/solution.md" "b/data/1.dailycode\345\210\235\351\230\266/1.cpp/1.exercises/solution.md" index 8983d483bf673a25984c7ecf43fe8e844a0e2473..37554660c5d7fd7a4713dd8d3f68a0f7489d2c06 100644 --- "a/data/1.dailycode\345\210\235\351\230\266/1.cpp/1.exercises/solution.md" +++ "b/data/1.dailycode\345\210\235\351\230\266/1.cpp/1.exercises/solution.md" @@ -2,6 +2,36 @@

小林和小树兄弟俩相约存零钱。眼看到年底了,兄弟俩决定算算一共存了多少钱,请帮他们算出来。

输入:

两行,第一行三个整数分别对应元、角、分,表示小林存的零钱数;

第二行三个整数分别对应元、角、分,表示小树存的零钱数。

输出:

两人存的钱数(单位:元,保留2位小数)

样例输入:

30 5 5

45 7 4

样例输出:

76.29

+以下程序实现了这一功能,请你填补空白处的内容: + +```cpp +#include +int main() +{ + int y1,j1,f1,y2,j2,f2; + int y,j,f; + int shiftj = 0; + int shifty = 0; + float ss ; + scanf("%d %d %d",&y1,&j1,&f1); + scanf("%d %d %d",&y2,&j2,&f2); + f = f1 + f2; + if(f>=10) + { + f = f-10; + shiftj = 1; + } + j = j1 + j2 + shiftj; + + _____________________ + + y = y1 + y2 + shifty; + ss = y + j/10.0 + f/100.0; + printf("%.2f\n",ss); + return 0; +} +``` + ## template ```cpp @@ -37,7 +67,11 @@ int main() ## 答案 ```cpp - + if(j >= 10) + { + j = j - 10; + shifty = 1; + } ``` ## 选项 @@ -45,17 +79,27 @@ int main() ### A ```cpp - + if(j <= 10) + { + j = j + 10; + shifty = -1; + } ``` ### B ```cpp - + if(j == 10) + { + shifty = 1; + } ``` ### C ```cpp - + if(j >= 10) + { + shifty = 1; + } ``` \ No newline at end of file