| 5 | 1/1 | 返回列表 |
| 查看: 1578 | 回復(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)問(wèn)高手如何改正。謝謝。 |
金蟲 (著名寫手)

木蟲 (正式寫手)
|
如果自己會(huì)改正錯(cuò)誤,就不會(huì)發(fā)到這論壇上來(lái)了。我是指運(yùn)行彭國(guó)輪Fortran95 的源程序時(shí)報(bào)錯(cuò)的。文件名為ex0921.for.因?yàn)橛龅胶脦讉(gè)類似的問(wèn)題,所以請(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ā)表 | |
|---|---|---|---|---|
|
[考研] 081200-11408-276學(xué)碩求調(diào)劑 +6 | 崔wj 2026-03-26 | 6/300 |
|
|---|---|---|---|---|
|
[碩博家園] 求調(diào)劑 330分 085600材料與化工 +3 | gqhhh 2026-03-22 | 3/150 |
|
|
[考研] 本科新能源科學(xué)與工程,一志愿華理能動(dòng)285求調(diào)劑 +7 | AZMK 2026-03-28 | 11/550 |
|
|
[考研] 304求調(diào)劑 +6 | 曼殊2266 2026-03-27 | 6/300 |
|
|
[考研] 材料277求調(diào)劑 +7 | min3 2026-03-24 | 7/350 |
|
|
[考研] 085405 考的11408求各位老師帶走 +3 | Qiu學(xué)ing 2026-03-28 | 3/150 |
|
|
[考研] 求調(diào)劑 +4 | 零八# 2026-03-27 | 4/200 |
|
|
[考研] 材料與化工085600,總分304,本科有兩篇sci參與,求調(diào)劑 +10 | 幸運(yùn)的醬醬 2026-03-22 | 12/600 |
|
|
[考研] 一志愿211,335分,0856,求調(diào)劑院校和導(dǎo)師 +4 | 傾____蕭 2026-03-27 | 5/250 |
|
|
[考研] 求調(diào)劑,一志愿 南京航空航天大學(xué)大學(xué) ,080500材料科學(xué)與工程學(xué)碩 +4 | @taotao 2026-03-26 | 5/250 |
|
|
[考研] 求調(diào)劑 一志愿 本科 北科大 化學(xué) 343 +6 | 13831862839 2026-03-24 | 7/350 |
|
|
[考研] 352求調(diào)劑 +4 | 大米飯! 2026-03-22 | 4/200 |
|
|
[考研] 289求調(diào)劑 +17 | 碩星赴 2026-03-23 | 17/850 |
|
|
[考研] 334分 一志愿武理 材料求調(diào)劑 +4 | 李李不服輸 2026-03-26 | 4/200 |
|
|
[考研] 297求調(diào)劑 +6 | 田洪有 2026-03-26 | 6/300 |
|
|
[考研] 一志愿上海交大生物與醫(yī)藥專碩324分,求調(diào)劑 +6 | jiajunX 2026-03-22 | 6/300 |
|
|
[考研] 一志愿南航材料專317分求調(diào)劑 +5 | 炸呀炸呀炸薯?xiàng)l 2026-03-23 | 5/250 |
|
|
[考研] 277分求調(diào)劑,跨調(diào)材料 +3 | 考研調(diào)劑lxh 2026-03-24 | 3/150 |
|
|
[考研]
|
13659058978 2026-03-24 | 4/200 |
|
|
[考研] 341求調(diào)劑(一志愿湖南大學(xué)070300) +5 | 番茄頭--- 2026-03-22 | 6/300 |
|