You are here
Visual C++2008 Education code
http://simcompanion.mscsoftware.com/infocenter/index?page=content&cat=1TJVU3&channel=DOCUMENTATION
http://femcodes.nscee.edu/src/FORTRAN/fem-2d/
http://www.shuwasystem.co.jp/support/7980html/2110.html
http://ace.phys.h.kyoto-u.ac.jp/~tomita/education/fortran90/sec0.html
http://mailsrv.nara-edu.ac.jp/~asait
http://www.fortran.com/tutorials.html
http://www.scribd.com/doc/18431916/Ngon-Ngu-Lap-Trinh-FORTRAN-90
http://www.koders.com/info.aspx?c=ProjectInfo&pid=9MZG4YNSDBPLZY5Q11KE8N11SF
http://scholar.lib.vt.edu/theses/available/etd-03152000-10210026/unrestricted/finalthesis.pdf
http://questionbox.jp.msn.com/qa4673285.html
#include "stdafx.h"
using namespace System;
using namespace System::IO;
int main()
{
String^ string1;
String^ path = "c:\\temp\\random_test.dat";
try
{
StreamReader^ sr = gcnew StreamReader( path );
try
{
while ( sr->Peek() >= 0 )
{
string1 = sr->ReadLine();
if ( sr->ReadLine()=="SPC1" )
{
Console::WriteLine( sr->ReadLine() );
}
}
}
finally
{
delete sr;
}
}
catch ( Exception^ e )
{
Console::WriteLine( "The process failed: {0}", e );
}
}
===========================================
program mytest1
implicit none
real r, area, pi, i, j, k, sq(10), A(3,5), n
integer nmax
parameter (nmax=1000)
real x(nmax), y(nmax), z(nmax)
10 write(*,20) 'Give radius r'
20 format(1x,a,i4,a,$)
read(*,*) r
pi = atan(1.0e0)*4.0e0
area = pi*r*r
write(*,*) 'Area of the circle is ',area
do i = 1, 10
sq(i) = i**2
write(*,*) 'Ma tran Item ',sq(i)
enddo
do i = 1, 3
do j = 1, 5
A(i,j) = i/j
write(*,*) 'Ma tran Item Multi ',A(i,j)
enddo
enddo
c Open the data file
open (unit=40, file='a.dat')
open (unit=50, file='aw.dat')
c Read the number of points
read(40,*) n
if (n.GT.nmax) then
write(*,*) 'Error: n = ', n, 'is larger than nmax = ', nmax
goto 9999
endif
9999 stop
do k= 1, n
read(40,*)x(k), y(k), z(k)
write(50,*) 'Ma tran Item x ',x(k)
write(50,*) 'Ma tran Item y ',x(k)
write(50) 'Ma tran Item z ',z(k)
enddo
100 write(*,20) 'Give radius r'
read(*,*) k
close (40)
end
==============================================
program addthem
real x, sum
open (unit=1,file="a.dat")
sum = 0
open (unit = 2 , file = "sum")
write (2,*) "Your requested average is in the table below."
write (2,*)
write (2,20) "First Number", "Sum"
5 read (1,*,end=10) x
sum = sum + x
write (2,*)
write (2,30) x, sum
go to 5
10 print *
20 format (t10,a,t30,a)
write (2,*)
write (2,30) x, sum
30 format (t10,f8.2,t30,f8.2)
print *, "The sum of the numbers in the file is", sum
print *, "Bye"
end
=============================================
program main
implicit none
character(len=6) :: c
integer :: i
open(unit=20,file="foo.txt",form="formatted",access="stream")
write(20,'(A)') '123456'
write(20,'(A)') 'abcdef'
write(20,'(A)') 'qwerty'
rewind 20
! Skip over the first line
read(20,'(A)') c
! Save the position
inquire(20,pos=i)
! Read in the complete line...
read(20,'(A)') c
! Write out the first four characters
write(20,'(A)',pos=i,advance="no") 'ASDF'
! Fill up the rest of the line. Here, we know the length. If we
! don't, things will be a bit more complicated.
write(20,'(A)') c(5:6)
! Copy the file to standard output
rewind 20
do i=1,3
read(20,'(A)') c
print '(A)',c
end do
close (20)
end program main
==============================
program main
implicit none
character(len=320) :: line
integer :: i
real :: nsm
open(unit=1,file="a.dat",form="formatted",access="stream")
open(unit=2,file="outDBF.dat",form="formatted",access="stream")
! Read all line in input File
5 read(1,800) line
if (line(1:6) .eq. 'PSHELL' ) then
! Write to out file with modify nsm value
nsm = 0.0
write(2,801) line(1:64), nsm, line(73:80)
go to 5
endif
if (line(1:4) .eq. 'PBAR' ) then
! Write to out file with modify nsm value
nsm = 0.0
write(2,802) line(1:56), nsm, line(65:192)
go to 5
endif
if (line(1:5) .eq. 'PBEAM' ) then
! Write to out file with modify nsm value
nsm = 0.0
write(2,803) line(1:64), nsm, line(73:320)
go to 5
endif
write(2,800) line
if (line(1:7) .eq. 'ENDDATA') stop
go to 5
700 print *
800 format(A80)
801 format(A64,F8.1,A8)
802 format(A56,F8.1,A128)
803 format(A64,F8.1,A248)
close (1)
close (2)
end program main
=================================
http://femcodes.nscee.edu/src/FORTRAN/
set font helvetica
proc applyIt { } {
global bold italics font
if {$bold} {set weight bold} {set weight normal}
if {$italics} {set slant italic} {set slant roman}
.b configure -font "-family $font -weight $weight -slant $slant"
puts $weight
puts $slant
}
checkbutton .c1 -text Bold -variable bold -anchor w
checkbutton .c2 -text Italics -variable italics -anchor w
radiobutton .r1 -text Helvetica -variable font -value helvetica
radiobutton .r2 -text Courier -variable font -value courier
button .b -text Apply \
-command "applyIt"
applyIt
#The "sticky" option aligns items to the left (west) side
grid .c1 -row 0 -column 0 -sticky w
grid .c2 -row 0 -column 1 -sticky w
grid .r1 -row 1 -column 0 -sticky w
grid .r2 -row 1 -column 1 -sticky w
grid .b -row 2 -column 0 -columnspan 2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
proc grotoelems {f groupname} {
global allelem
set j 0
array set x {}
array unset x
array set y {}
array unset y
array set z {}
array unset z
set elelist [list]
set elems [list]
set allelem [list]
while {1} {
incr j
set line [gets $f]
if [string match "*$ --> $groupname*" $line] {
incr j
break
}
}
unset line
#puts $j
#
while {1} {
incr i
set line [gets $f]
if { [string match "*add ele*" $line]} {
if ([string match "*@@*" $line]) {
set line [string trim $line {@@}]
set line [string trim $line {!add ele}]
append elelist $line
#puts "Read line: $line at line $i"
while {1} {
set line [gets $f]
if ([string match "*@@*" $line]) {
incr i
set line [string trim $line {@@}]
append elelist $line
#puts "Read line: $line at line $i"
} else {
incr i
append elelist $line
#puts "Read line: $line at line $i"
break
}
}
break
} else {
set line [string trim $line {!add ele}]
append elelist $line
#puts "Read line no has @@: $line at line $i"
break
}
}
if {[eof $f]} {
close $f
break
}
}
set len [llength $elelist]
#puts $elelist\n
set m 0
set n 0
for { set i 0 } { $i < $len } { incr i } {
set x($i) [lindex $elelist $i]
#puts $x($i)\n
set str $x($i)
set lenstr [string length $x($i)]
for { set j 0 } { $j <= $lenstr } { incr j } {
if {[string index $str $j] == "/"} {
set n [expr $j-1]
lappend elems [string range $str $m $n]
set m [expr $j+1]
}
}
lappend elems [string range $str $n+2 $lenstr]
}
#puts $elems\n
set lens [llength $elems]
#puts $lens
set p 0
for { set t 0 } { $t < $lens } { incr t } {
set y($t) [lindex $elems $t]
set lenyt [string length $y($t)]
if {$lenyt != 0} {
set y($t) $y($t)
#puts $y($t)\n
if {[scan $y($t) "%d-%d" a b] != 2} {
lappend allelem $y($t)
} else {
set a [set a]
set b [set b]
for { set k $a } { $k <= $b } { incr k } {
lappend allelem $k
}
}
}
}
#puts "List of elements of Group $groupname are $allelem\n"
set lenele [llength $allelem]
for { set v 0 } { $v < $lenele } { incr v } {
set z($v) [lindex $allelem $v]
#puts $z($v)
}
}
proc runpro {} {
global allelem
set file [open "C:/g95/group.txt" r]
set groname "7th"
grotoelems $file $groname
puts "List of elements of Group $groname are $allelem\n"
set groname "8th"
grotoelems $file $groname
puts "List of elements of Group $groname are $allelem\n"
}
runpro
Attachment | Size |
---|---|
group.txt | 298 bytes |
readgroup .txt | 2.96 KB |
- Nguyen Van Chau's blog
- Log in or register to post comments
- 4224 reads
Recent comments