I have to do this program on Visual studio. Some help would be appreciated please:
Write a program that prompts the user to input a four-digit positive integer. The program then outputs the digits of the number, one digit per line. For example , if the input is 3245, the output is:
3
2
4
5
#include <iostream>
int main()
{
int n = 4;
char a[n+1];//Create an extra space to store the null character at the end
std::cout<<"Enter a "<<n<<" digit number: ";
std::cin.get(a,n+1);
for(int i=0;i<n+1;i++)
{
std::cout<<a[i]<<"\n";
}
return 0;
}