Reading multiple lines of input with scanf

前端 未结 4 476
时光取名叫无心
时光取名叫无心 2020-12-25 08:52

Writing a program for class, restricted to only scanf method. Program receives can receive any number of lines as input. Trouble with receiving input of multiple lines with

4条回答
  •  自闭症患者
    2020-12-25 09:49

    I'll give you a hint.

    You need to repeat the scanf operation until an "EOF" condition is reached.

    The way that's usually done is with the

    while (!feof(stdin)) {
    }
    

    construct.

提交回复
热议问题