Hi!How can I loop A to Z?and why does my looping in 1 to 10000 starts only at 9702 not 1?

4 Answers

Relevance
  • ?
    Lv 6
    1 decade ago
    Favorite Answer

    HUH???? Not sure about the second part.

    Loop from A-Z, assuming capital letters, just add 1 to the ascii 65, allowing i to start at 65.

    Source(s): CS Prof
  • 1 decade ago

    1. There are a couple of ways to do the A to Z depending on your language - but you want to loop from the code from the letter 'A' to the code for the letter 'Z'.

    In c/c++ you can just loop as in

    for(i='A'; i<='Z'; i++) {

    // code

    }

    2. With you other loop 1..10000 it may be that te variable is a char or short int and it wants a long int. Or it might be a condtion test in your loop ie if i > 972 do the rest...

    HTHs

  • 1 decade ago

    May I have a look at your source code for 1 to 10000 loop.

    With regards to your A to Z you can apply an implicit cast on a int .

    (char) c

  • 1 decade ago

    on your 1-10000 make sure that the variable your using to count is cleared. if thats not it then ya got me...

Still have questions? Get your answers by asking now.