1)How to read the data from keyboard
val i:Int=scala.io.StdIn.readInt()
val i:Float=scala.io.StdIn.readFloat)
val i:String=scala.io.StdIn.readLine()
2)How to exit the program (status code is 1)
System.exit(status=1)
3)How to read the values by Array
for(I->0 to size-1)
a(I)=scala.io.StdIn.readInt()
println("The array is:"+a.mkString(","))
val i:Int=scala.io.StdIn.readInt()
val i:Float=scala.io.StdIn.readFloat)
val i:String=scala.io.StdIn.readLine()
2)How to exit the program (status code is 1)
System.exit(status=1)
3)How to read the values by Array
for(I->0 to size-1)
a(I)=scala.io.StdIn.readInt()
println("The array is:"+a.mkString(","))
No comments:
Post a Comment