Skip to content

Instantly share code, notes, and snippets.

@skvggor
Last active August 29, 2015 14:07
Show Gist options
  • Save skvggor/bfaeba7276e26e93cad0 to your computer and use it in GitHub Desktop.
Save skvggor/bfaeba7276e26e93cad0 to your computer and use it in GitHub Desktop.
C program for Windows systems only (Leonel)
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <ctype.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[])
{
char ch, resposta= 'S' ;
do
{
system ("cls");
ch ='\0';
printf("\n Digite a letra: \n");
scanf("%c",&ch);
printf("\n A letra que você digitado foi: %c", ch);
printf("\n O codigo correspondente em ASCII e': %d\n", ch);
fflush(stdin);
printf ("\n Quer tentar uma nova letra? (S\N)" );
resposta= toupper(getche());
}
while (resposta='S');
printf("\n");
{
exit(resposta != 'S');
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <ctype.h>
/*
Run this program using the console pauser or add your own getch, system("pause") or input loop.
*/
int main(int argc, char *argv[])
{
char ch,
resposta;
do
{
system("cls");
ch = '\0';
printf("\n Digite uma letra: \n");
scanf("%c", &ch);
printf("\n A letra que você digitou foi: %c", ch);
printf("\n O código correspondente em ASCII é: %d \n", ch);
fflush(stdin);
printf("\n Quer tentar uma nova letra? (S/N) ");
resposta = toupper(getche());
} while (resposta == 'S');
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment