Added safegards against Windows

This commit is contained in:
Abreu 2021-09-29 10:27:44 -03:00
parent 7dfedc5ef0
commit 701c8314db
No known key found for this signature in database
GPG Key ID: 64835466FF55F7E1
3 changed files with 5 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
*.out *.out
2021/ 2021/
!2021/0 !2021/0/

View File

@ -13,7 +13,7 @@ int main(){
} }
output = 'A' + 5 * (c - '0'); output = 'A' + 5 * (c - '0');
scanf("%c", &c); scanf("%c", &c);
output += (c - '0'); output += c - '0';
if (output <= 'Z'){ if (output <= 'Z'){
printf("%c", output); printf("%c", output);
continue; continue;

View File

@ -1,11 +1,12 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
int main () { int main () {
int n = 0; int n = 0;
char c; char c;
for (scanf("%d\n", &n); n > 0; n--) { for (scanf("%d\n", &n); n > 0; n--) {
while (scanf("%c", &c) && c != '\n') { while (scanf("%c", &c) != EOF && !iscntrl(c)) {
switch (c) { switch (c) {
case 'D': case 'D':
printf("Rolada tatica ninja.\n"); printf("Rolada tatica ninja.\n");
@ -24,9 +25,9 @@ int main () {
break; break;
case 'A': case 'A':
printf("Nem ferrando. Vou de agentes mesmo.\n"); printf("Nem ferrando. Vou de agentes mesmo.\n");
break;
} }
} }
scanf(" ");
} }
return 0; return 0;
} }