由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
CS版 - ask a fortran question
相关主题
【求助】Fortran多线程执行效率问题NP
标识符真的不能带空格么?贴一道take home的面试题
请问Safety critical software的career path如何a quick question about integer programming
[转载] 问个fortran的基础问题 Count the number of ON bits in an integer.
请问:关于fortran请教几个算法题, 第一个
在FORTRAN 里有什么函数能产生随机常数?紧急求助!Stochastic Integer Programming (转载)
[转载] 急问: 怎么看程序运行的 cpu time (fortran)Obama Google Onsite Question
编程初学者!急问一关入fortran的初级问题。谢谢!
相关话题的讨论汇总
话题: iy话题: fortran话题: character话题: integer话题: 1984
进入CS版参与讨论
1 (共1页)
j****s
发帖数: 1522
1
How can I convert an integer to a character in fortran?
For example, IY=1984, 1985, ..., and IY is changable, and I wish the character
YEAR would be 1984, 1985, ..., too, and it could be changed following IY. I
try to use the function achar and char, and they don't work as my expectation.
Actually, my final purpose is to concatenate characters (strings) with integer
and create a new string. Please tell me how I can do. Thanks.
n******s
发帖数: 7
2
Try:
character(len=8)::year
integer::iy=1984
write(unit=year,fmt="('ye',i4.4,'ar')")iy
This is like sprintf() in C.

character
expectation.
integer

【在 j****s 的大作中提到】
: How can I convert an integer to a character in fortran?
: For example, IY=1984, 1985, ..., and IY is changable, and I wish the character
: YEAR would be 1984, 1985, ..., too, and it could be changed following IY. I
: try to use the function achar and char, and they don't work as my expectation.
: Actually, my final purpose is to concatenate characters (strings) with integer
: and create a new string. Please tell me how I can do. Thanks.

1 (共1页)
进入CS版参与讨论
相关主题
急问一关入fortran的初级问题。谢谢!请问:关于fortran
help--LINK : fatal error LNK1104: cannot open file 'LIBC.lib'在FORTRAN 里有什么函数能产生随机常数?
LabVIEW or C++哪个容易学?[转载] 急问: 怎么看程序运行的 cpu time (fortran)
若问JAVA问题~编程初学者!
【求助】Fortran多线程执行效率问题NP
标识符真的不能带空格么?贴一道take home的面试题
请问Safety critical software的career path如何a quick question about integer programming
[转载] 问个fortran的基础问题 Count the number of ON bits in an integer.
相关话题的讨论汇总
话题: iy话题: fortran话题: character话题: integer话题: 1984