Solved

Posted on 2000-03-07
169 Views
Is it possible to enter a number(customer number)
which would then display the details attached to that number
(customer name)
I would be really greatful.
Thanks.
0
Question by:ScottyBhoy
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 12

Expert Comment

ID: 2593001
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;
end;

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

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

begin
Customers[1].Name := 'Heini';
Customers[2].Name := 'Rolfs';
{etc. etc.}
Writeln('First Customer')
WriteCustomer(Customers[1]);
Writeln('Second Customer')
WriteCustomer(Customers[2]);
end.
0

Author Comment

ID: 2595146
0

LVL 1

Expert Comment

ID: 2595254
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
Bakry
0

LVL 48

Expert Comment

ID: 2595255
Why the rejection?  Please explain your question more clearly.  Do you understand records and arrays?
0

LVL 32

Accepted Solution

Batalf earned 75 total points
ID: 2595590
It is possible:

You need an array of records.

Program Name;

uses crt;

type Customer = record
custid : integer;
Name : string;
end;

Const Maxcust=10;

var
Customers : array[1..maxcust] of Customer;
counter : integer;
custid : integer;

begin
/* Procedure here for typing data
into the array*/

Repeat
Write('Type in customerid ');
Until (Custid<MaxCust) and (Custid>0)

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

END;

END.

There could be some errors in my example but I hope you could se the point.

Regards Batalf

0

LVL 32

Expert Comment

ID: 2595597
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;

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).

0

Author Comment

ID: 2600127
Cheers Mate!!!!!!!!!!!!!!!!!!!
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Check out this step-by-step guide for asking an anonymous question on Experts Exchange.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our systemâ€¦
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundrâ€¦
Starting up a Project
###### Suggested Courses
Course of the Month5 days, left to enroll