From 5a6ab9faf253d3a25c559ec13db081d956fe706e Mon Sep 17 00:00:00 2001 From: Clay Smith Date: Tue, 7 Feb 2023 01:13:52 -0600 Subject: Done except fix scanf issue and add more controllers. --- student.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'student.c') diff --git a/student.c b/student.c index 908daa9..b0437fc 100644 --- a/student.c +++ b/student.c @@ -1,24 +1,18 @@ #include -#include #include "user_defs.h" int main(void) { - char buffer[100]; - int num = -1, type = -1, code = -1, value = -1; - double time = -1; - int scan = -2; - char c; + char buffer[100]; fgets(buffer, 99, stdin); //mandatory to fix controller programs input stream, not needed if they use fgets and sscanf instead of scanf + + int num = -2, type = -2, code = -2, value = -2; + double time = -2; + + while (1) { - fgets(buffer, 99, stdin); - //printf("%s", buffer); - //if (buffer[0] == '1') { - // printf("first value is 1\n"); - // } - // scan = sscanf(buffer, "%d %lf %d %d %d\n", &num, &time, &type, &code, &value); - // printf("%d\n", scan); - scanf("%d %lf %d %d %d\n", &num, &time, &type, &code, &value); + scanf("%d %lf %d %d %d", &num, &time, &type, &code, &value); printf("%d, %lf, %d, %d, %d\n", num, time, type, code, value); } + return 0; } -- cgit v1.2.1