Hey guys...

I want to write a program that transforms numbers into letters and letters into numbers...

for example 20 would be transformed into twenty

I have this but I don't know what's missing or what's the problem... help please

#include <iostream>
#include <string>

using namespace std;
using std::string;
void ones(string);

int main(){

int number;


case 1: ones(number);


return 0;


void ones(int numero)
int x;
x=atoi (numero);

case 1: cout<<"one"<<endl;
case 2: cout<<"two"<<endl;
case 3: cout<<"three"<<endl;
case 4: cout<<"four"<<endl;
case 5: cout<<"five"<<endl;
case 6: cout<<"six"<<endl;
case 7: cout<<"seven"<<endl;
case 8: cout<<"eight"<<endl;
case 9: cout<<"nine"<<endl;
case 0: cout<<"zero"<<endl;



You have number declared as an integer, but you are treating it as a string. There is no "int" class, so you cannot use the dot operator as you do in line 17. Use an if statement instead of the switch statement on line 17:

if (number >= 0 && number < 10)

And please dont use


it is not a good approach.. use getch etc instead :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.