Thread: Problem

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    11

    Problem

    I have a GUI keypad
    All inputs are strings where user enters nums

    Pressing “1” Key: it will show - 000.01
    Pressing “2” Key: it will show - 000.12
    Pressing “3” Key: it will show - 001.23
    Pressing “4” Key: it will show - 012.34
    Pressing “5” Key: it will show - 123.45

    Can ne1 help me cracking the Algo

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Graphical User Interface? If so, then what platform?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    12345.0 divide by 1e[n]

    where [n] is 7 - number entered by user
    the result should be printed with format like %06.2f (or corresponding width/precision modifiers for ostream)
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Or, similar to varts solution, start with a multiplier of 0.01, multiply the input with this, and multiply the multiplier by 10 for each digit that comes in.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Nov 2007
    Posts
    11
    Quote Originally Posted by Elysia View Post
    Graphical User Interface? If so, then what platform?
    i work on Qtopia , so i m dealing with QStrings not normal strings .

  6. #6
    Registered User
    Join Date
    Nov 2007
    Posts
    11
    Quote Originally Posted by manohar.amit View Post
    i work on Qtopia , so i m dealing with QStrings not normal strings .

    Hi Elysia
    Goddess of the Sky

    I need help I am in deep ........

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I don't know QTopia and I don't know QStrings...
    I only know good old C/C++, Win32 and MFC.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered User
    Join Date
    Nov 2007
    Posts
    11
    Quote Originally Posted by Elysia View Post
    I don't know QTopia and I don't know QStrings...
    I only know good old C/C++, Win32 and MFC.
    okie then how to go about it in a normal string fashion.............

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Fill the string with "000.00".
    Keep a count of how many characters you have received.
    Use a table of [0, 1, 3, 4, 5] as index, then shift each character into the index.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #10
    Registered User
    Join Date
    Nov 2007
    Posts
    11
    Quote Originally Posted by matsp View Post
    Fill the string with "000.00".
    Keep a count of how many characters you have received.
    Use a table of [0, 1, 3, 4, 5] as index, then shift each character into the index.

    --
    Mats
    everything will happen at run time !!!!!
    thats the issue

  11. #11
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    You already got valid answers. Move on.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM