Solved

converting numbers to strings. URGENT

Posted on 1998-09-02
13
188 Views
Last Modified: 2010-04-02
I have numbers like (28) and i want to find a program or a place to get information to do this:
 28=twenty eight.
Another thing i´m spanish so what i really want is 28=veintiocho
Do you know where are programs to do it?
Thank you very much.
0
Comment
Question by:sonia081198
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
13 Comments
 
LVL 1

Accepted Solution

by:
arbitrary earned 50 total points
ID: 1171886
what U should do is actually use %  and / operators
to divide the number.
then u must use an array of strings to connect it to,
u can write a recursive function for it.
i think this will help you a little bit to get the IDEA but I
didn't try it on any enviroment.
ValArray,ValStr are supposed to be
//===============================================================
static int round = 0;
void SetToText(int number , CString& StringOut)
{
  if(number>10)
  {  
      round++;
      SetToText(int , StringOut);
      StringOut += ValArray[number%(round*10)];
      StringOut += ValStr[round--];
      number/=10;  
      return;

  }
  if(number)
  StringOut += ValArray[number%10];
  StringOut += "\n" ;    
  return ;
}
//===============================================================
0
 

Author Comment

by:sonia081198
ID: 1171887
i have a number with 14 digits, so it´s i supposse it will be very hard to implement it.
0
 
LVL 3

Expert Comment

by:xyu
ID: 1171888
I thinks it is classwork so You shouldn't ask it here... an nobody should answer...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:arbitrary
ID: 1171889
it won't .
just make some arrays of text .
and think recursively.
0
 

Author Comment

by:sonia081198
ID: 1171890
Sorry my english isn´t very good, i don´t understand the word
classwork, Are you telling me that my question is a work that
my teachers are asking for?
or when you say classwork you mean that what i must do is to implement a class?
0
 
LVL 3

Expert Comment

by:xyu
ID: 1171891
Your teachers are asking for?

0
 

Author Comment

by:sonia081198
ID: 1171892
Dear XYU:
FOR XYU, ONLY FOR YOUR EYES:
i´m at work, i´m a spanish girl, i´m TELECOMUNICATIONS ingenieer.
I´m working as a ANALIST/PROGRAM, i´m developing a VC++ application for an enterprise. The work desarrollated till the moment is inmense, and we are looking for some details, like to convert numbers to letters in Spanish.
So my universitary days finished long time ago.
What i´ve done is to ask for something that some could have done, or could tell me where to find information about it. THE REASON WHY:
There´s an idea in the mind of an object programmer, COMPONENTS OR OBJETS RE-usability , when someone has developed and object, others use it, AND THEY DO NOT CREATE IT AGAIN.
I suppose that you must be very qualificated, but what i person never forget is what he is, an a person always must think that the other ones, can be less intelligent. Because if we think that the others must know what we know, THE OTHERS will never learn. But more things, you will never learn because the others will never tell you.
I hope you never ask, because if people answer you like you have answered me you will fell very depreased.
0
 
LVL 1

Expert Comment

by:arbitrary
ID: 1171893
well it is infinite I'm sorry I resubmitted the answer and apperantly it didn't refresh it ,
it suppose to be :
//===============================================================
static int round = 0;
void SetToText(int number , CString& StringOut)
{
  if(number>10)
  {    
      round++;
      SetToText(number/10,StringOut);
      StringOut += ValArray[number%(round*10)];
      StringOut += ValStr[round--];
      number/=10;  
      return;

  }
  if(number)
  StringOut += ValArray[number];
  StringOut += "\n" ;      
  return ;
}
//===============================================================
 
 
 
   
 

0
 
LVL 3

Expert Comment

by:xyu
ID: 1171894
ok ok ok ok .... it's was strange question... because the answer code is about 20 lines... and it's look like classwork :)
sorry.... I'm not sure there are any 3d party objects to do that... but You can write Your own... :) it's easy... just dont froget about exceptions beetween 10 and 20 :) like twelve .... (i don't know spanish) :).... about thinking recursively ... not here... its typical iterational task... :)

Yes i'm asking questions sometimes.... but before doing that... i using all books i can get (or trying to "invent a wheel") to answer by myself :) its a good practice :)
It's a good practice
0
 
LVL 3

Expert Comment

by:xyu
ID: 1171895
and about arbitrary... i'll kick his ass for such example (to bad for his age...) he is sitting in 1.5 meters from me :)
0
 
LVL 1

Expert Comment

by:arbitrary
ID: 1171896
1.2

0
 
LVL 1

Expert Comment

by:arbitrary
ID: 1171897
well points->?
0
 
LVL 3

Expert Comment

by:xyu
ID: 1171898
arbitraty: Yaniv contact me via E-mail...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question