home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / MADTRB16.ZIP / GETDATA.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1985-02-19  |  1.4 KB  |  44 lines

  1. program getdata;
  2. type
  3.    data      =
  4.      record
  5.        w,z   :real
  6.      end;
  7. var
  8.    a,index   :integer;
  9.    x,y       :array[1..256] of real;
  10.    xy        :array[1..256] of data;
  11.    filename  :string[8];
  12.    datafile  :file of data;
  13. begin
  14.      clrscr;
  15.      gotoxy(19,1);writeln('Program to Enter Complex Pairs into a File');
  16.      writeln;writeln;
  17.      write('Enter new data file name w/o extension : ');
  18.      readln(filename);
  19.      filename:=filename+'.dat';
  20.      writeln('Data file name ==> ',filename);
  21.      assign(datafile,filename);
  22.      rewrite(datafile);
  23.      writeln;
  24.      writeln('If you are planning to use this with the FFT program, the');
  25.      writeln('number of complex data points must be a power of 2!');
  26.      writeln;
  27.      write('Enter number of complex data points <=256 : ');readln(a);
  28.      writeln;writeln;writeln;
  29.      writeln('Enter complex number as REAL IMAGINARY - remember the space between elements');writeln;
  30.      gotoxy(19,17);writeln('--------------* Input Data *--------------');writeln;
  31.      for index:=1 to a do begin
  32.          write('real(',index,') imaginary(',index,') ===> : ');
  33.          readln(x[index],y[index]);
  34.        with xy[index] do begin
  35.            w:=x[index];
  36.            z:=y[index];
  37.        end;
  38.      write(datafile,xy[index]);
  39.      end;
  40.      close(datafile);
  41.      writeln;writeln;
  42.      for index:=1 to a do
  43.          writeln('real(',index,')=',x[index],'    imaginary(',index,')=',y[index]);
  44. end.