How should i give space between my output numbers while i am storing them in an array ?Like if i ask user to enter numbers and one entered 12345 ,i want to display them as 1 2 3 4 5

hope it help.

#include<iostream>
using namespace std;
int main()
{
        int a[5];
        int i;

        for ( i = 1; i < 6; i++ )
            a[i] = i;
        for ( i = 1; i < 6; i++ )
            cout << i << ' ';
        return a[i];
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.