I teach C on the textbook. I'm sitting on linux mint. Gcc compiler
The question itself:
Why when I start to enter data into the program (suppose that I enter: 45.2, 48.3, Speed = 23) I need to press enter then enter another character and only then the program will continue. Why enter another character? Why the first time you press the enter key, the program does not immediately display the values?
#include <stdio.h> void main() { float lantitude; float longitude; char speed[80]; puts ("Data:\n"); while(scanf("%f, %f, %79[^\n]",&lantitude,&longitude,speed)==3); { printf("lantitude: %f, longitude: %f,info: %s", lantitude,longitude,speed); puts(";\n"); } }