Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   C (https://www.askmehelpdesk.com/forumdisplay.php?f=438)
-   -   Ask key c (https://www.askmehelpdesk.com/showthread.php?t=671101)

  • Jun 15, 2012, 02:12 AM
    mayank singh mg
    Ask key c
    How can wedifferentiate between upercase and lower case letters using ask key in c or c++
  • Oct 1, 2012, 09:15 AM
    WildProgrammer
    Hello!

    Here a snip set of code in c++ that ask for a lower case letter and make it Capital you should have what you need in there. Good luck.

    #include <stdio.h>



    int main(int argc, char* argv[])
    {

    char low = "";
    do
    {
    printf("Give me a lower case letter: ");
    low = getchar();
    }
    while(!(low >= 'a' && low <= 'z'));

    int dif = ('a'-'A');

    printf("\n");
    printf("The character chosed is: %c\n", low);
    printf("The ascII code for this character is: %i\n\n", low);

    printf("The uper case of this character is: %c and his ascii code is : %i\n\n", (low - dif), (low - dif));
    printf("\n\n\n\n");

    }

  • All times are GMT -7. The time now is 01:26 PM.