package test_33
import scala.io.Source
//成绩分析
object test {
def main(args: Array[String]): Unit = {
//1.读入成绩,按行去读取
val it= Source.fromFile("score.txt").getLines().drop(1)
while (it.hasNext){
val content=it.next()
//使用中文的逗号去拆分字符串
var arr=content.split(",")
val name=arr(0)
val yuwen=arr(1).toInt
val shuxue=arr(2).toInt
val yingyu=arr(3).toInt
val total=yuwen+shuxue+yingyu
val avg=total / 3
println("当前行是",name,yingyu,total)
}
}
}
Scala中字符串
爱吃香菜---www2024-11-28 14:28
相关推荐
青岑CTF1 小时前
攻防世界-Ics-05-胎教版wpLi emily1 小时前
如何通过外汇API平台快速实现实时数据接入?APIshop1 小时前
Java 实战:调用 item_search_tmall 按关键词搜索天猫商品血小板要健康2 小时前
Java基础常见面试题复习合集1淼淼7632 小时前
安装jdk1.8PfCoder2 小时前
WinForm真入门(23)---PictureBox 控件详细用法Legendary_0082 小时前
Type-C 一拖二快充线:突破单口限制的技术逻辑过期动态2 小时前
Java开发中的@EnableWebMvc注解和WebMvcConfigurer接口csbysj20203 小时前
Web 标准老姚---老姚3 小时前
在windows下编译go语言编写的dll库