• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

record input & output

how can i input a record on afile and how can i out put it and how can i make change on it and save it on the file
0
khalid_mohammed
Asked:
khalid_mohammed
1 Solution
 
amgedeldirdiriCommented:
{You Can Use This Code To Input And Out Put A Record On The File }
Type
   Stud=Record
         No:Integer;
         Name: String[30];
         Subject1:Integer;
         Subject2:Integer;
         Average : Real;
        End;
{Procedure For Input New Data}
Procedure InputRecord;
Var
  Temp:Stud;
  F:File Of Stud;
Begin
   Assign(F,'Stud.Dat');
   ReWrite(F);
   With Temp Do
     Begin
       Readln(NO);
       Readln(Name);
       Readln(Subject1);
       Readln(Subject2);
     End;
    Write(F,Temp);
    Close(F);
End;
{Procedure To Input Change And Save It}
Procedure MakeChaneg;
Var
  Temp;
  F:File Of Stud;
  N:Integer;
Begin
   Assign(F,'Stud.Dat');
   Reset(F);
   Write('Input Your Record No :');
   Readln(N);
   Seek(F,N-1);
   Read(F,Temp);
   With Temp Do
    Begin
      Readln(No);
      Readln(Name);
      Readln(Sybject1);
      Readln(Sybject2);
      Average:=(Subject1+Subject2)/2;
    End;
    Seek(F,N-1);
    Write(F,Temp);
    Close(F);
End;
{This Tow Procedure To Input New That The First One And To Input Change To Save It }
       
0
 
khalid_mohammedAuthor Commented:
thank you for your help
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now