OK i have a project the is due soon and i am stuck.. i need to make a program the you enter you pin and it displase it as ****.. can some one help me. Email Fuklife_1@hotmail.com..

Recommended Answers

All 6 Replies

ok i think the program should look like this..

program pin;
uses crt;
var;
pin : real;
begin
writeln ('enter pin here');
read (pin);
for pin:= 1 to 9 do write ('*');
writeln (' Your pin is',pin);
end.

when i try to wok it doesn;t do what i want it to do,
also can some one tell me if you can save the information like
write ('enter you name');
readln (name);
save the name and then the last name in some sort of data base..

ok i think the program should look like this..

program pin;
uses crt;
var;
pin : real;
begin
writeln ('enter pin here');
read (pin);
for pin:= 1 to 9 do write ('*');
writeln (' Your pin is',pin);
end.

when i try to wok it doesn;t do what i want it to do,
also can some one tell me if you can save the information like
write ('enter you name');
readln (name);
save the name and then the last name in some sort of data base..

Take a look at the ReadKey function.

program pin;
uses
   crt;
var
   PinNumber: string;
   Done: Boolean;
   ACharacter: Char;
begin
   { Initialize variables. }
   Done := False;
   PinNumber := '';

   { Prompt user for input. }
   writeln;
   write('Enter your pin number: ');

   { Read input. }
   repeat
      ACharacter := ReadKey;
      case ACharacter of
         '0'..'9':
            begin
               write('*');
               PinNumber := PinNumber + ACharacter;
            end;
      else
         Done := True;
      end;
   until Done;

   { Display pin number. }
   writeln;
   writeln('Your pin number is: ' + PinNumber);
end.

Second part of your question:

Answer := YES; :lol:

program names;
uses
   SysUtils;
const
   DataFileName = 'C:\NAMES.TXT';
var
   DataFile: TextFile;
   FirstName: string;
   LastName: string;
begin
   { Prompt user for first name. }
   write('Enter your FIRST name: ');
   readln(FirstName);

   { Prompt user for last name. }
   write('Enter your LAST name: ');
   readln(LastName);

   { Open the file. }
   AssignFile(DataFile, DataFileName);
   if FileExists(DataFileName) then
   begin
      Append(DataFile);
   end
   else
   begin
      Rewrite(DataFile);
   end;

   { Write data to the file in comma delimited format. }
   writeln(DataFile, LastName + ',' + FirstName);

   { Make sure the file is written to disk, then close it. }
   Flush(DataFile);
   CloseFile(DataFile);
end.

Thank you very much..

JackRabbit, what did that have to do with his program???

C++

The OP asked if he could save the first and last names to some sort of a database. A text file can be considered a flat-file database so I gave him a simple example of saving to a text file.

It wouldn't be much more work to save to XML (another simple text file format). Of course he/she could establish a connection to a database management program like MySQL, PostgreSQL, MS Access, etc. and read/write to it but that's not quite as simple...

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.