Need a project done?

C++ Programming Developer

Search This Blog

Generic Digits Seperator in C++


//Generic Digits Seperator in C++
//Output: Only 1st line is Entered by User.


#include <iostream>

using namespace std;

int main()
{
int x;
cin >> x;
int a[50];
int i = 0;

while (x != 0)
{
a[i] = x%10;
x /= 10;
i++;
}

i--;
int j = 0;

for (; i>=0; i--,j++)
{
cout << j <<". " << a[i] << endl;
}

return 0;
}
"Don't let anyone ever make you feel like you don't deserve what you want."