Solved

converting numbers to strings. URGENT

Posted on 1998-09-02
13
178 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

760 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

19 Experts available now in Live!

Get 1:1 Help Now