- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've got a few different things to ask, all with the same goal of trying to figure out how to use Intel Fortran and Visual Studio.
1. The only programming I have ever done is in Fortran 77 (recently through Force 2.0). I know nothing about C++, Visual Basic, Visual Studio, anything but Fortran 77. My boss is having mework on the trial version ofIntel Parallel Studio XE 2011 (for Windows) with Visual Basic so he can figure out whether or not we can use it and if he should buy it or not. All I need to work with is the Fortran part and I'm having trouble figuring out how to use Visual Studio to do this.For the most partallI'mdoing is working with and fixing old fortran programs.
2. I need a very basic, step-by-step, from the beginning tutorial (or more than one)to learn how to use Fortran in Visual Studio. I've spent about 6 hours looking around for this and nothing I've found is basic enough for my needs. Let me stress: the only thing I know about programming is what I learned from reading and writing moderately simple Fortran 77 programs.
3. Can this type of Fortran 77 program be run in Intel Fortran? Is there something I have to do to it? These may bequestions that can be answered by the detailed tutorial I'm looking for:
program divisors
integer n, k, d(10)
open (unit = 1, file = "divisors")
print *, "Enter a positive integer :"
read *, n
write (1,*) "Here are the divisors of ", n, " :"
k = 0
do i = 1, n
if (mod(n,i) .eq. 0) then
k = k + 1
d(k) = i
end if
if (k .eq. 10) then
write (1,5) (d(j), j = 1, 10)
k = 0
end if
end do
write (1,5) (d(j), j = 1, k)
5 format (10i7)
close (1)
print *, "The divisors are listed in the file 'divisors'. Bye."
pause
end
I realize these are extreme newbie questions, so I'm very thankful in advance for any help and patience I can get.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Open Visual Studio
- go to File->New Project
- In the projct window select "Intel Visual Fortran" -> Console Application" -> "Empty Project"
- Give your project any name you want
- on the right side, right click on "Source Files" and click "Add" -> "New Item"
- Select "Fortran Free-Form File" and give the file a name. make sure the file extension is .f90
- Copy and paste the code you have written in this new file
- Click the green arrow at the top next to "debug" (or hit the F5 key)
- Your program will now begin running
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Lets suppose that you create a sub-folder for your Divisors project called "c:\MYF77\DIVISORS"
Let's suppose that you create (using an editor) a free-format Fortran file called "DIVISORS.F90" and copy your posted code into it then you save the file into the "DIVISORS" folder.
Now start Visual Studio.
When the Start screen has stabilised, from the menu bar select "File" then select "New Project" which will open the New Project dialog box.
From the left pane of the box go down to "Intel Visual Fortran", select the "+" to open the tree and then select "Console Application".
From the rght-hand pane click on "Empty Project".
Underneath these panes will be an edit box for you to give the project a name. Type in 'DIVISORS".
Press "OK" to exit.
This sets up the project.
Now you need to save it to your preferred location, so
From the "File" menu item, select "Save DIVISORS.vfproj As" which opens the "Save File As" dialog box.
Navigate using the browser to the folder "C:\MYF77\DIVISORS" then press the "Save" button which exits and stores your project with the name "DIVISORS.vfproj" in a subfolder "C:\MYF77\DIVISORS\DIVISORS" (VS Studio annoyingly creates a subfolder with the projects name under the folder that you navigated to. Never mind!)
Since the project is empty at present, you have to add your Fortran files to it.. So...
First, make sure that the "Solution explorer " is open by selecting "View..Solution explorer" from the VS menu.
This opens a right-hand pane listing the Project files in your solution. It will be empty at present.
Then...
EITHER
From the menu select "Project...Add existing Item.."
OR
In the Solution Explorer, Right-click on "DIVISORS", then "Add" then "New Item"
Both routes open the "Add New Item" dialog.
Use the "Browse" button to navigate to "C:\MYF77\DIVISORS" where you have stored "DIVISORS.F90" and then select that file then press the "Add" button.
This will add the "DIVISORS.F90" file to your project and solution.
All that remains is to select from the VS menu "Build...Build Solution".
The program is compiled and you should then see "Build" succeeded" at bottom left of the VS window.
To run the program without the debugger, either select "Debug...Start without Debugging" or press Ctrl+F5 keys.
The program will run and ask for input, then create the output file "divisors" (with no extension, according to your code) and place it in the project folder "C:\MYF77\DIVISORS\DIVISORS".
(your program will crash if anything other than an integer or floating point number is entered, so you should add an "ERR=nnnn" statement to your READ to let the program exit gracefully in that event. Negative numbers cause it to quit with no divisors)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page