I\'m trying to learn c++ on my own and I\'ve hit a bit of a road block. The problem is I need to take an integer,split it into its digits and get the sum of the digits and
Push the digits onto a stack.
After you've gotten all the digits,
sum = 0 ; while( stack not empty ) { pop the stack to get a digit sum += digit display digit } display sum
You need a stack, you say? Use the STL's stack: std::stack
std::stack