使用特定的 FMT 将不同类型的变量写入同一行

发布于 01-13 07:27 字数 351 浏览 2 评论 0原文

我想在同一行上的一系列具有特定格式的整数前面写入一系列字符。例如,如下所示:C1 C2 C3 C4 C5 C6

到目前为止,我成功地对一种类型的变量使用了 ADJUSTL(FMT) 选项:

WRITE(FMT,*) j
WRITE(*,"( "// ADJUSTL(FMT) //" a3)") (Letters(i),i=1,j) 

其中,Letters 是字符数组,i,j 是整数。它正确显示CCCCC C

我尝试了几种不同的组合,以便在字符旁边添加整数,但尚未找到正确的解决方案。我正在使用 gfortran 编译我的 F90 代码。

I would like to write a series of characters preceeding a series of integers with a specific format on the same line. Like the following: C1 C2 C3 C4 C5 C6, for instance.

I succeeded to use the ADJUSTL(FMT) option for one type of variable so far:

WRITE(FMT,*) j
WRITE(*,"( "// ADJUSTL(FMT) //" a3)") (Letters(i),i=1,j) 

Where Letters is a character array and i,j are integers. It displays correctly C C C C C C.

I've tried few different combinations in order to add the integers next to the characters but didn't find the right solution yet. I'm using gfortran to compile my F90 code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文