Read input numbers separated by spaces

前端 未结 4 1783
迷失自我
迷失自我 2021-02-01 16:49

This may be a total beginner\'s question, but I have yet to find an answer that works for me.

Currently, I\'m writing a program for a class that takes in a user\'s input

4条回答
  •  梦如初夏
    2021-02-01 17:41

    You'll want to:

    • Read in an entire line from the console
    • Tokenize the line, splitting along spaces.
    • Place those split pieces into an array or list
    • Step through that array/list, performing your prime/perfect/etc tests.

    What has your class covered along these lines so far?

提交回复
热议问题