+ 3
Seprating line of numbers .
I want to enter a line of numbers like (1338265) and seperate the numbers by a space and place them all in an array . How can i do it?
4 Respostas
0
Array a[] of type int, and n is a number:
while(n>0)
{
a[i] =n%10;
cout<<a[i] <<" " ;
n/=10;
i++;
}
It will print reverse order. So use for loop
to print array....
for(int j=0;j<i;j++)
cout<<a[j]<<" ";
- 1
Hi