| 5 | 1/1 | 返回列表 |
| 查看: 1580 | 回復(fù): 10 | |||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | |||
kathy2008木蟲 (正式寫手)
|
[交流]
【求助】請改正錯誤 已有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)行后,報錯如下: 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), 請問高手如何改正。謝謝。 |
木蟲 (正式寫手)
|
如果自己會改正錯誤,就不會發(fā)到這論壇上來了。我是指運(yùn)行彭國輪Fortran95 的源程序時報錯的。文件名為ex0921.for.因為遇到好幾個類似的問題,所以請高手指點(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)" "座號","中文","英文","數(shù)學(xué)","自然","社會","總分"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ā)表 | |
|---|---|---|---|---|
|
[考研] 290求調(diào)劑 +3 | dfffsar 2026-03-29 | 3/150 |
|
|---|---|---|---|---|
|
[考研] 【求調(diào)劑】085601材料工程專碩 | 總分272 | +7 | 腳滑的守法公民 2026-03-27 | 7/350 |
|
|
[考研] 2026年華南師范大學(xué)歡迎化學(xué),化工,生物,生醫(yī)工等專業(yè)優(yōu)秀學(xué)子加入! +3 | llss0711 2026-03-28 | 6/300 |
|
|
[考研] 330分求調(diào)劑 +5 | qzenlc 2026-03-29 | 5/250 |
|
|
[考研] 11408軟件工程求調(diào)劑 +3 | Qiu學(xué)ing 2026-03-28 | 3/150 |
|
|
[考研] 085602 化工專碩 338分 求調(diào)劑 +12 | 路癡小琪 2026-03-27 | 12/600 |
|
|
[考研]
|
y7czhao 2026-03-26 | 10/500 |
|
|
[考研] 299求調(diào)劑 +7 | 嗯嗯嗯嗯2 2026-03-27 | 7/350 |
|
|
[考研] 292求調(diào)劑 +14 | 鵝鵝鵝額額額額?/a> 2026-03-25 | 15/750 |
|
|
[考研] 275求調(diào)劑 +10 | jjjjjjjjjjl 2026-03-27 | 10/500 |
|
|
[考研] 266分求材料化工冶金礦業(yè)等專業(yè)的調(diào)劑 +4 | 哇呼哼呼哼 2026-03-26 | 4/200 |
|
|
[考博] 26申博 +3 | 加油沖啊! 2026-03-26 | 3/150 |
|
|
[考研] 085600材料與化工調(diào)劑 +10 | A-哆啦Z夢 2026-03-23 | 16/800 |
|
|
[考研] 考研化學(xué)308分求調(diào)劑 +10 | 你好明天你好 2026-03-23 | 12/600 |
|
|
[考研] 求調(diào)劑 +3 | 劉柯@ 2026-03-24 | 4/200 |
|
|
[考研] 調(diào)劑求收留 +7 | 果然有我 2026-03-26 | 7/350 |
|
|
[考研] 334分 一志愿武理-080500 材料求調(diào)劑 +4 | 李李不服輸 2026-03-25 | 4/200 |
|
|
[考研] 生物技術(shù)與工程 +3 | 1294608413 2026-03-25 | 4/200 |
|
|
[考研] 一志愿武理085500機(jī)械專業(yè)總分300求調(diào)劑 +3 | an10101 2026-03-24 | 7/350 |
|
|
[考研] 一志愿山東大學(xué)藥學(xué)學(xué)碩求調(diào)劑 +3 | 開開心心沒煩惱 2026-03-23 | 4/200 |
|