| 查看: 1502 | 回复: 10 | |||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | |||
kathy2008木虫 (正式写手)
|
[交流]
【求助】请改正错误 已有7人参与
|
||
|
本人在运行一程序,内有一段程序如下: program ex1009 use func implicit none type(person), target :: p(5) = (/ person("陈同学", 180.0, 75.0), person("黄同学", 170.0, 65.0), person("刘同学", 175.0, 80.0), person("蔡同学", 182.0, 78.0), person("许同学", 178.0, 70.0) /) type(pperson) :: pt(5) 运行后,报错如下: C:\Program Files\Microsoft Visual Studio\MyProjects\chapter 10\9.for(40) : Error: Syntax error, found END-OF-STATEMENT when expecting one of: ( type(person), target :: p(5) = (/ person('陈同学', 180.0, 75.0), ---------------------------------------------------------------------------^ C:\Program Files\Microsoft Visual Studio\MyProjects\chapter 10\9.for(41) : Error: Syntax error, found END-OF-STATEMENT when expecting one of: ( person('黄同学', 170.0, 65.0), -------------------------------------------------------------------^ C:\Program Files\Microsoft Visual Studio\MyProjects\chapter 10\9.for(42) : Error: Syntax error, found END-OF-STATEMENT when expecting one of: ( person("刘同学", 175.0, 80.0), -----------------------------------------------------------------------------------------------^ C:\Program Files\Microsoft Visual Studio\MyProjects\chapter 10\9.for(43) : Error: Syntax error, found END-OF-STATEMENT when expecting one of: ( person("蔡同学", 182.0, 78.0), 请问高手如何改正。谢谢。 |
» 猜你喜欢
求个博导看看
已经有16人回复
想换工作。大多数高校都是 评职称时 认可5年内在原单位取得的成果吗?
已经有8人回复
上海工程技术大学张培磊教授团队招收博士生
已经有4人回复
上海工程技术大学【激光智能制造】课题组招收硕士
已经有5人回复
求助院士们,这个如何合成呀
已经有4人回复
临港实验室与上科大联培博士招生1名
已经有9人回复
需要合成515-64-0,50g,能接单的留言
已经有4人回复
自荐读博
已经有4人回复
写了一篇“相变储能技术在冷库中应用”的论文,论文内容以实验为主,投什么期刊合适?
已经有6人回复
带资进组求博导收留
已经有10人回复
liubin1984
木虫 (著名写手)
不纠结的男人
- 应助: 1 (幼儿园)
- 金币: 2635.1
- 散金: 827
- 红花: 3
- 帖子: 2874
- 在线: 447小时
- 虫号: 627659
- 注册: 2008-10-16
- 性别: GG
- 专业: 粉末冶金与粉体工程

11楼2010-09-07 20:54:01
yfx2003
金虫 (著名写手)
- 应助: 7 (幼儿园)
- 金币: 1434.3
- 红花: 4
- 帖子: 1777
- 在线: 62.9小时
- 虫号: 1037371
- 注册: 2010-06-07
- 专业: 计算机科学的基础理论

3楼2010-08-31 08:45:26
kathy2008
木虫 (正式写手)
- 应助: 0 (幼儿园)
- 金币: 2161.5
- 红花: 2
- 帖子: 328
- 在线: 213.2小时
- 虫号: 558502
- 注册: 2008-05-15
- 性别: GG
- 专业: 材料物理化学
|
如果自己会改正错误,就不会发到这论坛上来了。我是指运行彭国轮Fortran95 的源程序时报错的。文件名为ex0921.for.因为遇到好几个类似的问题,所以请高手指点。程序如下: module typedef type student integer :: Chinese,English,Math,Natural,Social integer :: total end type end module program ex0921 use typedef implicit none integer,parameter :: fileid=10 integer,parameter :: students=20 character(len=80) :: tempstr type(student) :: s(students) type(student) :: total integer i,num,error open(fileid,file="grades.txt",status="old",iostat=error) if(error/=0) then write(*,*) "open grades.txt fail." end if read(fileid,"(A80)" tempstr total=student(0,0,0,0,0) do i=1,students read(fileid,*) num,s(i)%Chinese,s(i)%English,s(i)%Math, s(i)%Natural,s(i)%Social s(i)%total=s(i)%Chinese + s(i)%English + s(i)%Math + s(i)%Natural + s(i)%Social total%Chinese = total%Chinese + s(i)%Chinese total%English = total%English + s(i)%English total%Math = total%Math + s(i)%Math total%Natural = total%Natural + s(i)%Natural total%Social = total%Social + s(i)%Social total%Total = total%Total + s(i)%Total end do write(*,"(7A7)" "座号","中文","英文","数学","自然","社会","总分"do i=1,students write(*,"(7I7)" i, s(i)end do write(*,"(A7,6F7.1)" "平均"real(total%Chinese) real(students), real(total%English) real(students), real(total%Math) real(students), real(total%Natural) real(students), real(total%Social) real(students), real(total%Total) real(students) stop end program |
4楼2010-08-31 09:53:37
yalefield
金虫 (文坛精英)
老汉一枚
- 程序强帖: 3
- 应助: 129 (高中生)
- 贵宾: 0.17
- 金币: 21238.9
- 散金: 3440
- 红花: 66
- 帖子: 12101
- 在线: 759.1小时
- 虫号: 96063
- 注册: 2005-10-07
- 专业: 高等教育学
- 管辖: 计算模拟
5楼2010-08-31 10:06:47







回复此楼
"座号","中文","英文","数学","自然","社会","总分"