Mar 8, 2016 at 12:30pm
The number can be literally any number, lets say it is 1425. The program needs to print out:
"1 4 2 5"
Is this possible with a while loop?
Mar 8, 2016 at 1:27pm
1 2 3 4 5 6 7 8 9 10 11 12
|
#include <iostream>
#include <sstream>
int main()
{
int someNumber = 1425;
std::stringstream stream;
stream << someNumber;
char singleChar;
while (stream >> singleChar && std::cout << singleChar << " ");
}
|
Last edited on Mar 8, 2016 at 1:29pm