Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Replace numbers with words?

Replace numbers with words?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
28 Posts 11 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M MoboTech

    I'm beginning C++. When I put a year, it calculate a month and day (ex. 5 23) for a particular holiday. How do I convert these numbers into words. (ex. March Twenty Three) Am I suppose to use individual functions or if-else statement? How is it done? Thanks.

    P Offline
    P Offline
    p_
    wrote on last edited by
    #5

    i think u should use switch() and case to print words ya its little bit lengthy i dont know about any function for this

    1 Reply Last reply
    0
    • M MoboTech

      I'm beginning C++. When I put a year, it calculate a month and day (ex. 5 23) for a particular holiday. How do I convert these numbers into words. (ex. March Twenty Three) Am I suppose to use individual functions or if-else statement? How is it done? Thanks.

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #6

      hey, this is a huge task. if you're really beginner, don't you have anything easier to start with ?


      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      M 1 Reply Last reply
      0
      • T toxcct

        hey, this is a huge task. if you're really beginner, don't you have anything easier to start with ?


        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        M Offline
        M Offline
        MoboTech
        wrote on last edited by
        #7

        My prof. assigned it too me. I know this crap is hard. The first 2 assignment was a piece of cake, but the third I'm really stuck on. he never showed me how to convert number to words before.

        T S 2 Replies Last reply
        0
        • M MoboTech

          I'm beginning C++. When I put a year, it calculate a month and day (ex. 5 23) for a particular holiday. How do I convert these numbers into words. (ex. March Twenty Three) Am I suppose to use individual functions or if-else statement? How is it done? Thanks.

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #8

          You need to work on your Google-fu. Try this[^].

          Steve

          1 Reply Last reply
          0
          • M MoboTech

            My prof. assigned it too me. I know this crap is hard. The first 2 assignment was a piece of cake, but the third I'm really stuck on. he never showed me how to convert number to words before.

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #9

            ahh, so, it's a homework, and you want us to do it for you !!? no way dude ! do it yourslf first, then if you have problems with the code you posted, post specific question about it, but never expect people to do the job for you.


            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

            M 1 Reply Last reply
            0
            • T toxcct

              ahh, so, it's a homework, and you want us to do it for you !!? no way dude ! do it yourslf first, then if you have problems with the code you posted, post specific question about it, but never expect people to do the job for you.


              [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

              M Offline
              M Offline
              MoboTech
              wrote on last edited by
              #10

              I'm doing the best I can do my own homework, I've read over 40 pages in my textbook today trying to figure this shit out. And I'm stuck. Looking at your recent post, you seem to be interested in putting people down or posting useless messages. What do you think tutors are for? Helping with their homework, not doing it for them. And I need a tutor! I'm not asking people to do my homework. If you can't help, don't say nothing.

              T D E 3 Replies Last reply
              0
              • M MoboTech

                I'm doing the best I can do my own homework, I've read over 40 pages in my textbook today trying to figure this shit out. And I'm stuck. Looking at your recent post, you seem to be interested in putting people down or posting useless messages. What do you think tutors are for? Helping with their homework, not doing it for them. And I need a tutor! I'm not asking people to do my homework. If you can't help, don't say nothing.

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #11

                correction sir. i'm a major member of this site, and no, i'm not always pulling people down. i'm doing this only when i'm judging it's necessary; and that's the case here. moreover, as you're talking about "tutors", you have to know that no one is paid to give answers on this forum. we do it for pleasure, but if to OP is not doing it's own tests, no one will do them for him...


                [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                M 1 Reply Last reply
                0
                • T toxcct

                  correction sir. i'm a major member of this site, and no, i'm not always pulling people down. i'm doing this only when i'm judging it's necessary; and that's the case here. moreover, as you're talking about "tutors", you have to know that no one is paid to give answers on this forum. we do it for pleasure, but if to OP is not doing it's own tests, no one will do them for him...


                  [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                  M Offline
                  M Offline
                  MoboTech
                  wrote on last edited by
                  #12

                  you think being a major member of the site makes you better? 8 out 10 of your post are junk. the people you are judging seems to be the beginners, if you believe beginners threads are irritating or stupid than let it be, you don't need to post. I've seen plenty of great helpers here and your not one of them.

                  T C 2 Replies Last reply
                  0
                  • M MoboTech

                    you think being a major member of the site makes you better? 8 out 10 of your post are junk. the people you are judging seems to be the beginners, if you believe beginners threads are irritating or stupid than let it be, you don't need to post. I've seen plenty of great helpers here and your not one of them.

                    T Offline
                    T Offline
                    toxcct
                    wrote on last edited by
                    #13

                    MoboTech wrote:

                    you think being a major member of the site makes you better? 8 out 10 of your post are junk

                    what makes you think so ? being a member for 20 days ? crap ! i have nothing more to argue with you, stupid kid. go to you class, and learn what your teacher teaches you. only then, if you have a technical question, then i'd be glad to help you, but only if you show that you tried a bit by yourself.


                    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                    M 1 Reply Last reply
                    0
                    • T toxcct

                      MoboTech wrote:

                      you think being a major member of the site makes you better? 8 out 10 of your post are junk

                      what makes you think so ? being a member for 20 days ? crap ! i have nothing more to argue with you, stupid kid. go to you class, and learn what your teacher teaches you. only then, if you have a technical question, then i'd be glad to help you, but only if you show that you tried a bit by yourself.


                      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                      M Offline
                      M Offline
                      MoboTech
                      wrote on last edited by
                      #14

                      So what people say is actually true... French are asses! Your no help in this forum. I've got so many great helps from others and I thank you, but yours is below helpful. toxcct should be demoted. :laugh:

                      E J 2 Replies Last reply
                      0
                      • M MoboTech

                        you think being a major member of the site makes you better? 8 out 10 of your post are junk. the people you are judging seems to be the beginners, if you believe beginners threads are irritating or stupid than let it be, you don't need to post. I've seen plenty of great helpers here and your not one of them.

                        C Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #15

                        Dude - this site has been around for a long time. Coming here in the hope that we'll help you when you can't make sense of your course materials ( which will be enough for you to do this, by definition ), and hoping simultaneously to start insulting the people who try to help you, is not very smart. I recommend that you read your homework, and think the problem through. It's kind of trivial. The relevant code has already been posted on this thread. You need to break your date into parts, and then check those parts to convert them to words. No direct conversion exists, you need to find, for example, 31, and replace it with 'thirty-one'.

                        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                        M 1 Reply Last reply
                        0
                        • C Christian Graus

                          Dude - this site has been around for a long time. Coming here in the hope that we'll help you when you can't make sense of your course materials ( which will be enough for you to do this, by definition ), and hoping simultaneously to start insulting the people who try to help you, is not very smart. I recommend that you read your homework, and think the problem through. It's kind of trivial. The relevant code has already been posted on this thread. You need to break your date into parts, and then check those parts to convert them to words. No direct conversion exists, you need to find, for example, 31, and replace it with 'thirty-one'.

                          Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                          M Offline
                          M Offline
                          MoboTech
                          wrote on last edited by
                          #16

                          If you look at my above post, I'm actually thanking the people that helped me. I've posted two threads here today, each has a post by toxcct and they were rude comments. But thanks any ways.

                          E 1 Reply Last reply
                          0
                          • M MoboTech

                            I'm doing the best I can do my own homework, I've read over 40 pages in my textbook today trying to figure this shit out. And I'm stuck. Looking at your recent post, you seem to be interested in putting people down or posting useless messages. What do you think tutors are for? Helping with their homework, not doing it for them. And I need a tutor! I'm not asking people to do my homework. If you can't help, don't say nothing.

                            D Offline
                            D Offline
                            David Crow
                            wrote on last edited by
                            #17

                            MoboTech wrote:

                            I'm doing the best I can do my own homework, I've read over 40 pages in my textbook today trying to figure this sh*t out. And I'm stuck.

                            There's a 99% guarantee that you will not find a chapter titled How to Convert Numbers to Words in said textbook. The only reason I did not use 100% is that there's a chance that some author might use that as an example, but it will never be the focal point of any chapter.

                            MoboTech wrote:

                            Helping with their homework...

                            And what have you tried thus far, even if it failed? Remember, Thomas Edison did not improve the light bulb on his first try. He first had to find 1,000 ways that did not work.

                            MoboTech wrote:

                            If you can't help, don't say nothing.

                            Easily, Tox can do your homework in all of five minutes, but he's smart enough to know that that won't help you one bit. All that aside, what was wrong with the suggestion from NS17?


                            "A good athlete is the result of a good and worthy opponent." - David Crow

                            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                            1 Reply Last reply
                            0
                            • M MoboTech

                              I'm doing the best I can do my own homework, I've read over 40 pages in my textbook today trying to figure this shit out. And I'm stuck. Looking at your recent post, you seem to be interested in putting people down or posting useless messages. What do you think tutors are for? Helping with their homework, not doing it for them. And I need a tutor! I'm not asking people to do my homework. If you can't help, don't say nothing.

                              E Offline
                              E Offline
                              El Corazon
                              wrote on last edited by
                              #18

                              MoboTech wrote:

                              What do you think tutors are for? Helping with their homework, not doing it for them. And I need a tutor! I'm not asking people to do my homework. If you can't help, don't say nothing.

                              I guess the difference is how you ask the question. First such answers are easily googleable. Second if you need a tutor rather than the answer, admit it up front. You'll get far less guff about it than if you admit later it is a homework assignment after someone has done the work for you. And you will get a better answer from one of the regulars demonstrating the methods without giving you the answer. You'll learn more and be more capable of a programmer. Half of programming is learning where to find the answers. It doesn't matter if you have been programming 1 month or 10 years, you will find something beyond your skill on occasion. What you do and how you do it shows your character and skill both. Thus the trouble you are getting from a few members (and you are actually lucky you got the answers). Some people are interested in getting the vote and giving you the answers because they want to get enough votes to be MVP. They are hurting you for their own benefit. Eventually you will not have them to give you an answer, so how do you find the answer? A tutor teaches you how to fish so that you can catch your own meal, not hands you a fish. So far I have seen no one showing you how to fish. I am sure you are overjoyed at that now, but eventually you will not have that person to turn to, and you will be lost. No guff from me, only a word of caution: you are only hurting yourself. Next time ask for some one to give you the technique without the answer. One of the regulars, or even one of the MVP wannabes will help you in a way that benefits you, not them.

                              _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                              1 Reply Last reply
                              0
                              • M MoboTech

                                My prof. assigned it too me. I know this crap is hard. The first 2 assignment was a piece of cake, but the third I'm really stuck on. he never showed me how to convert number to words before.

                                S Offline
                                S Offline
                                Shog9 0
                                wrote on last edited by
                                #19

                                MoboTech wrote:

                                I know this crap is hard.

                                No it's not. And that's not an insult - it really isn't. You have a classic assignment - it shows up in the first couple of weeks in hundreds of textbooks and courses based on them. And you've been assigned it to teach you something. Of course you can just pull the answers off of a web site, but then what have you learned? And so i repeat, it's not hard. But if you don't spend the time learning from your course work, you'll find the hard tasks impossible when eventually you do encounter them. Just a fair warning...

                                ----

                                I don't care what you consider witty, but at least I do not blather on posting nonsense like Jim Crafton.

                                -- Stringcheese, humbled by Crafton's ability to string together multiple sentences

                                J 1 Reply Last reply
                                0
                                • M MoboTech

                                  If you look at my above post, I'm actually thanking the people that helped me. I've posted two threads here today, each has a post by toxcct and they were rude comments. But thanks any ways.

                                  E Offline
                                  E Offline
                                  Eytukan
                                  wrote on last edited by
                                  #20

                                  But he has done a lot of good works to help the beginners come up here. Even I'm one of them. So if you don't know someone completely, just don't comment seeing a few strong messages from them. Yeah he needs to be tough! expects so much of disciplines in the forum. Without him, I'm sure the forum would look a little degraded. He has certainly helped to filter out a lot of stupid questions. Getting his strong comment, one would be afraid to post a similar one next time. He wants the problem to be explained properly,but that doesn't mean that he is required to answer every question that he had asked to be proper. That would atleast help someone to understand the problem better and give a definite answer to it. So either ways he's helping the forum to keep a neat line. It's very unfortunate that you've just joined the forum and talking so rude against a senior member of the same. Anyway I wish you'd get the point and have a nice stay. Just f*ck off.:| -- modified at 10:45 Wednesday 26th September, 2007


                                  Jemmy : Deadline? Pfft, a real programmer eats deadlines for breakfast. :P Mark: I thought real programmers ignored deadlines :sigh: Best wishes to Rexx[^]

                                  1 Reply Last reply
                                  0
                                  • M MoboTech

                                    So what people say is actually true... French are asses! Your no help in this forum. I've got so many great helps from others and I thank you, but yours is below helpful. toxcct should be demoted. :laugh:

                                    E Offline
                                    E Offline
                                    Eytukan
                                    wrote on last edited by
                                    #21

                                    OMG! I missed to read this.Well then, you should ignore my previous message. That was meant for someone who shows respect for others. You need a stronger treatment. , Ok, read my previous message again.


                                    Jemmy : Deadline? Pfft, a real programmer eats deadlines for breakfast. :P Mark: I thought real programmers ignored deadlines :sigh: Best wishes to Rexx[^]

                                    1 Reply Last reply
                                    0
                                    • M MoboTech

                                      I'm beginning C++. When I put a year, it calculate a month and day (ex. 5 23) for a particular holiday. How do I convert these numbers into words. (ex. March Twenty Three) Am I suppose to use individual functions or if-else statement? How is it done? Thanks.

                                      J Offline
                                      J Offline
                                      Jeremy Falcon
                                      wrote on last edited by
                                      #22

                                      For months, do what NS17 mentioned. For the numbers, you can use this function I wrote many moons ago.... http://www.codeproject.com/string/numword.asp[^]

                                      Jeremy Falcon Oatmeal, It's What's for Dinner.[^]

                                      1 Reply Last reply
                                      0
                                      • M MoboTech

                                        So what people say is actually true... French are asses! Your no help in this forum. I've got so many great helps from others and I thank you, but yours is below helpful. toxcct should be demoted. :laugh:

                                        J Offline
                                        J Offline
                                        Jeremy Falcon
                                        wrote on last edited by
                                        #23

                                        MoboTech wrote:

                                        So what people say is actually true... French are asses! Your no help in this forum. I've got so many great helps from others and I thank you, but yours is below helpful. toxcct should be demoted.

                                        Oh, I'm sure you'll be getting a lot of help here in the future. :rolleyes: Really, don't get pissed off if we don't do your homework for you. I only posted my link because it was already there (you could try doing a search you know) and took me like two seconds. I wouldn't have gone out of my way for your homework either. And here's something funny, try COMMUNICATING with your professor about it. Maybe he'll give you pointers. I know it's crazy, but sometimes using your mouth for good works too.

                                        Jeremy Falcon Oatmeal, It's What's for Dinner.[^]

                                        1 Reply Last reply
                                        0
                                        • S Shog9 0

                                          MoboTech wrote:

                                          I know this crap is hard.

                                          No it's not. And that's not an insult - it really isn't. You have a classic assignment - it shows up in the first couple of weeks in hundreds of textbooks and courses based on them. And you've been assigned it to teach you something. Of course you can just pull the answers off of a web site, but then what have you learned? And so i repeat, it's not hard. But if you don't spend the time learning from your course work, you'll find the hard tasks impossible when eventually you do encounter them. Just a fair warning...

                                          ----

                                          I don't care what you consider witty, but at least I do not blather on posting nonsense like Jim Crafton.

                                          -- Stringcheese, humbled by Crafton's ability to string together multiple sentences

                                          J Offline
                                          J Offline
                                          Jeremy Falcon
                                          wrote on last edited by
                                          #24

                                          Shog9 wrote:

                                          You have a classic assignment - it shows up in the first couple of weeks in hundreds of textbooks and courses based on them.

                                          Except the solutions that show up in beginner texts usually suck and don't scale well. *cough* *cough* (plugging my poor, lonely article ;)).

                                          Jeremy Falcon Oatmeal, It's What's for Dinner.[^]

                                          S E 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups