Skip to content

Instantly share code, notes, and snippets.

@carlosbrando
Created May 8, 2011 01:35
Show Gist options
  • Select an option

  • Save carlosbrando/961022 to your computer and use it in GitHub Desktop.

Select an option

Save carlosbrando/961022 to your computer and use it in GitHub Desktop.
Exemplo de uso de getchar e putchar.
#include <stdio.h>
#include <ctype.h>
main(void) {
char ch;
printf("Entre com algum texto (digite um ponto para sair).\n");
do {
ch = getchar();
if (islower(ch))
ch = toupper(ch);
else
ch = tolower(ch);
putchar(ch);
} while(ch != '.');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment