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
相关推荐
FuckPatience1 小时前
Visual Studio C# 项目中文件后缀简介码事漫谈7 小时前
当AI开始“思考”:我们是否真的准备好了?014-code8 小时前
订单超时取消与库存回滚的完整实现(延迟任务 + 状态机)lly2024068 小时前
组合模式(Composite Pattern)游乐码9 小时前
c#泛型约束Dontla9 小时前
go语言Windows安装教程(安装go安装Golang安装)(GOPATH、Go Modules)chushiyunen9 小时前
python rest请求、requests铁东博客9 小时前
Go实现周易大衍筮法三变取爻baidu_huihui9 小时前
在 CentOS 9 上安装 pip(Python 的包管理工具)南 阳9 小时前
Python从入门到精通day63