Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. //Check Digit Skeleton Program
  2. program prjChkDig;
  3.  
  4. {$mode objfpc}{$H+}
  5.  
  6. uses sysUtils;
  7.  
  8. procedure checkNum(num : string; var isValid : Boolean);
  9. var total, number, i, remainder : integer;
  10. begin
  11. //Input your code here for the checkNum procedure
  12.  
  13.  
  14.  
  15. end;
  16.  
  17. procedure getCheckDigit(num : string; var checkDig : integer);
  18. var i, number, total, remainder : integer;
  19. begin
  20. //Input your code here for the getCheckDigit procedure
  21. writeln(num);
  22.  
  23.  
  24.  
  25.  
  26. end;
  27.  
  28. procedure inputNumber(op : integer);
  29. var number : string;
  30. i, chDig : integer;
  31. isValid : Boolean;
  32. begin
  33. //Input your code here for the inputNumber procedure
  34. if op = 1 then
  35. writeln('Enter The 12 Digit Number You Want A Check Digit Created For:');
  36. readln(i);
  37. if sizeof(i) = 12 then
  38. getCheckDigit(intToStr(i),chDig);
  39. end;
  40.  
  41. procedure getOption;
  42. var optionStr : string;
  43. option : integer;
  44. begin
  45. //Input your code here for the getOption procedure
  46. repeat
  47. writeln('(1) Create A Check Digit For A 12 Digit Number');
  48. writeln('(2) Have A 13 Digit Number Checked To See If The Check Digit Is Valid');
  49. writeln('Enter A Number For Either Of The Options Above:');
  50. readln(option);
  51. if (option < 1) OR (option > 2) then
  52. writeln('Invald Option')
  53. until (option = 1) OR (option = 2);
  54. if option = 1 then
  55. inputNumber(option)
  56. else if option = 2 then
  57. inputNumber(option);
  58.  
  59. end;
  60.  
  61. //MAIN PROGRAM - NOT TO BE UPDATED
  62. begin
  63. writeln(' CHECK DIGIT PROGRAM');
  64. writeln('-----------------------------------');
  65. writeln;
  66. getOption;
  67. readln;
  68. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement