home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hacker Chronicles 2
/
HACKER2.BIN
/
160.LEARNQ.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-10-28
|
5KB
|
187 lines
Program learnq;
{
Ver 1.0 Oct 26,1988
An Amateur radio Qcode (QSO,QSL,etc) drill program
--------------------------------------------------
Peter Laidlaw
No. 3 Squires Avenue,
Toronto,Ontario,
Canada.
M4B-2R2
This program was written to assist prospective amateur operators (me)
in learning the Qcodes. Personally, I found that many of the
Qcodes are of no value however according to the Canadian DOC any one of them
can show up on the test. I don't like flunking tests even though
it requires learning something useless - hence, this program.
Just run it. Its simple. All you have to do is to answer the questions
over and over until you've memorized the Qcodes. I found that I
knew all the ones that are used on the ham bands but the message
related ones were difficult. In the course of using this program
I found that somehow my mind came up with nemonics to key my memory
on the Qcodes..like QTC Q-TeleCrams .. silly but it worked. Now I Know
them all!
The program and source code are free. If you improve upon it, Please
send me a revised copy on floppy. It was written for PC's using
Turbo Pascal IV, compiled with software arithmitic.
Hope it helps someone else! When I took the DOC test there were 7
questions on Qcodes out of 25 questions total.
}
Uses crt;
label loop,start;
var
qcode : array[0..27] of string[5];
meaning : array[0..27] of string[35];
know : array[0..27] of string[3];
letter : packed array [0..27] of char;
file1 : text;
play,ltr,ranvalue,guess,item : char;
i,j,k,noise,ran : integer;
truescore,numtries,score,pcright : real;
set1 : set of char;
begin
clrscr;
start: assign(file1,'QQQ.SDF');
reset (file1);
letter:='ABCDEFGHIJKLMNOPQRSTUVWXYZ10';
for i:=0 to 27 do
begin
readln(file1,qcode[i],meaning[i],know[i]);
{ writeln(qcode[i]:3,' ',meaning[i]:35,' ',know[i]:3);}
end;
for i:=0 to 13 do
begin
j:=i+1;
gotoxy(2,j);
write(letter[i]:1,' ',meaning[i]:30);
gotoxy(38,j);
write(letter[i+14]:1,' ',meaning[i+14]:30);
gotoxy(1,15);
write('-----------------------------------------------------------------------');
end;
numtries:=0.0;
score:=0.0;
set1:=[]; {this set contains the items which the user knows}
repeat
{this produces a new random qcode to test the user}
randomize;
loop:ran:=random(27);
ranvalue := letter[ran];
if(ranvalue in set1) then goto loop;
gotoxy(15,20);
write(qcode[ran],' - Enter the correct number : ');
gotoxy(50,20);
write(' ');
gotoxy(50,20);
guess:=upcase(readkey);
gotoxy(15,22);
if(guess = ranvalue) then
begin
set1:=set1+[guess];
{
gotoxy(2,24);
for item := 'A' to 'Z' do
if item in set1 then write(item);
gotoxy(15,22);
}
score:=score+1.0;
write('Right - ',qcode[ran]:3,'Means:',meaning[ran]:30);
sound(440);delay(100);nosound;
if(ran<=13) then
begin
gotoxy(1,ran+1);write(' ');
end;
if(ran>13) then
begin
gotoxy(35,ran-13);write(' ');
end
end
else write(' ');
gotoxy(15,23);
if ((guess <> ranvalue) and (guess <> '0')) then
begin
write('Wrong you goof - ',qcode[ran]:3,'Means: ',meaning[ran]:30);
for noise := 1 to 10 do
begin
sound(50);delay(10);nosound;
end;
end
else write(' ');
{calculate and write the score}
if guess<>'0' then numtries:=numtries+1.0;
if guess<>'0' then truescore:=100.0*(score/numtries);
pcright:=(score/27)*100.0;
gotoxy(5,16); write('Number of tries: ',numtries:5:0);
gotoxy(5,17); write('Number right : ',score:5:0);
gotoxy(5,18); write('Number wrong : ',(numtries-score):5:0);
gotoxy(43,16); write('Current score : ',truescore:5:1,' %');
gotoxy(43,17); write('Percent right : ',pcright:5:1,' %');
gotoxy(43,18); write(' : ');
until ((guess = '0') or( score=27));
for noise :=500 to 2000 do
begin
sound(noise*2);
end;
nosound;
clrscr;
gotoxy(5,2 ); write('Number of tries: ',numtries:5:0);
gotoxy(5,3 ); write('Number right : ',score:5:0);
gotoxy(5,4 ); write('Number wrong : ',(numtries-score):5:0);
gotoxy(43,2 ); write('Current score : ',truescore:5:1,' %');
gotoxy(43,3 ); write('Percent right : ',pcright:5:1,' %');
gotoxy(43,4 ); write(' : ');
play:='N';
close(file1);
gotoxy(30,13);write('Want to play again (Y/N) ? ');
gotoxy(58,13);write(play);
gotoxy(58,13);
play:=readkey;
gotoxy(58,13);write(play);
if((play ='Y') or( play= 'y')) then goto start;
clrscr;
end.