fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. vector<string> v = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
  5.  
  6. void helper(int nums) {
  7. if(nums == 0) {
  8. return;
  9. }
  10. int lastDigit = nums%10;
  11. nums /= 10;
  12.  
  13. helper(nums);
  14.  
  15. cout<<v[lastDigit]<<" ";
  16. }
  17.  
  18. int main() {
  19. int nums = 2019;
  20. helper(nums);
  21. return 0;
  22. }
Success #stdin #stdout 0s 544KB
stdin
Standard input is empty
stdout
two zero one nine