Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
defining vector variable Posted by simfer on 6 Nov 2008 at 5:47 PM
Hi,
I have ascii file, that has approximatelly 100 columns. I would like to read values in each column with loop in separate veriables. Can you advise me how to define vector variable which name would be changed in do loop. For example, values in column 1 would be read in variable col_1,...,values in column 100 would be read in variable col_100.

Thanks
Simon
Report
Re: defining vector variable Posted by Actor on 7 Nov 2008 at 1:06 AM
: Hi,
: I have ascii file, that has approximatelly 100 columns. I would like
: to read values in each column with loop in separate veriables. Can
: you advise me how to define vector variable which name would be
: changed in do loop. For example, values in column 1 would be read in
: variable col_1,...,values in column 100 would be read in variable
: col_100.
:
: Thanks
: Simon
:
Use an array. Define the array with the declaration
Var
     col : array[1 .. 100] of real ; { or whatever type }


then read the file with a for loop
     for i := 1 to 100 do
         read (f, col[i]) ;
     readln (f) ;





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.