Log in

View Full Version : Ask key c


mayank singh mg
Jun 15, 2012, 02:12 AM
How can wedifferentiate between upercase and lower case letters using ask key in c or c++

WildProgrammer
Oct 1, 2012, 09:15 AM
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");

}