944,089 Members | Top Members by Rank

Ad:
Mar 28th, 2005
0

Help Me

Expand Post »
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..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shmee is offline Offline
3 posts
since Mar 2005
Mar 28th, 2005
0

Re: Help Me

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..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shmee is offline Offline
3 posts
since Mar 2005
Mar 30th, 2005
0

Re: Help Me

Quote 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.
Reputation Points: 10
Solved Threads: 0
Light Poster
Jackrabbit is offline Offline
31 posts
since Jan 2005
Mar 30th, 2005
0

Re: Help Me

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.
Reputation Points: 10
Solved Threads: 0
Light Poster
Jackrabbit is offline Offline
31 posts
since Jan 2005
Mar 30th, 2005
0

Re: Help Me

Thank you very much..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shmee is offline Offline
3 posts
since Mar 2005
Apr 8th, 2005
0

Re: Help Me

JackRabbit, what did that have to do with his program???
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
Apr 13th, 2005
0

Re: Help Me

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

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Pascal and Delphi Forum Timeline: printing from pascal
Next Thread in Pascal and Delphi Forum Timeline: help needed to print from turbo pascal





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC