I am very new to programming. I am trying to find each seperate digit of a 5 digit number in a sequence and then print each seperate number. Hopefully my code will explain better what I am trying to do. Any other ways to make this more efficient would also be nice. Thanks,
Why are you using the dangerous C-string instead of a std::string?
If you try to enter 5 digits into your C-string you will overflow the array, a std::string would not have this problem. Remember a C-string must be terminated by the end of string character ('\0') so an array of size 5 only has room for 4 "digits" along with the end of string character.
You should also never try to get input into a C-string with a method that doesn't limit the number of characters it will try to retrieve. The extraction operator can be limited by using the setw() manipulator.
So I was able to get the results I wanted. This is the code I used to make it happen. There is probably an easier, more condensed way of doing it though.