24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 1589  |  回复: 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),

请问高手如何改正。谢谢。
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yalefield

金虫 (文坛精英)

老汉一枚

★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
余泽成(金币+1):辛苦了! 2010-08-31 15:45:12
引用回帖:
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),

与程序关系不大,与您的英语水平关系很大。

Syntax error
“句法错误:”

Fortran,能这么换行吗?
俺闭关多年,真不知道世事变迁。
5楼2010-08-31 10:06:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 11 个回答

yfx2003

金虫 (著名写手)


小木虫(金币+0.5):给个红包,谢谢回帖交流
不知道这个 //干嘛
Signyournicknamehere
3楼2010-08-31 08:45:26
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

kathy2008

木虫 (正式写手)

如果自己会改正错误,就不会发到这论坛上来了。我是指运行彭国轮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
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

鼻涕牛

金虫 (初入文坛)

★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
nono2009(金币+1):鼓励应助。 2010-09-03 06:56:36
换行要加续行符的,建议重新看一下续行的内容。续行标志使用符号&
纵浪大化中,不喜亦不惧。应尽便须尽,无复独多虑
6楼2010-09-02 19:49:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 材料与化工272求调剂 +24 阿斯蒂芬2004 2026-03-28 24/1200 2026-03-31 15:02 by xixiangyue6220
[考研] 282求调剂 不挑专业 求收留 +4 Yam. 2026-03-30 5/250 2026-03-31 14:41 by 王亮_大连医科大
[考研] 一志愿哈尔滨工业大学材料与化工方向336分 +13 辰沐5211314 2026-03-26 13/650 2026-03-31 14:37 by 记事本2026
[考研] 材料专硕调剂 +12 椰椰。 2026-03-29 12/600 2026-03-31 10:52 by foria
[考研] 276求调剂 +3 赵久华 2026-03-29 3/150 2026-03-31 10:06 by cal0306
[考研] 085600,专业课化工原理,320分求调剂 +6 大馋小子 2026-03-29 6/300 2026-03-31 10:03 by 氯化亚硝酰
[考研] 085600材料与化工329分求调剂 +5 这是有太阳哇 2026-03-25 5/250 2026-03-31 09:59 by luoyongfeng
[考研] 26考研-291分-厦门大学(085601)-柔性电子学院材料工程专业求调剂 +5 min3 2026-03-24 6/300 2026-03-30 18:42 by 544594351
[考研] 292求调剂 +13 是妍子也是研子 2026-03-30 13/650 2026-03-30 18:01 by 小徐0109
[考研] 295求调剂 +5 wei-5 2026-03-26 5/250 2026-03-30 08:34 by 探123
[考研] 311求调剂 +6 冬十三 2026-03-24 6/300 2026-03-29 20:45 by 无际的草原
[考研] 总分293求调剂 +8 加一一九 2026-03-25 11/550 2026-03-29 19:53 by 无际的草原
[考研] 一志愿北京理工大学本科211材料工程294求调剂 +8 mikasa的围巾 2026-03-28 8/400 2026-03-29 12:48 by 无际的草原
[考研] 本科双非材料,跨考一志愿华电085801电气,283求调剂,任何专业都可以 +6 芝士雪baoo 2026-03-28 8/400 2026-03-29 08:16 by 松花缸1201
[考研] 压国家一区线,求导师收留,有恩必谢! +7 迷人的哈哈 2026-03-28 7/350 2026-03-28 16:47 by 催化大白
[考研] 一志愿厦门大学化学学硕307求调剂 +10 y7czhao 2026-03-26 10/500 2026-03-28 14:23 by 唐沐儿
[考研] 304求调剂 +6 曼殊2266 2026-03-27 6/300 2026-03-28 14:10 by 唐沐儿
[考研] 0703化学求调剂,各位老师看看我!!! +5 祁祺祺 2026-03-25 5/250 2026-03-27 21:44 by 东方猪猪
[考研] 285求调剂 +4 AZMK 2026-03-27 7/350 2026-03-27 20:59 by AZMK
[考研] 341求调剂 +7 青柠檬1 2026-03-26 7/350 2026-03-27 00:19 by wxiongid
信息提示
请填处理意见