?
Solved

converting numbers to strings. URGENT

Posted on 1998-09-02
13
Medium Priority
?
192 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
  • 5
  • 5
  • 3
13 Comments
 
LVL 1

Accepted Solution

by:
arbitrary earned 100 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

807 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