Solved

converting numbers to strings. URGENT

Posted on 1998-09-02
13
181 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 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now