Help Me

Please support our Pascal and Delphi advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2005
Posts: 3
Reputation: shmee is an unknown quantity at this point 
Solved Threads: 0
shmee's Avatar
shmee shmee is offline Offline
Newbie Poster

Help Me

 
0
  #1
Mar 28th, 2005
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..
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 3
Reputation: shmee is an unknown quantity at this point 
Solved Threads: 0
shmee's Avatar
shmee shmee is offline Offline
Newbie Poster

Re: Help Me

 
0
  #2
Mar 28th, 2005
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..
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 31
Reputation: Jackrabbit is an unknown quantity at this point 
Solved Threads: 0
Jackrabbit Jackrabbit is offline Offline
Light Poster

Re: Help Me

 
0
  #3
Mar 30th, 2005
Originally Posted by shmee
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.

Pascal and Delphi Syntax (Toggle Plain Text)
  1. program pin;
  2. uses
  3. crt;
  4. var
  5. PinNumber: string;
  6. Done: Boolean;
  7. ACharacter: Char;
  8. begin
  9. { Initialize variables. }
  10. Done := False;
  11. PinNumber := '';
  12.  
  13. { Prompt user for input. }
  14. writeln;
  15. write('Enter your pin number: ');
  16.  
  17. { Read input. }
  18. repeat
  19. ACharacter := ReadKey;
  20. case ACharacter of
  21. '0'..'9':
  22. begin
  23. write('*');
  24. PinNumber := PinNumber + ACharacter;
  25. end;
  26. else
  27. Done := True;
  28. end;
  29. until Done;
  30.  
  31. { Display pin number. }
  32. writeln;
  33. writeln('Your pin number is: ' + PinNumber);
  34. end.
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 31
Reputation: Jackrabbit is an unknown quantity at this point 
Solved Threads: 0
Jackrabbit Jackrabbit is offline Offline
Light Poster

Re: Help Me

 
0
  #4
Mar 30th, 2005
Second part of your question:

Answer := YES; :lol:

Pascal and Delphi Syntax (Toggle Plain Text)
  1. program names;
  2. uses
  3. SysUtils;
  4. const
  5. DataFileName = 'C:\NAMES.TXT';
  6. var
  7. DataFile: TextFile;
  8. FirstName: string;
  9. LastName: string;
  10. begin
  11. { Prompt user for first name. }
  12. write('Enter your FIRST name: ');
  13. readln(FirstName);
  14.  
  15. { Prompt user for last name. }
  16. write('Enter your LAST name: ');
  17. readln(LastName);
  18.  
  19. { Open the file. }
  20. AssignFile(DataFile, DataFileName);
  21. if FileExists(DataFileName) then
  22. begin
  23. Append(DataFile);
  24. end
  25. else
  26. begin
  27. Rewrite(DataFile);
  28. end;
  29.  
  30. { Write data to the file in comma delimited format. }
  31. writeln(DataFile, LastName + ',' + FirstName);
  32.  
  33. { Make sure the file is written to disk, then close it. }
  34. Flush(DataFile);
  35. CloseFile(DataFile);
  36. end.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 3
Reputation: shmee is an unknown quantity at this point 
Solved Threads: 0
shmee's Avatar
shmee shmee is offline Offline
Newbie Poster

Re: Help Me

 
0
  #5
Mar 30th, 2005
Thank you very much..
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 350
Reputation: Ghost is an unknown quantity at this point 
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

Re: Help Me

 
0
  #6
Apr 8th, 2005
JackRabbit, what did that have to do with his program???
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 31
Reputation: Jackrabbit is an unknown quantity at this point 
Solved Threads: 0
Jackrabbit Jackrabbit is offline Offline
Light Poster

Re: Help Me

 
0
  #7
Apr 13th, 2005
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...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Pascal and Delphi Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC