Last active
August 29, 2015 14:07
-
-
Save skvggor/bfaeba7276e26e93cad0 to your computer and use it in GitHub Desktop.
C program for Windows systems only (Leonel)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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