chars

This is a discussion on chars within the C++ Programming forums, part of the General Programming Boards category; How can I make a "char loop"? I mean, a programm that writes all chars from a to z. Do ...

  1. #1
    alanson
    Guest

    Exclamation chars

    How can I make a "char loop"? I mean, a programm that writes all chars from a to z. Do I have to make it with for loop or how? Is there a possibility to make that with enum? Write your solutions.
    Thx in advance
    ALan

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,681
    Code:
    for( char cValue = 'a'; cValue <= 'z'; cValue++ )
        cout << cValue << endl;
    I used to be an adventurer like you... then I took an arrow to the knee.

  3. #3
    Registered User raimo's Avatar
    Join Date
    Jun 2002
    Posts
    107

    Re: chars

    >How can I make a "char loop"? I mean, a programm that writes all chars from a to z.
    >

    With ASCII it is quite easy.

    >Do I have to make it with for loop or how? Is there a possibility to make that with enum?

    No, you do not have to

    >Write your solutions.
    >Thx in advance

    Code:
    #include <iostream>
    int main (){
      for(int i='a';i<='z';i++)
          std::cout<<(char)i;
      return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. while condition question..
    By transgalactic2 in forum C Programming
    Replies: 3
    Last Post: 04-04-2009, 04:49 PM
  2. Counting how many chars in a string
    By tigs in forum C Programming
    Replies: 4
    Last Post: 08-05-2002, 12:25 AM
  3. really got stuck with unsigned chars
    By Abdi in forum C Programming
    Replies: 7
    Last Post: 06-11-2002, 12:47 PM
  4. move chars position
    By SpuRky in forum C Programming
    Replies: 3
    Last Post: 06-09-2002, 02:59 AM
  5. fancy strcpy
    By heat511 in forum C++ Programming
    Replies: 34
    Last Post: 05-01-2002, 04:29 PM

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