forked from SarahN18/Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumber-words.cpp
More file actions
58 lines (50 loc) · 1.04 KB
/
number-words.cpp
File metadata and controls
58 lines (50 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <iostream>
#include <string>
using namespace std;
void generateCharacters(char num){
switch(num){
case '0':
cout << "ZERO"<<" ";
break;
case '1':
cout << "ONE"<<" ";
break;
case '2':
cout << "TWO"<<" ";
break;
case '3':
cout << "THREE"<<" ";
break;
case '4':
cout << "FOUR"<<" ";
break;
case '5':
cout << "FIVE"<<" ";
break;
case '6':
cout << "SIX"<<" ";
break;
case '7':
cout << "SEVEN"<<" ";
break;
case '8':
cout << "EIGHT"<<" ";
break;
case '9':
cout << "NINE"<<" ";
break;
}
}
void numToWord(string s){
// string s = to_string(n);
int len = s.length();
for(int i = 0; i < len; i++){
generateCharacters(s[i]);
}
}
int main()
{
string n;
getline(cin,n);
numToWord(n);
}