24小时热门版块排行榜    

查看: 2291  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 材料与化工304求B区调剂 +6 邱gl 2026-03-11 7/350 2026-03-17 01:27 by 学员FnSWZj
[考研] 286求调剂 +3 lemonzzn 2026-03-16 5/250 2026-03-16 20:43 by lemonzzn
[考研] 302求调剂 +3 小贾同学123 2026-03-15 5/250 2026-03-16 20:39 by zhq0425
[文学芳草园] 伙伴们,祝我生日快乐吧 +17 myrtle 2026-03-10 26/1300 2026-03-16 18:32 by 青橙Ln
[考研] 0854控制工程 359求调剂 可跨专业 +3 626776879 2026-03-14 9/450 2026-03-16 17:42 by 626776879
[考研] 一志愿985,本科211,0817化学工程与技术319求调剂 +5 Liwangman 2026-03-15 5/250 2026-03-16 17:10 by 我的船我的海
[考研] 0703化学调剂 ,六级已过,有科研经历 +7 曦熙兮 2026-03-15 7/350 2026-03-16 16:34 by houyaoxu
[考研] 中科院材料273求调剂 +4 yzydy 2026-03-15 4/200 2026-03-16 15:59 by Gaodh_82
[基金申请] NSFC申报书里申请人简历中代表性论著还需要在申报书最后的附件里面再上传一遍吗 20+5 NSFC2026我来了 2026-03-10 14/700 2026-03-15 23:53 by 不负韶华的虎
[考研] 机械专硕调剂 +3 笨笨兔子 2026-03-12 3/150 2026-03-15 20:02 by 栗子粥?
[考研] 274求调剂 +4 时间点 2026-03-13 4/200 2026-03-15 15:29 by Rambo13
[考研] 297求调剂 +4 学海漂泊 2026-03-13 4/200 2026-03-14 11:51 by 热情沙漠
[考研] 一志愿湖师大化学289求调剂 +6 XMCMM3.14159 2026-03-10 6/300 2026-03-14 00:28 by JourneyLucky
[考研] 332求调剂 +3 zjy101327 2026-03-11 6/300 2026-03-13 22:48 by JourneyLucky
[考研] 308求调剂 +5 是Lupa啊 2026-03-11 5/250 2026-03-13 22:13 by JourneyLucky
[考研] 329求调剂 +3 miaodesi 2026-03-12 4/200 2026-03-13 20:53 by 18595523086
[考研] 293求调剂 +3 世界首富 2026-03-11 3/150 2026-03-13 16:27 by JourneyLucky
[考研] 求b区学校调剂 +3 周56 2026-03-11 3/150 2026-03-13 16:20 by JourneyLucky
[考研] 一志愿211化学学硕310分求调剂 +8 努力奋斗112 2026-03-12 9/450 2026-03-13 15:41 by JourneyLucky
[考研] 314求调剂 +7 无懈可击的巨人 2026-03-12 7/350 2026-03-13 15:40 by JourneyLucky
信息提示
请填处理意见