Link to home
Start Free TrialLog in
Avatar of ScottyBhoy
ScottyBhoy

asked on

Linking 2 variables

Is it possible to enter a number(customer number)
which would then display the details attached to that number
(customer name)
(customer address)
I would be really greatful.
Thanks.
Avatar of Hypo
Hypo
Flag of Sweden image

You can combine a record and an array to do that. Do I need to explain how to use records and arrays for you?

Take a look at the example

Program Name;

uses crt;

type Customer = record
 Name : string;
 Adress : string;
end;

var Customers : array[1..3] of Customer;

procedure WriteCustomer(C : Customer);
begin
 Writeln('Name   : ', C.Name);
 Writeln('Adress : ', C.Adress);
 Writeln;
end;

begin
 Customers[1].Name := 'Heini';
 Customers[1].Adress := 'keen road 8';
 Customers[2].Name := 'Rolfs';
 Customers[2].Adress := 'torp road 1';
{etc. etc.}
 Writeln('First Customer')
 WriteCustomer(Customers[1]);
 Writeln('Second Customer')
 WriteCustomer(Customers[2]);
end.
Avatar of ScottyBhoy
ScottyBhoy

ASKER

Adjusted points to 75
if Data is a Record then
you have to explain where is the data stored ( in a File or in tha Ram "array").
after that you have to search about
your record match with Customer Number
and then Display other Info(name,address,...).
  Bakry
Avatar of dbrunton
Why the rejection?  Please explain your question more clearly.  Do you understand records and arrays?
ASKER CERTIFIED SOLUTION
Avatar of Batalf
Batalf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This Procedure :

  For Counter:=1 to MaxCust do
  BEGIN
       if Customers[Counter].custid
       = custid
       begin
           writeln('Id : ',Customers[counter].custid;
           writeln('Name : ',Customers[counter].name;
           writeln('Adress : ',Customers[counter].adress;
       

make a search through your array, and give you the result on the screen if it could find a match(custid in array = the custid you typed in).

Cheers Mate!!!!!!!!!!!!!!!!!!!