Time:09-20
CodePudding user response:
basic will C + +, C is a subset of the C + + o
you written in c + +, to help you "translated into" c
Int count_place (int x)//calculate the number of digits {Int TMP=x; int i=0; While (TMP!=0 & amp; & ) {TMP TMP/=10; i++; } return i; } Void add_vertical (int a, int b)//addition upright {int i; Int place_one=count_place (a); Int place_two=count_place (b); Int sum; Sum=a + b; Int place_three=count_place (sum); If (place_one==place_two) {Printf (" \ n \ t % d ", a); Printf (" \ \ n "t % d, b); } If (place_one & gt; Place_two) {Int the diff=place_one - place_two; Printf (" \ n \ t % d ", a); Printf (" + \ t "); for(i=0; i{Printf (" "); } Printf (" % d \ n ", b); } Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "); //the same method, according to the difference and output the sum of figures is the correct upright }
vertical that a part I have written in C, the remaining basic can get everything right, the C + + into C Int count_place (int x)//calculate the number of digits {Int TMP=x; int i=0; While (TMP!=0 & amp; & ) {TMP TMP/=10; i++; } return i; } Void add_vertical (int a, int b)//addition upright {int i; Int place_one=count_place (a); Int place_two=count_place (b); Int sum; Sum=a + b; Int place_three=count_place (sum); If (place_one==place_two) {Printf (" \ n \ t % d ", a); Printf (" \ \ n "t % d, b); } If (place_one & gt; Place_two) {Int the diff=place_one - place_two; Printf (" \ n \ t % d ", a); Printf (" + \ t "); for(i=0; i{Printf (" "); } Printf (" % d \ n ", b); } Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "); //the same method, according to the difference and output the sum of figures is the correct upright }
Quote: refer to 7th floor response: string of implement Vertical that paragraph, I use C wrote a part of the remaining basic can get everything right, the C + + into C Int count_place (int x)//calculate the number of digits {Int TMP=x; int i=0; While (TMP!=0 & amp; & ) {TMP TMP/=10; i++; } return i; } Void add_vertical (int a, int b)//addition upright {int i; Int place_one=count_place (a); Int place_two=count_place (b); Int sum; Sum=a + b; Int place_three=count_place (sum); If (place_one==place_two) {Printf (" \ n \ t % d ", a); Printf (" \ \ n "t % d, b); } If (place_one & gt; Place_two) {Int the diff=place_one - place_two; Printf (" \ n \ t % d ", a); Printf (" + \ t "); for(i=0; i{Printf (" "); } Printf (" % d \ n ", b); } Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "); //the same method, according to the difference and output the sum of figures is the correct upright } the fifth row a slip of the pen
Vertical that paragraph, I use C wrote a part of the remaining basic can get everything right, the C + + into C Int count_place (int x)//calculate the number of digits {Int TMP=x; int i=0; While (TMP!=0 & amp; & ) {TMP TMP/=10; i++; } return i; } Void add_vertical (int a, int b)//addition upright {int i; Int place_one=count_place (a); Int place_two=count_place (b); Int sum; Sum=a + b; Int place_three=count_place (sum); If (place_one==place_two) {Printf (" \ n \ t % d ", a); Printf (" \ \ n "t % d, b); } If (place_one & gt; Place_two) {Int the diff=place_one - place_two; Printf (" \ n \ t % d ", a); Printf (" + \ t "); for(i=0; i{Printf (" "); } Printf (" % d \ n ", b); } Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "); //the same method, according to the difference and output the sum of figures is the correct upright }
Page link:https//www.codepudding.com/Backend/15735.html