hongsy0189   1년 전

while문의 조건만 바꾸었습니다

위 코드가 틀린 이유는 뭔가요

nahwasa   1년 전

https://cplusplus.com/referenc...
----
scanf : 
If a reading error happens or the end-of-file is reached while reading, the proper indicator is set (feof or ferror). And, if either happens before any data could be successfully read, EOF is returned.
----
EOF : It is a macro definition of type int that expands into a negative integral constant expression (generally, -1).

----

이 문제는 eof (end of file) 까지 입력을 받아야하고, scanf에서 eof 시 -1을 리턴해주기로 되어 있습니다.

댓글을 작성하려면 로그인해야 합니다.