Thread: doubt in switch case

  1. #1
    Registered User
    Join Date
    Apr 2007

    doubt in switch case


    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.


  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    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.

    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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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.

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, 02: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, 02:07 AM