Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Manipulating user-input text

Question posted by: renzy0113 (Newbie) on July 25th, 2008 11:58 AM
thank you.

how do I change the all the numbers inputted, but the words still stays the same?

like this:
if the user enters,

Mary had 45 lambs.

my program will output,

Mary had XLV lambs.

I am very new at c programming, and i really have no idea.
i already made the code on how to change the Arabic number into Roman, but i don't know how to change the number in a string.

I really appreciate any help. Please help. Thank you. :)
Banfa's Avatar
Banfa
AdministratorVoR
5,039 Posts
July 25th, 2008
12:08 PM
#2

Re: Manipulating user-input text
It is very hard to change or insert something into a string, it is far easier to recreate the string from left to right leaving out the bit you don't want and putting in the bit you do.

Oh yeah and midnight in which time zone? And what educational establishment has that sort of deadline?

Reply
renzy0113's Avatar
renzy0113
Newbie
3 Posts
July 25th, 2008
12:14 PM
#3

Re: Manipulating user-input text
sorry...
four hours from now. GMT+9.

yeah.. like that. it should copy the string entered, but the numbers would be Romanized. how exactly should i do that..? I could change an entered number into a Roman Numeral, but not a number in a string.


Thank you. thank you. thank you.

Reply
oler1s's Avatar
oler1s
Expert
630 Posts
July 25th, 2008
12:21 PM
#4

Re: Manipulating user-input text
Think about what you are doing. You taking each "word" (that is a bunch of letters separated by a space) and repeating them verbatim, unless they are a number, in which case you emit the roman numerals instead. So take the input, extract each word from a string, and emit that word if it is not a number, or the roman numeral.

Reply
renzy0113's Avatar
renzy0113
Newbie
3 Posts
July 25th, 2008
12:24 PM
#5

Re: Manipulating user-input text
I dont know how to do that. :((

which code should i use?
Im sorry. im a total beginner.

Reply
sicarie's Avatar
sicarie
Moderator
3,799 Posts
July 25th, 2008
02:06 PM
#6

Re: Manipulating user-input text
Depends on the language you are writing this in.

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,873 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top C / C++ Forum Contributors