Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #define LIM 10001
- int buscaVet(char c, char vet[]);
- int main()
- {
- int i, a;
- char alf1[] = "qwertyuiop[]";
- char alf2[] = "asdfghjkl;'";
- char alf3[] = "zxcvbnm,./";
- char str[LIM], carac;
- fflush(stdin);
- gets(str);
- while(strcmp(str, "") != 0)
- {
- for(i = 0; str[i] != '\0'; i++)
- {
- a = buscaVet(str[i], alf1);
- if(a == -1)
- {
- a = buscaVet(str[i], alf2);
- if(a == -1)
- {
- a = buscaVet(str[i], alf3);
- if(a != -1)
- carac = alf3[a - 1];
- }
- else
- carac = alf2[a - 1];
- }
- else
- carac = alf1[a - 1];
- if(a != -1)
- str[i] = toupper(carac);
- }
- printf("%s\n", str);
- fflush(stdin);
- gets(str);
- }
- return 0;
- }
- int buscaVet(char c, char vet[])
- {
- int pos = 0;
- while(pos < strlen(vet) && vet[pos] != tolower(c))
- pos++;
- if(pos == strlen(vet))
- pos = -1;
- return pos;
- }
Advertisement
Add Comment
Please, Sign In to add comment