24小时热门版块排行榜    

Znn3bq.jpeg
查看: 2332  |  回复: 5

exabyss916

新虫 (小有名气)

[求助] ifort和gfortran无格式输出的区别

比如有一个长度为20的数组A(20),用无格式输出:

write(10,*)A

gfortran编译的结果正确显示,A(1),A(2),...,A(20)都输出到一行。

ifort编译的结果却分行显示了,每行只有3个数,如何让输出结果只有一行?
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

snoopyzhao

至尊木虫 (职业作家)

【答案】应助回帖


余泽成(金币+1): 谢谢参与应助! 2011-11-19 14:30:48
exabyss916(金币+2): 2011-11-23 09:13:44
那你就用格式化方式输出就是了……
2楼2011-11-19 10:56:23
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

锐利的碎片

木虫 (正式写手)

star watcher

【答案】应助回帖


xzhdty(金币+1): 欢迎常来程序语言看看 2011-11-19 12:38:07
exabyss916(金币+2): 2011-11-23 09:13:12
do i=1,20
    write(*,'(G18.10)',advance='no') A(i)
end do
或者
write(*,'(20G18.10)') A
无格式输出的结果不同编译器都不一样,所以输出时应该明确给出格式。
3楼2011-11-19 11:02:42
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

magang26

金虫 (小有名气)

【答案】应助回帖

exabyss916(金币+1): 2011-11-30 15:11:53
统一楼上的,格式化输出。
write(*,"(20F12.3)" (A(i),i=1,20)

不明白楼上的G是什么意思?有这个类型?
成长吧
4楼2011-11-30 12:22:41
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

magang26

金虫 (小有名气)

【答案】应助回帖


jjdg(金币+1): 感谢参与 2011-11-30 16:09:15
统一楼上的,格式化输出。
write(*,"(20F12.3)" (A(i),i=1,20)

不明白楼上的G是什么意思?有这个类型?
成长吧
5楼2011-11-30 12:23:26
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

snoopyzhao

至尊木虫 (职业作家)

【答案】应助回帖

★ ★
jjdg(金币+1): 感谢参与 2011-11-30 16:09:03
余泽成(金币+1): 谢谢参与应助! 2011-12-02 17:23:36
引用回帖:
5楼: Originally posted by magang26 at 2011-11-30 12:23:26:
统一楼上的,格式化输出。
write(*,"(20F12.3)" (A(i),i=1,20)

不明白楼上的G是什么意思?有这个类型?

Fortran 77 标准中有这个类型,不过不常用,呵呵……

[qutoe]
13.5.9.2.3 G Editing.
The Gw.d and Gw.dEe edit descriptors indicate that the external field occupies w positions, the fractional part of which consists of d digits, unless a scale factor greater than one is in effect, and the exponent part consists of e digits.

G input editing is the same as for F editing ( 13.5.9.2.1).

The method of representation in the output field depends on the magnitude of the datum being edited. Let N be the magnitude of the internal datum. If N < 0.1 or N >= 10**d,Gw.d output editing is the same as kPEw.d output editing and Gw.dEe output editing is the same as kPEw.dEe output editing, where k is the scale factor currently in effect. If N is greater than or equal to 0.1 and is less than 10**d , the scale factor has no effect, and the value of N determines the editing as follows:

________________________________________________
     |                       |                       |
     |_Magnitude_of_Datum____|__Equivalent_Conversion|
     |                       |                       |
     | 0.1=N<=1              |  F(w-n).d, n('b')     |
     |                       |                       |
     | 1<=N<10               |  F(w-n).(d-1), n('b') |
     |                       |                       |
     |   .                   |        .              |
     |   .                   |        .              |
     |   .                   |        .              |
     | 10**(d-2)<=N<10**(d-1)|  F(w-n).1, n('b')     |
     |                       |                       |
     | 10**(d-1)<=N<10**d    |  F(w-n).0, n('b')     |
     |                       |                       |
     |_______________________|_______________________|

    where: b is a blank

    n is 4 for Gw.d and e+2 for Gw.dEe

Note that the scale factor has no effect unless the magnitude of the datum to be edited is outside of the range that permits effective use of F editing. [/quote]
6楼2011-11-30 13:43:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 exabyss916 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 专硕0854初试考材科基,求调剂 +7 3220548044 2026-04-06 10/500 2026-04-08 21:59 by hypershenger
[考研] 307求调剂 +14 超级伊昂大王 2026-04-06 14/700 2026-04-08 07:03 by 无际的草原
[考研] 11408 325分 +3 jgtxuxgkx 2026-04-07 3/150 2026-04-07 23:10 by lbsjt
[考研] 085602调剂 初试总分335 +10 19123253302 2026-04-05 10/500 2026-04-07 15:23 by 小乔同学ya
[考研] 0854求调剂 +9 亨氏番茄沙司 2026-04-06 10/500 2026-04-07 14:37 by shdgaomin
[考研] 316求调剂 +7 yyx想调剂 2026-04-05 7/350 2026-04-07 14:31 by shdgaomin
[考研] 信工所11408 340分 本科西安交大自动化 +3 moontrek 2026-04-06 3/150 2026-04-07 09:56 by chongya
[考研] 材料专硕322 +11 哈哈哈吼吼吼哈 2026-04-05 11/550 2026-04-06 14:07 by lqwchd
[考研] 346分的生物与医药08600求调剂 +6 常雨阳上岸 2026-04-05 7/350 2026-04-06 12:36 by lys0704
[考研] 求调剂 +5 wos666 2026-04-03 5/250 2026-04-06 10:13 by 蓝云思雨
[考研] 生物与医药086000调剂一志愿西北农林320分 +3 美美女士 2026-04-03 3/150 2026-04-05 21:55 by 学员8dgXkO
[考研] 348求调剂 +3 车厘子zzz 2026-04-05 3/150 2026-04-05 20:30 by 啵啵啵0119
[考研] 298分 070300求调剂 +15 zwen03 2026-04-02 15/750 2026-04-05 12:52 by Hdyxbekcb
[考研] 一志愿西北农林畜牧专硕336分求调剂 +3 5ourr 2026-04-03 3/150 2026-04-05 10:40 by JOKER0401
[考研] 材料调剂 +7 dxy调剂 2026-04-04 7/350 2026-04-05 09:15 by 陌秋26
[考研] 一志愿华北电力大学(北京),材料科学与工程学硕265,求调剂 +11 yelck 2026-04-03 12/600 2026-04-04 19:52 by dongzh2009
[硕博家园] 求老师收留 +9 lllq123 2026-04-03 9/450 2026-04-03 13:48 by 呼吸都是减肥
[考研] 求材料调剂 一志愿南昌大学 328分 +5 yyy..... 2026-04-03 5/250 2026-04-03 13:46 by 百灵童888
[考研] 调剂 +7 祉岷. 2026-04-02 7/350 2026-04-03 09:11 by 花呗还欠600
[考研] 279求调剂 +5 傅文秋 2026-04-02 5/250 2026-04-02 18:10 by 笔落锦州
信息提示
请填处理意见