#include<stdio.h>
#include<stdlib.h>
char StrUpDwn(char ch);
int main(void)
{
char chr;
while(1)
{
printf("caracter: ");
scanf("%c",&chr);
printf("caracter UpDown: %c\n",StrUpDwn(chr));
system("pause");
getchar();
system("cls");
}
return 0;
}
char StrUpDwn(char ch)
{
if((ch>='a')&&(ch<='z')) /*se se tratar de um caracter minusculo converter maiusculo*/
return ch-('i'-'I');
else
if((ch>='A')&&(ch<='Z')) /*se se tratar de um caracter maiusculo converter minusculo*/
return ch+('i'-'I');
else
return ch;
}
Edited by kandrade foi acrescentado o getchar afim de evitar que a tecla enter interfira na requisição do próximo caracter a ser modificado. E quando não for letra retorna o próprio caracter.
Question
bmn
foi acrescentado o getchar afim de evitar que a tecla enter interfira na requisição do próximo caracter a ser modificado. E quando não for letra retorna o próprio caracter.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.