fixed up the first input section of the code before implementing a new one
This commit is contained in:
parent
1f1d5470bd
commit
eb6781b969
1 changed files with 4 additions and 3 deletions
7
main.c
7
main.c
|
|
@ -123,14 +123,15 @@ int main() {
|
|||
LOIS.weight = 60;
|
||||
printf("Our woman is unknown, she is not %d years old and she weights %dkg. (LOIS.age and LOIS.weight).", LOIS.age, LOIS.weight);
|
||||
|
||||
// INPUT
|
||||
// INPUT (BUT ONLY FOR ONE WORD! STOPS WHEN YOU PUT IN A SPACE)
|
||||
printf("\n\nINPUT BELOW:\n"); // DIVIDER
|
||||
char fruit[20]; //MAX 20 CHARACTERS
|
||||
printf("Pick a fruit: ");
|
||||
char fruit[50]; //MAX 50 CHARACTERS
|
||||
printf("Pick a fruit (SINGLE WORD, EVERYTHING ELSE GETS IGNORED): ");
|
||||
fflush(stdout); // this forces the buffer to print NOW, fixing the "bug" in which it prints out everything AFTER the next line (scanf)
|
||||
scanf("%s", fruit);
|
||||
printf("\nYou choose %s as your fruit!", fruit);
|
||||
|
||||
|
||||
// END
|
||||
return 0;
|
||||
// THIS IS THE CURRENT END OF MY LESSON
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue