Home > Back-end >  C + + implementation reverse output a number of you
C + + implementation reverse output a number of you

Time:10-10

Topic request is very simple, input given a long integer in a line within the scope of the nonnegative integers, from the start bit by bit low output of digits of the integer, behind every number has a space, such as input an integer such as 1234560 output of 0 6 5 4 3 2 1
Due to a lack of understanding, for c + + I try to use an array to solve this problem; Here is my code:
# include

using namespace std;
Int main () {
int n;
Cin> n;
int i=0;
Int a, [10].

While (n) {
A [I]=n % 10;
N=n/10;
i++;

}
for(int j=0; jCout}
return 0;
}

Behind the output in the reverse order when output, also with a lot of Numbers, please elder bosses to give directions,

CodePudding user response:

Dizzy j CodePudding user response:

j CodePudding user response:

reference 1st floor qybao response:
dizzy j

Thank you, didn't see the use of the sizeof
  • Related