Thread: Password

  1. #46
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Unless of course you wanted to write the number out in base 5

  2. #47
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    I must have missed something. Was that a requirement, or do you just work with base 5 a lot?
    My best code is written with the delete key.

  3. #48
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Yeah its for when I work with pennies, nickles, and quarters. One of my professors just loves base conversions. I had to do it in pascal and in assembly. The "Read in a base 9 number and output it as a base 7 number." Fun stuff

  4. #49
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Oh, I had to do that in Haskell. Any base between 2 and 36, and then base -2 for good measure. (Now THAT's a weird number system.)
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #50
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    How do you have a negative base? The base is suppose to represent the number of different symbols that are used.

    In pascal I once did a base (26*2 + 10) 62 system

  6. #51
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    No, in the definition my professor used, a number system is done like so:
    number = SUM[i = 0 to digit-count](base^i * digit-value)

    So base can be any integer except -1, 0 and 1, as long as you have enough digit signs.

    In base -2, with four digits you get these numbers:
    0000 = 0
    0001 = 1
    0010 = -2
    0011 = -1
    0100 = 4
    0101 = 5
    0110 = 2
    0111 = 3
    1000 = -8
    1001 = -7
    1010 = -10
    1011 = -9
    1100 = -4
    1101 = -3
    1110 = -6
    1111 = -5
    etc. etc.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #52
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    I think your professor had to dig deep in his arse to find that defination

  8. #53
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Well...

    The "negabinary" system is listed at Wikipedia as a "positional-like system with non-standard base". The German Wikipedia states in a paragraph that as a generalization of numbering systems, the base need not be a natural number as longas the absolute value of the base is greater than 1.
    http://en.wikipedia.org/wiki/Negabinary

    I even had to implement the addition.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  9. #54
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Hmm interesting. Though something doesn't seem right
    unusual property that negative and positive numbers can be represented without a sign bit
    but it still takes 1 extra bit.

  10. #55
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    This has gone way too off-topic.

    Sportsmaniac, if you're still stuck, start a new thread with your latest code and question(s).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading a password from a file.
    By medeshago in forum C Programming
    Replies: 15
    Last Post: 12-21-2008, 07:20 AM
  2. [Q]Hide Password
    By Yuri in forum C++ Programming
    Replies: 14
    Last Post: 03-02-2006, 03:42 AM
  3. written command line password generator
    By lepricaun in forum C Programming
    Replies: 15
    Last Post: 08-17-2004, 08:42 PM
  4. Password prompt in unix w/o \b
    By rafe in forum C++ Programming
    Replies: 1
    Last Post: 10-09-2002, 08:54 AM
  5. password
    By hammers6 in forum C Programming
    Replies: 1
    Last Post: 10-10-2001, 12:14 AM