954,168 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help Me

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 [email]Fuklife_1@hotmail.com[/email]..

shmee
Newbie Poster
3 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

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

shmee
Newbie Poster
3 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

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 theReadKey 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.
Jackrabbit
Light Poster
31 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

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.
Jackrabbit
Light Poster
31 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

Thank you very much..

shmee
Newbie Poster
3 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

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

Ghost
Posting Whiz
352 posts since Aug 2004
Reputation Points: 12
Solved Threads: 2
 

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

Jackrabbit
Light Poster
31 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You