doubt in switch case

This is a discussion on doubt in switch case within the C Programming forums, part of the General Programming Boards category; hello, i have a doubt about how to write a switch case for a big program like spreadsheet wherein i ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    21

    doubt in switch case

    hello,

    i have a doubt about how to write a switch case for a big program like spreadsheet wherein i give the values starting from A=0,B=1,C=2,...Z=25,AA=26,AB=27,....AZ=..and so on up to ZZ=701

    i am not understanding how to write such a big switch case.could someone help me out with the logic.

    Regards,
    cutelucks

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    First of all, you probably don't want to do it that way!

    Second, what is it you are having trouble with - it seems straight forward enough, aside from being very tedious and longwinded.

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

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    700 cases?

    Surely the model for a spreadsheet looks something like a 2D array, and you perform some calculation to turn say "AB" into an array subscript.

    If you understand base 10, then this would be base 26.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Number to Word (Billions)
    By myphilosofi in forum C Programming
    Replies: 34
    Last Post: 02-04-2009, 01:09 AM
  2. Format Precision & Scale
    By mattnewtoc in forum C Programming
    Replies: 1
    Last Post: 09-16-2008, 10:34 AM
  3. Switch Case
    By FromHolland in forum C++ Programming
    Replies: 7
    Last Post: 06-13-2003, 03:51 AM
  4. enumeration with switch case?
    By Shadow12345 in forum C++ Programming
    Replies: 17
    Last Post: 09-26-2002, 04:57 PM
  5. rand()
    By serious in forum C Programming
    Replies: 8
    Last Post: 02-15-2002, 01:07 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21