Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Check Digit Skeleton Program
- program prjChkDig;
- {$mode objfpc}{$H+}
- uses sysUtils;
- procedure checkNum(num : string; var isValid : Boolean);
- var total, number, i, remainder : integer;
- begin
- //Input your code here for the checkNum procedure
- end;
- procedure getCheckDigit(num : string; var checkDig : integer);
- var i, number, total, remainder : integer;
- begin
- //Input your code here for the getCheckDigit procedure
- writeln(num);
- end;
- procedure inputNumber(op : integer);
- var number : string;
- i, chDig : integer;
- isValid : Boolean;
- begin
- //Input your code here for the inputNumber procedure
- if op = 1 then
- writeln('Enter The 12 Digit Number You Want A Check Digit Created For:');
- readln(i);
- if sizeof(i) = 12 then
- getCheckDigit(intToStr(i),chDig);
- end;
- procedure getOption;
- var optionStr : string;
- option : integer;
- begin
- //Input your code here for the getOption procedure
- repeat
- writeln('(1) Create A Check Digit For A 12 Digit Number');
- writeln('(2) Have A 13 Digit Number Checked To See If The Check Digit Is Valid');
- writeln('Enter A Number For Either Of The Options Above:');
- readln(option);
- if (option < 1) OR (option > 2) then
- writeln('Invald Option')
- until (option = 1) OR (option = 2);
- if option = 1 then
- inputNumber(option)
- else if option = 2 then
- inputNumber(option);
- end;
- //MAIN PROGRAM - NOT TO BE UPDATED
- begin
- writeln(' CHECK DIGIT PROGRAM');
- writeln('-----------------------------------');
- writeln;
- getOption;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement