void customer (struct data *cust1);
void menu();
void printReceipt(struct data *cust1, float &balance);

struct data{
char name[20];
int accno;
}cust, *cust1;

above is an excerpt from my completed c++ program.
my c++ coding is running well and i dont have a problem with it, but i am required to change my coding to pascal as well. so, i would like to ask for your help in this.

i already know that ^ is the symbol for pointers.
but i am confused with the & symbol.does it have an alternate symbol in pascal or not?

and the syntax is like sample^ := sample2. i dont know if it's the right one or not, still.

and also another question,

when i'm writing my procedures
for example like

void customer(struct data *cust1, float &balance)
{
cout<<"Welcome";
....others.
other code.

at the void section, how am i going to write it in pascal?
do i just write in the same way like

procedure customer (data ^cust1, &balance:float); ?

i can't really get a hold on pascal programming yet, so im stuck on the code.

i already have my own full pascal conversion from my c++ coding, but im pretty sure only the basics are correct, but when it comes to pointers and all, i sucked.

would be grateful if anyone would share their knowledge here.

if you would like to see my whole pascal or c++ code, please state your email account. thank you.

i already came across that.
that's where the ^ symbol came along.

so there are no way that i could translate my c++ into pascal?

this is my original c++ code.

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>

void customer(struct data *cust1);
void menu();
void printReceipt(struct data *cust1, float &balance);

struct data
{
	char name[20];
   int accno;
}cust, *cust1;

void main()
{
	int code;
   float deposit, draw, balance=1000.00;
   cust1=&cust;

   customer(cust1);

   do{
      menu();
      cin>>code;

      if (code==1)
 		{
 		   cout<<"Your balance is : RM "<<balance<<endl;
         
       }
         else if (code==2) {

         			cout<<"How much do your want to deposit?\n"<<"RM ";
   					cin>>deposit;
            		balance=balance+deposit;
            		cout<<endl;
                  clrscr();

                  }

         else if (code==3)
         			{

         			cout<<"How much do you want to draw?\n";
   					cout<<"RM ";
            		cin>>draw;
            		balance=balance-draw;
            		cout<<endl;
                  clrscr();

                  }

   		else if (code==4)
         			{
         			clrscr();
         			cout<<"\nThank You for using this machine\n";
                  }
   		else
         			{
                  clrscr();
   					cout<<"Invalid Code!\n\a\a\a\a"<<endl;
               	cout<<"Please try again.\n"<<endl;
                  }


   }while(code!=4);

   printReceipt(cust1, balance);

	getch();
}

void customer(struct data *cust1)
{
	cout<<"\nWELCOME! ";
	cout<<"Enter your Name: ";
   cin>>(*cust1).name;
   clrscr();
   cout<<"\nHello "<<(*cust1).name<<", Enter your Account Number: "<<endl;
   cout<<"( 6 numbers only ) : ";
   cin>>(*cust1).accno;
}

void menu()
{
	cout<<"\nJujur Bank Berhad\n";
 	cout<<"Main Menu\n\n";
 	cout<<"1 - Balance Enquiry\n";
 	cout<<"2 - Deposit\n";
 	cout<<"3 - Withdrawal\n";
 	cout<<"4 - Quit\n";
}

void printReceipt(struct data *cust1, float &balance)
{
	cout<<"***************************************"<<endl;
 	cout<<"**            Jujur Bank Berhad      **"<<endl;
 	cout<<"**            -----------------      **"<<endl;
   cout<<"**   Customer Name: "<<setw(10)<<(*cust1).name<<"       **"<<endl;
   cout<<"**   Account Number: "<<setw(10)<<(*cust1).accno<<"      **"<<endl;
 	cout<<"**   Balance:RM "<<setw(4)<<balance<<".00              **"<<endl;
 	cout<<"**                                   **"<<endl;
 	cout<<"**              ::Thank You::        **"<<endl;
 	cout<<"***************************************"<<endl;
}

and this is the one i tried converting to pascal. but of course there are errors.
i'm still very new to pascal and don't understand it quite well enough.
i really need someone's help.

program proj5;
	{bank account system, project5}
uses WinCrt;


type
cust=^cust1;

cust1=record
name:String;
accno:Integer;

end;


var
	code:Integer;
	deposit,draw,balance:real;
	
	
	customer(cust1);
repeat

balance := 1000.00;
	menu();
	readln(code);

	if (code = 1) then
		writeln('Your balance is : RM ');
		writeln(balance);

	else if (code = 2) then
		writeln('How much do you want to deposit?');
		readln(deposit);
		balance:=balance+deposit;
		writeln;
		clrscr;

	else if (code = 3) then
		writeln('How much do you want to draw? RM ');
		readln(draw);
		balance:=balance-draw;
		writeln;
		clrscr;

	else if (code = 4) then
		clrscr;
		writeln('Thank you for using this machine');

	else
		clrscr;
		writeln('Invalid code!');
		writeln('Please try again.');

	until (code <> 4);

printReceipt(cust1,balance);

end.

procedure customer(struct data *cust1) *dont know how to write the struct ()
begin
	writeln ('WELCOME!');
	writeln ('Enter your name: ');
	readln(^cust1.name);
	clrscr;
	writeln('Hello');
	writeln(^cust1.name);
	writeln('Enter your account number :');
	writeln('6 numbers only');
	readln(^cust1.accno);

end.

procedure menu
begin
	writeln('Jujur Bank Berhad');
	writeln('Main Menu');
	writeln('1 - Balance Enquiry');
	writeln('2 - Deposit');
	writeln('3 - Withdrawal');
	writeln('4 - Quit');
end.

procedure printReceipt (struct data *cust1, @balance:real) *i dont really know this
begin
	writeln('****************************************');
	writeln('	     Jujur Bank Berhad          *');
	writeln('            -----------------          *');
	writeln('  Customer Name:  (^cust1.name)	*');
	writeln('  Account Number: (^cust1.accno)       *');
	writeln('  Balance : RM (balance)               *');
	writeln('                                       *');
	writeln('              ::Thank You::            *');
	writeln('****************************************');
end.

end.

already solved on my own.

It would be kind to post the result, if possible, for future viewers.

C++

void customer (struct data *cust1);
void menu();
void printReceipt(struct data *cust1, float &balance);

struct data{
char name[20];
int accno;
}cust, *cust1;
procedure customer(cust1 : Data);
procedure menu;
procedure printReceipt(cust1 : Data;&Balance : Float);
type Data = TClass()
name : Array[0..20] of char;
accno : integer;
end;
cust, *cust1 //Didnt undestand this part...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.