letter-grade.c: Change scanf usage to fgets
This commit is contained in:
parent
b45e3670cc
commit
1bd69ff2e4
@ -1,9 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
int input;
|
||||
scanf("%i", &input);
|
||||
printf("Your input was: %i\n", input);
|
||||
char inputText[4];
|
||||
fgets(inputText, 4, stdin);
|
||||
printf("inputText: %s\n", inputText);
|
||||
long int input;
|
||||
input = strtol(inputText, NULL, 0);
|
||||
printf("input: %i\n", input);
|
||||
|
||||
if ((input >= 0) && (input <= 100)) {
|
||||
char letter;
|
||||
@ -35,4 +39,4 @@ int main() {
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user