Solved

converting numbers to strings. URGENT

Posted on 1998-09-02
13
187 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
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

Suggested Solutions

Title # Comments Views Activity
how to understand recursion 12 229
Best book to learn C++ 4 84
How to convert Structure to vector of byte and vice versa 5 24
C++ Code Issue 4 23
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

808 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