you could use stringstreams...
Code:
#include <iostream> //for standard I/O
#include <sstream> //for stringstreams
#include <string> //for strings
int main()
{
std::string line; //this will hold the output
std::stringstream ss(std::ios::out); //this will format the output
ss<<2<<2<<283<<35<<6; //put the integers onto the stream
line=ss.str(); //output the stream into line
ss.str(""); //clear the stream
for(unsigned int i=0;i<line.length();i++) //loop through each char
{
if(i%2==0 && i>0) //for every two
{
ss<<' '; //put a space on the stream
}
ss<<line.at(i); //put the character on the stream
}
line=ss.str(); //save the stream to line
std::cout<<line<<std::endl; //output line
return 0;
}