I'm writing a piece of code by which I plan to write a .txt
file that's a 10x10001 matrix:
do i = 1, 10
read(1,10) seed !Read a number from file 1
write(2,20) seed !Write that number in file 2
do k = 1, 10000
seed = mod((a*seed),m)
R = seed/m
write(2,20) R !I want all these numbers to be next to the seed, not on new lines
end do
end do
But all the R
's are written on new lines.
Is there a way to separate every number with a space instead of a new line, or should I implement this same code using C++ and pipelines?
You can make write
not add a newline at the end with the following code:
write(2, 20, advance="no") R
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With