Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Jack Green
- #include "stdafx.h"
- #include <vector>;
- #include <iostream>;
- using namespace std;
- //Declare variables
- int value = 0, valuecopy = 0, divider = 1, digits = 0, position = 0;
- vector<int> numbers;
- void main()
- {
- //Input
- cout <<"Please enter the number: "; cin >> value;
- //Length Calculation
- for(int temp = 0; temp < 1; temp++)
- {
- if((value / divider) >= 1)
- {
- digits++; temp--;
- divider *= 10;
- }
- }
- //Length Output
- cout <<endl<<value<<" is "<<digits<<" digits long."<<endl;
- //Words Calculation
- for(int temp = 0; temp < digits; temp++)
- {
- numbers.push_back(value / (digits - temp));
- }
- //Words Output
- for(int temp = 0; temp < digits; temp++)
- {
- position = (digits - temp);
- if (numbers[position] == 0)
- { cout <<"Zero"; }
- if (numbers[position] == 1)
- { cout <<"One"; }
- if (numbers[position] == 2)
- { cout <<"Two"; }
- if (numbers[position] == 3)
- { cout <<"Three"; }
- if (numbers[position] == 4)
- { cout <<"Four"; }
- if (numbers[position] == 5)
- { cout <<"Five"; }
- if (numbers[position] == 6)
- { cout <<"Six"; }
- if (numbers[position] == 7)
- { cout <<"Seven"; }
- if (numbers[position] == 8)
- { cout <<"Eight"; }
- if (numbers[position] == 9)
- { cout <<"Nine"; }
- }
- cin >>value;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement