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. Translation

Translation

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
19 Posts 3 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.
  • S sardinka

    my problem is I need to have this value at the end: A-10 b-20 c-30 ... y-25 x-26

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

    At the end of what? I've yet to determine what you are considering input and what you are considering output. Do something simple like: When my program sees input like "input data goes here", I want the output to be "output data goes here"

    S 1 Reply Last reply
    0
    • D David Crow

      At the end of what? I've yet to determine what you are considering input and what you are considering output. Do something simple like: When my program sees input like "input data goes here", I want the output to be "output data goes here"

      S Offline
      S Offline
      sardinka
      wrote on last edited by
      #10

      "input data goes here" : "output data goes here" A : 010 B : 020 C : 030 D : 040 ............... Z : 026 Y : 025

      D 1 Reply Last reply
      0
      • S sardinka

        "input data goes here" : "output data goes here" A : 010 B : 020 C : 030 D : 040 ............... Z : 026 Y : 025

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

        This won't work. See the problem?

        A 010 N 014
        B 020 O 015
        C 030 P 016
        D 040 Q 017
        E 050 R 018
        F 060 S 019
        G 070 T 020
        H 080 U 021
        I 090 V 022
        J 010 W 023
        K 011 X 024
        L 012 Y 025
        M 013 Z 026

        S 1 Reply Last reply
        0
        • D David Crow

          This won't work. See the problem?

          A 010 N 014
          B 020 O 015
          C 030 P 016
          D 040 Q 017
          E 050 R 018
          F 060 S 019
          G 070 T 020
          H 080 U 021
          I 090 V 022
          J 010 W 023
          K 011 X 024
          L 012 Y 025
          M 013 Z 026

          S Offline
          S Offline
          sardinka
          wrote on last edited by
          #12

          I am so sorry. I mistype::(( it should look like this: A 010 N 140 B 020 O 150 C 030 P 160 D 040 Q 170 E 050 R 180 F 060 S 190 G 070 T 200 H 080 U 210 I 090 V 220 J 100 W 230 K110 X 240 L 120 Y 250 M130 Z 260 My output should be: A 10 N 14 B 20 O 15 C 30 P 16 D 40 Q 17 E 50 R 18 F 60 S 19 G70 T 20 H80 U 21 I 90 V 22 J10 W 23 K11 X 24 L 12 Y 25 M13 Z 26

          D 1 Reply Last reply
          0
          • S sardinka

            I am so sorry. I mistype::(( it should look like this: A 010 N 140 B 020 O 150 C 030 P 160 D 040 Q 170 E 050 R 180 F 060 S 190 G 070 T 200 H 080 U 210 I 090 V 220 J 100 W 230 K110 X 240 L 120 Y 250 M130 Z 260 My output should be: A 10 N 14 B 20 O 15 C 30 P 16 D 40 Q 17 E 50 R 18 F 60 S 19 G70 T 20 H80 U 21 I 90 V 22 J10 W 23 K11 X 24 L 12 Y 25 M13 Z 26

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

            You just can't make up your mind, can you? First you state that "it should look like this" and show one table, and then you follow that with "my output should be" and show a completely different table. In the bottom table, do you not see the obvious error? A and J cannot both be 10.

            S 1 Reply Last reply
            0
            • D David Crow

              You just can't make up your mind, can you? First you state that "it should look like this" and show one table, and then you follow that with "my output should be" and show a completely different table. In the bottom table, do you not see the obvious error? A and J cannot both be 10.

              S Offline
              S Offline
              sardinka
              wrote on last edited by
              #14

              Now I understand what you are saying. I am appreciated for your patient. I am just learning C++, so I am not seeing full picture at first. My project is to translate from alpha to numeric starting with the A=10 increase the next letter by 10 and then delete zero before numbers. I got it to work but I am missing zero after the number if number=10…90. What would you recommended to do with the J? :confused:

              D 1 Reply Last reply
              0
              • S sardinka

                Now I understand what you are saying. I am appreciated for your patient. I am just learning C++, so I am not seeing full picture at first. My project is to translate from alpha to numeric starting with the A=10 increase the next letter by 10 and then delete zero before numbers. I got it to work but I am missing zero after the number if number=10…90. What would you recommended to do with the J? :confused:

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

                sardinka wrote: My project is to translate from alpha to numeric starting with the A=10 increase the next letter by 10 and then delete zero before numbers. This will do exactly that: sprintf(Tempcrap1, "%d", (Modi[i] - 64) * 10);

                S 1 Reply Last reply
                0
                • D David Crow

                  sardinka wrote: My project is to translate from alpha to numeric starting with the A=10 increase the next letter by 10 and then delete zero before numbers. This will do exactly that: sprintf(Tempcrap1, "%d", (Modi[i] - 64) * 10);

                  S Offline
                  S Offline
                  sardinka
                  wrote on last edited by
                  #16

                  I copyed your line of code into my program. here my output(what I am getting). Examples: Entered Value:Should be : :((I am getting 9AB : 90102 : 91020 Z73 : 26073 : 26073 9ZY : 92625 : 9260250

                  D 1 Reply Last reply
                  0
                  • S sardinka

                    I copyed your line of code into my program. here my output(what I am getting). Examples: Entered Value:Should be : :((I am getting 9AB : 90102 : 91020 Z73 : 26073 : 26073 9ZY : 92625 : 9260250

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

                    There are still discrepancies. For example, when Z73 is input, you want (and are getting) 26073 as output. Assuming the 26 is for the Z, why does the 7 get a leading 0 but the 3 does not? Use: sprintf(Tempcrap1, "%02d", Modi[i] - 64); when converting letters to numbers, and: sprintf(Tempcrap1, "%d", Modi[i] - 48); otherwise. This will produce:

                    Input : Output
                    9AB : 90102
                    Z73 : 260703
                    9ZY : 92625

                    S 1 Reply Last reply
                    0
                    • D David Crow

                      There are still discrepancies. For example, when Z73 is input, you want (and are getting) 26073 as output. Assuming the 26 is for the Z, why does the 7 get a leading 0 but the 3 does not? Use: sprintf(Tempcrap1, "%02d", Modi[i] - 64); when converting letters to numbers, and: sprintf(Tempcrap1, "%d", Modi[i] - 48); otherwise. This will produce:

                      Input : Output
                      9AB : 90102
                      Z73 : 260703
                      9ZY : 92625

                      S Offline
                      S Offline
                      sardinka
                      wrote on last edited by
                      #18

                      I do not need to produce for 7 a leading 0. In this case should be Z-260 and rest of the string.

                      D 1 Reply Last reply
                      0
                      • S sardinka

                        I do not need to produce for 7 a leading 0. In this case should be Z-260 and rest of the string.

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

                        Do you not find it odd that each time you state what you want, it's different from the time before? Has anyone ever told you it's very difficult to hit a moving target? In this latest post, you want "260" to be the output for "Z", yet in the previous post (i.e., "9ZY : 92625 : 9260250"), you want "26" to be the output for "Z". I think it's time you step back and better define your requirements.

                        1 Reply 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