Fortran Creating 2-d array from a text file in fortran

AI Thread Summary
To read a text file containing pairs of values into an array in Fortran, begin by declaring array variables that can hold the expected data. Open the file using the appropriate Fortran file handling commands. Implement a do-loop to iterate through the file, reading each pair of values and storing them in the array using the loop index. This approach encourages experimentation with coding, emphasizing that trying out code is a safe and beneficial practice in software development.
tcmoore3
Messages
1
Reaction score
0
I have a text file of the format

x1 y1
x2 y2
. .
. .
. .

I need to read this into an array. How is this done in Fortran?
 
Technology news on Phys.org
you start by declaring a couple of array variables long enough to accommodate your values.
then, you open the file
write a do-loop
read values into array with the loop variable as the index


If I tell you more, I will be writing more than what it takes to simply write the code and give it to you.

with those hints, go ahead and take a shot at it, don't be shy, write some code and see what happens...you are not going to break anything nor set the room on fire or anything...that's what so wonderful about software!
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
2
Views
1K
Replies
25
Views
3K
Replies
12
Views
3K
Replies
1
Views
3K
Replies
33
Views
5K
Replies
5
Views
5K
Replies
19
Views
6K
Back
Top