| 5 | 1/1 | 返回列表 |
| 查看: 1584 | 回復(fù): 10 | |||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | |||
kathy2008木蟲 (正式寫手)
|
[交流]
【求助】請(qǐng)改正錯(cuò)誤 已有7人參與
|
||
|
本人在運(yùn)行一程序,內(nèi)有一段程序如下: program ex1009 use func implicit none type(person), target :: p(5) = (/ person("陳同學(xué)", 180.0, 75.0), person("黃同學(xué)", 170.0, 65.0), person("劉同學(xué)", 175.0, 80.0), person("蔡同學(xué)", 182.0, 78.0), person("許同學(xué)", 178.0, 70.0) /) type(pperson) :: pt(5) 運(yùn)行后,報(bào)錯(cuò)如下: 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('陳同學(xué)', 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('黃同學(xué)', 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("劉同學(xué)", 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("蔡同學(xué)", 182.0, 78.0), 請(qǐng)問高手如何改正。謝謝。 |
鐵桿木蟲 (正式寫手)
金蟲 (著名寫手)

木蟲 (正式寫手)
|
如果自己會(huì)改正錯(cuò)誤,就不會(huì)發(fā)到這論壇上來了。我是指運(yùn)行彭國輪Fortran95 的源程序時(shí)報(bào)錯(cuò)的。文件名為ex0921.for.因?yàn)橛龅胶脦讉(gè)類似的問題,所以請(qǐng)高手指點(diǎn)。程序如下: 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)" "座號(hào)","中文","英文","數(shù)學(xué)","自然","社會(huì)","總分"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 |
金蟲 (文壇精英)
老漢一枚
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 085601 329分調(diào)劑 +5 | yzsa12 2026-03-31 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 理學(xué)07化學(xué) 303求調(diào)劑 +7 | 睿08 2026-03-27 | 7/350 |
|
|
[考研] 機(jī)械學(xué)碩總分317求調(diào)劑。。! +5 | Acaciad 2026-03-25 | 5/250 |
|
|
[考研] 一志愿浙江大學(xué)工科動(dòng)力工程370,數(shù)一121,專業(yè)課135,現(xiàn)在能去哪里 +3 | 080700調(diào)劑 2026-03-30 | 4/200 |
|
|
[考研] 求調(diào)劑 +4 | 圖鑒212 2026-03-30 | 4/200 |
|
|
[考研] 總分322求生物學(xué)/生化與分子/生物信息學(xué)相關(guān)調(diào)劑 +6 | 星沉uu 2026-03-26 | 7/350 |
|
|
[考研] 南京大學(xué)化學(xué)調(diào)劑 +11 | 景隨風(fēng) 2026-03-29 | 16/800 |
|
|
[考研] 085600,專業(yè)課化工原理,320分求調(diào)劑 +6 | 大饞小子 2026-03-29 | 6/300 |
|
|
[考研] 083000學(xué)碩274求調(diào)劑 +12 | Li李魚 2026-03-26 | 12/600 |
|
|
[考研] 308求調(diào)劑 +8 | 墨墨漠 2026-03-25 | 8/400 |
|
|
[考研] 一志愿中海洋320化學(xué)工程與技術(shù)學(xué)碩求調(diào)劑 +8 | 披星河 2026-03-30 | 8/400 |
|
|
[考研] 085701環(huán)境工程求調(diào)劑 +11 | 多久上課 2026-03-27 | 12/600 |
|
|
[考研] 各位老師好,我的一志愿為北京科技大學(xué)085601材料專碩 +10 | Koxui 2026-03-28 | 10/500 |
|
|
[考研] 328求調(diào)劑 +8 | 嗯滴的基本都 2026-03-27 | 8/400 |
|
|
[考研] 317分 一志愿南理工材料工程 本科湖工大 求調(diào)劑 +12 | 芋泥小鈴鐺 2026-03-28 | 12/600 |
|
|
[考研] 化學(xué)0703 調(diào)劑 306分 一志愿211 +8 | 26要上岸 2026-03-28 | 8/400 |
|
|
[考研] 085602 化工專碩 338分 求調(diào)劑 +12 | 路癡小琪 2026-03-27 | 12/600 |
|
|
[考研] 265求調(diào)劑 +8 | 小木蟲085600 2026-03-27 | 8/400 |
|
|
[考研] 070300化學(xué)求調(diào)劑 +4 | 起個(gè)名咋這么難 2026-03-27 | 4/200 |
|
|
[考研] 348求調(diào)劑 +4 | 小懶蟲不懶了 2026-03-27 | 5/250 |
|