Orakio/code

< Orakio

Main Page | Recent changes | Random | Special
Edit this page | Page history | Discuss this page
 


Page type: Uncategorised

All assignments for sixth form where I first started seriously programming (its ancient code don't just me on it):


program psotd;{v0011 1a}uses crt,windos,graph;type chrs=record tname:string;
tmemb:integer;tleve:integer;thitp:integer;tmagp:integer;tdayr:integer;
tdamn:integer;tdady:integer;tdmyr:integer;tdmmn:integer;tdmdy:integer;end;
type tchrs=record ttname:string;ttmemb:integer;ttleve:integer;tthitp:integer;
ttmagp:integer;ttdayr:integer;ttdamn:integer;ttdady:integer;ttdmyr:integer;
ttdmmn:integer;ttdmdy:integer;end;const pw='oko';pwf='c:\psop.dat';
tpwf='c:\tpsop.dat';frr=0;scry=21;scrx=54;scrmy=9;scrmx=25;stx=26;
sty=10;afr=5000;scrn=700000;var amc,anc,t1,t5,t6,t9,t8,cx,cy,kpn,dr,mde,max,
may,trl,stmemb,stleve,sthitp,stmagp,stdayr,stdamn,stdady,stdmyr,stdmmn,
stdmdy,fpos:integer;dy,mn,yr,wdy:word;scr,t4:real;stg,img,t2,t3,stname,
trls:string;kp:char;tr:chrs;ttr:tchrs;fl:file of chrs;tfl:file of tchrs;
flfo,dt,cnt:boolean;procedure opf;begin assign(fl,pwf);{$I-}reset(fl);{$I+}
if(ioresult<>0)then rewrite(fl);end;procedure topf;begin assign(tfl,tpwf);
{$I-}reset(tfl);{$I+}if(ioresult<>0)then rewrite(tfl);end;procedure dc;
begin gotoxy(cx,cy);textcolor(4);writeln('±');textcolor(15);gotoxy(38,10);
writeln('Make');gotoxy(37,12);writeln('Delete');gotoxy(38,14);
writeln('Edit');gotoxy(37,16);writeln('Search');gotoxy(38,18);
writeln('View');gotoxy(38,20);writeln('Exit');
if(diskfree(3)<5000000)then begin gotoxy(1,24);
writeln('Warning lowdiskspace! (',diskfree(3),'Bytes)');end;gotoxy(1,24);
end;procedure dcoo;begin gotoxy(cx,cy);textcolor(black);textbackground(black);
writeln(' ');gotoxy(1,25);end;procedure gk;begin kp:=readkey;end;
procedure mo;begin textcolor(0);if(cy=10)and(cx>37)and(cx<42)then begin
gotoxy(38,10);textbackground(blue);writeln('Make');textbackground(black);
t1:=1;end;if(cy=12)and(cx>36)and(cx<43)then begin gotoxy(37,12);
textbackground(blue);writeln('Delete');textbackground(black);t1:=1;end;
if(cy=14)and(cx>37)and(cx<42)then begin gotoxy(38,14);textbackground(blue);
writeln('Edit');textbackground(black);t1:=1;end;
if(cy=16)and(cx>36)and(cx<43)then begin gotoxy(37,16);textbackground(blue);
writeln('Search');textbackground(black);t1:=1;end;
if(cy=18)and(cx>37)and(cx<42)then begin gotoxy(38,18); textbackground(blue);
writeln('View');textbackground(black);t1:=1;end;
if(cy=20)and(cx>37)and(cx<42)then begin gotoxy(38,20);textbackground(blue);
writeln('Exit');textbackground(black);t1:=1;end;if(t1<>1)then dc;t1:=0;
gotoxy(1,25);textcolor(white);end;procedure delf;begin close(fl);opf;topf;
rewrite(tfl);clrscr;while not(eof(fl)) do begin read(fl,tr);
if fpos<>filepos(fl) then begin ttr.ttname:=tr.tname;ttr.ttmemb:=tr.tmemb;
ttr.ttleve:=tr.tleve;ttr.tthitp:=tr.thitp;ttr.ttmagp:=tr.tmagp;
ttr.ttdady:=tr.tdady;ttr.ttdamn:=tr.tdamn;ttr.ttdayr:=tr.tdayr;
ttr.ttdmdy:=tr.tdmdy;ttr.ttdmmn:=tr.tdmmn;ttr.ttdmyr:=tr.tdmyr;
write(tfl,ttr);end;end;close(tfl);rewrite(fl);close(fl);opf;topf;
while not(eof(tfl)) do begin read(tfl,ttr);tr.tname:=ttr.ttname;
tr.tmemb:=ttr.ttmemb;tr.tleve:=ttr.ttleve;tr.thitp:=ttr.tthitp;
tr.tmagp:=ttr.ttmagp;tr.tdady:=ttr.ttdady;tr.tdamn:=ttr.ttdamn;
tr.tdayr:=ttr.ttdayr;tr.tdmdy:=ttr.ttdmdy;tr.tdmmn:=ttr.ttdmmn;
tr.tdmyr:=ttr.ttdmyr;write(fl,tr);end;close(tfl);end;procedure edelf;begin
close(fl);opf;topf;rewrite(tfl);clrscr;while not(eof(fl)) do begin
read(fl,tr);if fpos<>filepos(fl) then begin ttr.ttname:=tr.tname;
ttr.ttmemb:=tr.tmemb;ttr.ttleve:=tr.tleve;ttr.tthitp:=tr.thitp;
ttr.ttmagp:=tr.tmagp;ttr.ttdady:=tr.tdady;ttr.ttdamn:=tr.tdamn;
ttr.ttdayr:=tr.tdayr;ttr.ttdmdy:=tr.tdmdy;ttr.ttdmmn:=tr.tdmmn;
ttr.ttdmyr:=tr.tdmyr;write(tfl,ttr);end else begin clrscr;
gotoxy(2,2);writeln('Edit Entry:');gotoxy(1,3);writeln('~~~~~~~~~~~~');
gotoxy(3,5);writeln('Name:');gotoxy(3,7);writeln('Members:');
gotoxy(3,9);writeln('Level:');gotoxy(3,11);writeln('HP');gotoxy(3,13);
writeln('MP');gotoxy(3,6);readln(ttr.ttname);gotoxy(3,8);readln(ttr.ttmemb);
gotoxy(3,10);readln(ttr.ttleve);gotoxy(3,12);readln(ttr.tthitp);gotoxy(3,14);
readln(ttr.ttmagp);getdate(yr,mn,dy,wdy);ttr.ttdayr:=tr.tdayr;
ttr.ttdamn:=tr.tdamn;ttr.ttdady:=tr.tdady;ttr.ttdmyr:=yr;ttr.ttdmmn:=mn;
ttr.ttdmdy:=dy;write(tfl,ttr);end;end;close(tfl);rewrite(fl);close(fl);
opf;topf;while not(eof(tfl)) do begin read(tfl,ttr);tr.tname:=ttr.ttname;
tr.tmemb:=ttr.ttmemb;tr.tleve:=ttr.ttleve;tr.thitp:=ttr.tthitp;
tr.tmagp:=ttr.ttmagp;tr.tdady:=ttr.ttdady;tr.tdamn:=ttr.ttdamn;
tr.tdayr:=ttr.ttdayr;tr.tdmdy:=ttr.ttdmdy;tr.tdmmn:=ttr.ttdmmn;
tr.tdmyr:=ttr.ttdmyr;write(fl,tr);end;close(tfl);end;procedure md;begin
if(cy=10)and(cx>37)and(cx<42)then begin opf;seek(fl,filesize(fl));clrscr;
gotoxy(2,2);writeln('Add Entry:');gotoxy(1,3);writeln('~~~~~~~~~~~~');
gotoxy(3,5);writeln('Name:');gotoxy(3,7);writeln('Members:');gotoxy(3,9);
writeln('Level:');gotoxy(3,11);writeln('HP');gotoxy(3,13);writeln('MP');
gotoxy(3,6);readln(tr.tname);gotoxy(3,8);readln(tr.tmemb);gotoxy(3,10);
readln(tr.tleve);gotoxy(3,12);readln(tr.thitp);gotoxy(3,14);readln(tr.tmagp);
getdate(yr,mn,dy,wdy);tr.tdayr:=yr;tr.tdamn:=mn;tr.tdady:=dy;tr.tdmyr:=yr;
tr.tdmmn:=mn;tr.tdmdy:=dy;write(fl,tr);close(fl);clrscr;dc;gotoxy(29,3);
textcolor(yellow);writeln('<(RPG Team Database!)>');mo;end;
if(cy=12)and(cx>36)and(cx<43)then begin opf;clrscr;dt:=false;cnt:=false;
gotoxy(2,2);writeln('Delete Search:');gotoxy(1,3);writeln('~~~~~~~~~~~~');
gotoxy(3,5);writeln('Enter name:');gotoxy(3,6);readln(trls);clrscr;
while not(eof(fl))and not(dt) do begin read(fl,tr);if tr.tname=trls then
begin flfo:=true;gotoxy(2,2);writeln('Delete Search:');gotoxy(1,3);
writeln('~~~~~~~~~~~~');gotoxy(3,5);writeln('Name:');gotoxy(3,7);
writeln('Members:');gotoxy(3,9);writeln('Level:');gotoxy(3,11);writeln('HP');
gotoxy(3,13);writeln('MP');gotoxy(3,6);writeln(tr.tname);gotoxy(3,8);
writeln(tr.tmemb);gotoxy(3,10);writeln(tr.tleve);gotoxy(3,12);
writeln(tr.thitp);gotoxy(3,14);writeln(tr.tmagp);gotoxy(3,15);
writeln('Record Created:');gotoxy(3,16);
writeln(tr.tdady,'/',tr.tdamn,'/',tr.tdayr);gotoxy(3,17);writeln('Modified:');
gotoxy(3,18);writeln(tr.tdmdy,'/',tr.tdmmn,'/',tr.tdmyr);gotoxy(3,20);
writeln('Y to delete, any key to next.');repeat if keypressed then begin
gk;if (ord(kp)=121)or(ord(kp)=89) then begin fpos:=filepos(fl);dt:=true;end
else cnt:=true;end;until (dt)or(cnt);clrscr;end;end;if dt then begin delf;
writeln('File deleted!');repeat until keypressed;gk;end;close(fl);clrscr;
dc;gotoxy(29,3);textcolor(yellow);writeln('<(RPG Team Database!)>');mo;
end;if(cy=14)and(cx>37)and(cx<42)then begin opf;clrscr;dt:=false;cnt:=false;
gotoxy(2,2);writeln('Edit Search:');gotoxy(1,3);writeln('~~~~~~~~~~~~');
gotoxy(3,5);writeln('Enter name:');gotoxy(3,6);readln(trls);clrscr;
while not(eof(fl))and not(dt) do begin read(fl,tr);if tr.tname=trls then
begin flfo:=true;gotoxy(2,2);writeln('Edit Search:');gotoxy(1,3);
writeln('~~~~~~~~~~~~');gotoxy(3,5);writeln('Name:');gotoxy(3,7);
writeln('Members:');gotoxy(3,9);writeln('Level:');gotoxy(3,11);writeln('HP');
gotoxy(3,13);writeln('MP');gotoxy(3,6);writeln(tr.tname);gotoxy(3,8);
writeln(tr.tmemb);gotoxy(3,10);writeln(tr.tleve);gotoxy(3,12);
writeln(tr.thitp);gotoxy(3,14);writeln(tr.tmagp);gotoxy(3,15);
writeln('Record Created:');gotoxy(3,16);
writeln(tr.tdady,'/',tr.tdamn,'/',tr.tdayr);gotoxy(3,17);
writeln('Modified:');gotoxy(3,18);
writeln(tr.tdmdy,'/',tr.tdmmn,'/',tr.tdmyr);gotoxy(3,20);
writeln('Y to edit, any key to next.');repeat if keypressed then begin gk;
if (ord(kp)=121)or(ord(kp)=89) then begin fpos:=filepos(fl);dt:=true;end
else cnt:=true;end;until (dt)or(cnt);clrscr;end;end;if dt then begin edelf;
clrscr;writeln('File edited!');repeat until keypressed;gk;end;close(fl);
clrscr;dc;gotoxy(29,3);textcolor(yellow);writeln('<(RPG Team Database!)>');
mo;end;if(cy=16)and(cx>36)and(cx<43)then begin opf;clrscr;gotoxy(2,2);
writeln('Search:');gotoxy(1,3);writeln('~~~~~~~~~~~~');gotoxy(3,5);
writeln('What would you like to search for?');writeln('   1: Name');
writeln('   2: Members');writeln('   3: Level');writeln('   4: HP');
writeln('   5: MP');readln(trl);flfo:=false;
if(trl=1)or(trl=2)or(trl=3)or(trl=4)or(trl=5)then begin if trl=1 then
begin clrscr;gotoxy(2,2);writeln('Search:');gotoxy(1,3);
writeln('~~~~~~~~~~~~');gotoxy(3,5);writeln('Enter name:');gotoxy(3,6);
readln(trls);clrscr;while not(eof(fl)) do begin read(fl,tr);
if tr.tname=trls then begin flfo:=true;gotoxy(2,2);writeln('Search:');
gotoxy(1,3);writeln('~~~~~~~~~~~~');gotoxy(3,5);writeln('Name:');gotoxy(3,7);
writeln('Members:');gotoxy(3,9);writeln('Level:');gotoxy(3,11);writeln('HP');
gotoxy(3,13);writeln('MP');gotoxy(3,6);writeln(tr.tname);gotoxy(3,8);
writeln(tr.tmemb);gotoxy(3,10);writeln(tr.tleve);gotoxy(3,12);
writeln(tr.thitp);gotoxy(3,14);writeln(tr.tmagp);gotoxy(3,15);
writeln('Record Created:');gotoxy(3,16);
writeln(tr.tdady,'/',tr.tdamn,'/',tr.tdayr);gotoxy(3,17);writeln('Modified:');
gotoxy(3,18);writeln(tr.tdmdy,'/',tr.tdmmn,'/',tr.tdmyr);repeat
until keypressed;gk;clrscr;end;end;end;if trl=2 then begin clrscr;gotoxy(2,2);
writeln('Search:');gotoxy(1,3);writeln('~~~~~~~~~~~~');gotoxy(3,5);
writeln('Enter Members:');gotoxy(3,6);readln(trl);clrscr;
while not(eof(fl)) do begin read(fl,tr);if tr.tmemb=trl then begin
flfo:=true;gotoxy(2,2);writeln('Search:');gotoxy(1,3);writeln('~~~~~~~~~~~~');
gotoxy(3,5);writeln('Name:');gotoxy(3,7);writeln('Members:');gotoxy(3,9);
writeln('Level:');gotoxy(3,11);writeln('HP');gotoxy(3,13);writeln('MP');
gotoxy(3,6);writeln(tr.tname);gotoxy(3,8);writeln(tr.tmemb);gotoxy(3,10);
writeln(tr.tleve);gotoxy(3,12);writeln(tr.thitp);gotoxy(3,14);
writeln(tr.tmagp);gotoxy(3,15);writeln('Record Created:');gotoxy(3,16);
writeln(tr.tdady,'/',tr.tdamn,'/',tr.tdayr);gotoxy(3,17);writeln('Modified:');
gotoxy(3,18);writeln(tr.tdmdy,'/',tr.tdmmn,'/',tr.tdmyr);repeat
until keypressed;gk;clrscr;end;end;end;if trl=3 then begin clrscr;
gotoxy(2,2);writeln('Search:');gotoxy(1,3);writeln('~~~~~~~~~~~~');
gotoxy(3,5);writeln('Enter Level:');gotoxy(3,6);readln(trl);clrscr;
while not(eof(fl)) do begin read(fl,tr);if tr.tleve=trl then begin
flfo:=true;gotoxy(2,2);writeln('Search:');gotoxy(1,3);writeln('~~~~~~~~~~~~');
gotoxy(3,5);writeln('Name:');gotoxy(3,7);writeln('Members:');gotoxy(3,9);
writeln('Level:');gotoxy(3,11);writeln('HP');gotoxy(3,13);writeln('MP');
gotoxy(3,6);writeln(tr.tname);gotoxy(3,8);writeln(tr.tmemb);gotoxy(3,10);
writeln(tr.tleve);gotoxy(3,12);writeln(tr.thitp);gotoxy(3,14);
writeln(tr.tmagp);gotoxy(3,15);writeln('Record Created:');gotoxy(3,16);
writeln(tr.tdady,'/',tr.tdamn,'/',tr.tdayr);gotoxy(3,17);writeln('Modified:');
gotoxy(3,18);writeln(tr.tdmdy,'/',tr.tdmmn,'/',tr.tdmyr);repeat
until keypressed;gk;clrscr;end;end;end;if trl=4 then begin clrscr;
gotoxy(2,2);writeln('Search:');gotoxy(1,3);writeln('~~~~~~~~~~~~');
gotoxy(3,5);writeln('Enter HP:');gotoxy(3,6);readln(trl);clrscr;
while not(eof(fl)) do begin read(fl,tr);
if tr.thitp=trl then begin flfo:=true;gotoxy(2,2);writeln('Search:');
gotoxy(1,3);writeln('~~~~~~~~~~~~');gotoxy(3,5);writeln('Name:');gotoxy(3,7);
writeln('Members:');gotoxy(3,9);writeln('Level:');gotoxy(3,11);writeln('HP');
gotoxy(3,13);writeln('MP');gotoxy(3,6);writeln(tr.tname);gotoxy(3,8);
writeln(tr.tmemb);gotoxy(3,10);writeln(tr.tleve);gotoxy(3,12);
writeln(tr.thitp);gotoxy(3,14);writeln(tr.tmagp);gotoxy(3,15);
writeln('Record Created:');gotoxy(3,16);
writeln(tr.tdady,'/',tr.tdamn,'/',tr.tdayr);gotoxy(3,17);writeln('Modified:');
gotoxy(3,18);writeln(tr.tdmdy,'/',tr.tdmmn,'/',tr.tdmyr);repeat
until keypressed;gk;clrscr;end;end;end;if trl=5 then begin clrscr;gotoxy(2,2);
writeln('Search:');gotoxy(1,3);writeln('~~~~~~~~~~~~');gotoxy(3,5);
writeln('Enter MP:');gotoxy(3,6);readln(trl);clrscr;while not(eof(fl)) do
begin read(fl,tr);if tr.tmagp=trl then begin flfo:=true;gotoxy(2,2);
writeln('Search:');gotoxy(1,3);writeln('~~~~~~~~~~~~');gotoxy(3,5);
writeln('Name:');gotoxy(3,7);writeln('Members:');gotoxy(3,9);
writeln('Level:');gotoxy(3,11);writeln('HP');gotoxy(3,13);writeln('MP');
gotoxy(3,6);writeln(tr.tname);gotoxy(3,8);writeln(tr.tmemb);gotoxy(3,10);
writeln(tr.tleve);gotoxy(3,12);writeln(tr.thitp);gotoxy(3,14);
writeln(tr.tmagp);gotoxy(3,15);writeln('Record Created:');gotoxy(3,16);
writeln(tr.tdady,'/',tr.tdamn,'/',tr.tdayr);gotoxy(3,17);writeln('Modified:');
gotoxy(3,18);writeln(tr.tdmdy,'/',tr.tdmmn,'/',tr.tdmyr);repeat
until keypressed;gk;clrscr;end;end;end;end;close(fl);clrscr;
if not(flfo) then begin writeln('No matches found!');repeat until keypressed;
gk;clrscr;end;dc;gotoxy(29,3);textcolor(yellow);
writeln('<(RPG Team Database!)>');mo;end;if(cy=18)and(cx>37)and(cx<42)then
begin opf;clrscr;while not(eof(fl)) do begin read(fl,tr);gotoxy(2,2);
writeln('View All:');gotoxy(1,3);writeln('~~~~~~~~~~~~');gotoxy(3,5);
writeln('Name:');gotoxy(3,7);writeln('Members:');gotoxy(3,9);
writeln('Level:');gotoxy(3,11);writeln('HP');gotoxy(3,13);
writeln('MP');gotoxy(3,6);writeln(tr.tname);gotoxy(3,8);
writeln(tr.tmemb);gotoxy(3,10);writeln(tr.tleve);gotoxy(3,12);
writeln(tr.thitp);gotoxy(3,14);writeln(tr.tmagp);gotoxy(3,15);
writeln('Record Created:');gotoxy(3,16);
writeln(tr.tdady,'/',tr.tdamn,'/',tr.tdayr);gotoxy(3,17);
writeln('Modified:');gotoxy(3,18);writeln(tr.tdmdy,'/',tr.tdmmn,'/',tr.tdmyr);
repeat until keypressed;gk;clrscr;end;close(fl);clrscr;dc;gotoxy(29,3);
textcolor(yellow);writeln('<(RPG Team Database!)>');mo;end;
if(cy=20)and(cx>37)and(cx<42)then begin stg:='end';end;end;procedure ani;
begin if(anc=afr)then begin gotoxy(28,5);textcolor(9);if(amc=1)then
writeln('---<<<<<<+(())+>>>>>>---');if(amc=2)then
writeln('---<<<<<+<(())>+>>>>>---');if(amc=3)then
writeln('---<<<<+<<(())>>+>>>>---');if(amc=4)then
writeln('---<<<+<<<(())>>>+>>>---');if(amc=5)then
writeln('---<<+<<<<(())>>>>+>>---');if(amc=6)then
writeln('---<+<<<<<(())>>>>>+>---');if(amc=7)then
writeln('---+<<<<<<(())>>>>>>+---');if(amc=8)then
writeln('--+-<<<<<<(())>>>>>>-+--');if(amc=9)then
writeln('-+--<<<<<<(())>>>>>>--+-');if(amc=10)then
writeln('+---<<<<<<(())>>>>>>---+');if(amc=10)then amc:=1 else amc:=amc+1;
anc:=0;end else anc:=anc+1;gotoxy(1,25);end;procedure scsv1;begin dr:=0;
mde:=0;initgraph(dr,mde,'');repeat setcolor(random(getmaxcolor));
line(getmaxx,getmaxy,random(getmaxx),random(getmaxy));until keypressed;
gk;restorecrtmode;dc;gotoxy(29,3);textcolor(yellow);
writeln('<(RPG Team Database!)>');mo;end;procedure me;begin kpn:=0;
gotoxy(29,3);textcolor(yellow);writeln('<(RPG Team Database!)>');
textcolor(white);dc;repeat ani;if(keypressed)then begin scr:=0;gk;
kpn:=ord(kp);if(kpn=80)then begin if(cy<scry)then begin dcoo; cy:=cy+1;
mo;end;end;if(kpn=72)then begin if(cy>scrmy)then begin dcoo;cy:=cy-1;
mo;end;end;if(kpn=75)then begin if(cx>scrmx)then begin dcoo;cx:=cx-1;
mo;end;end;if(kpn=77)then begin if(cx<scrx)then begin dcoo;cx:=cx+1;
mo;end;end;end;if(kpn=13)then begin kpn:=0;md;end;delay(frr);scr:=scr+1;
if(scr=scrn)then scsv1;until stg='end';end;procedure pws; begin
if(length(t2)=0)then t3:='';if(length(t2)=1)then t3:='*';
if(length(t2)=2)then t3:='**';if(length(t2)=3)then t3:='***';
if(length(t2)=4)then t3:='****'; if(length(t2)=5)then t3:='*****';
if(length(t2)=6)then t3:='******';if(length(t2)=7)then t3:='*******';
if(length(t2)=8)then t3:='********';setfillstyle(0,0);
bar((getmaxx-68)div 2,(getmaxy+2)div 2,(getmaxx+68)div 2,(getmaxy+23)div 2);
settextstyle(0,0,1);setcolor(15);
outtextxy((getmaxx-64)div 2,(getmaxy+6)div 2,t3);end;procedure pww;begin
t2:=t2+kp;pws;end;procedure st;begin dr:=0;mde:=0;initgraph(dr,mde,'');
setcolor(1);rectangle(0,0,getmaxx,getmaxy);setfillstyle(11,14);
setcolor(15);bar(1,1,getmaxx-1,getmaxy-1);setcolor(11);
max:=(getmaxx-240)div 2;may:=(getmaxy-180)div 2;setfillstyle(9,8);
bar3d(max,may,max+240,may+180,5,topon);setcolor(5);
settextstyle(defaultfont,vertdir,1);
outtextxy(max+13,may+20,'RPG Team Database');setcolor(6);
line(max+15,may+5,max+15,may+175);
setcolor(4);settextstyle(defaultfont,horizdir,2);
outtextxy(max+30,may+10,'Version');outtextxy(max+30,may+30,'0011');
outtextxy(max+30,may+70,'Scripted by');outtextxy(max+30,may+90,'Joey');
outtextxy(max+30,may+130,'Updated');outtextxy(max+30,may+150,'15/6/2001');
repeat until keypressed;gk;setfillstyle(1,0);bar(0,0,getmaxx,getmaxy);
setcolor(15);rectangle((getmaxx-150)div 2,(getmaxy-75)div 2,(getmaxx+150)div 2,
(getmaxy+75)div 2);setfillstyle(9,8);bar((getmaxx-148)div 2,(getmaxy-73)div 2,
(getmaxx+148)div 2,(getmaxy+73)div 2);setcolor(7);line((getmaxx-140)div 2,
(getmaxy-40)div 2,(getmaxx+140)div 2,(getmaxy-40)div 2);setcolor(4);
rectangle((getmaxx-70)div 2,(getmaxy)div 2,(getmaxx+70)div 2,(getmaxy+25)div 2);
settextstyle(2,0,5);setcolor(14);outtextxy((getmaxx-110)div 2,(getmaxy-74)div 2,
'Enter Password:');setfillstyle(1,0);bar((getmaxx-68)div 2,(getmaxy+2)div 2,
(getmaxx+68)div 2,(getmaxy+23)div 2);repeat if(keypressed)then begin gk;
if(ord(kp)=13)or(ord(kp)=8)then begin if(ord(kp)=13)then if(t2=pw)then
t2:='correctpwentered'else begin randomize;setfillstyle(1,4);
bar(0,0,getmaxx,getmaxy);sound(500);repeat setcolor(random(getmaxcolor));
settextstyle(random(4),0,random(6));
outtextxy((random(getmaxx))-140,(random(getmaxy))-20,'Incorrect passwordium!');
sound(1000);delay(100);sound(1500);delay(100);sound(700);delay(100);
sound(2000);delay(50);sound(1400);delay(100);sound(900);delay(100);
until keypressed;t4:=0;t5:=1;t6:=1;t8:=getmaxx div 2;t9:=getmaxy div 2;
repeat t4:=t4+1;t8:=t8+t5;t9:=t9+t6;if t8=0 then t5:=1;if t8=getmaxx then
t5:=-1;if t9=0 then t6:=1;if t9=getmaxy then t6:=-1;
putpixel(t8,t9,random(getmaxcolor));until t4=1000000;t4:=0;t5:=1;t6:=1;
t8:=(getmaxx div 2)+1;t9:=(getmaxy div 2);repeat t4:=t4+1;t8:=t8+t5;
t9:=t9+t6;if t8=0 then t5:=1;if t8=getmaxx then t5:=-1;if t9=0 then t6:=1;
if t9=getmaxy then t6:=-1;putpixel(t8,t9,random(getmaxcolor)); until
t4=1000000;setcolor(14);settextstyle(0,0,18);nosound;
outtextxy(40,(getmaxy-300) div 2,'GOOD');outtextxy(60,(getmaxy) div 2,'BYE!');
sound(8000);delay(60000);nosound;halt(1);end;if (ord(kp)=8) then
if (length(t2)>0) then begin delete(t2,length(t2)-1,1);pws;end;end else
if(length(t2)<8)then pww;end;until length(t2)>8;closegraph;clrscr;cx:=stx;
cy:=sty;stg:='me';amc:=1;anc:=0;me;end;begin if(stg<>'end')then st;
textbackground(black);clrscr;dr:=0;mde:=0;initgraph(dr,mde,'');repeat
setcolor(random(getmaxcolor));settextstyle(defaultfont,0,random(10));
outtextxy(random(getmaxx),random(getmaxy),'BYE!');sound(random(500));
delay(10);nosound;until keypressed;nosound;halt(1);end.

Written before orakio new how to use tab and return. Teachers love marking it. Known as brick code, or a code block.

First ever C program:

/*
Date validation functions and example of usage.
Version 1.0.1 by
Made in Borland C++ 5.01
*/
#include <stdio.h>
#include <conio.h>
#include <string>
#include <stdlib.h>
#define bool int
#define true 1
#define false 0
/* Functions */
bool ValidDay(int InDay) { // Returns whether or not the day is valid
if (InDay>0&&InDay<32) return 1;else return 0; }
bool ValidMonth(int InMonth) { // Returns whether or not the month is valid
if (InMonth>0&&InMonth<13) return 1;else return 0; }
bool ValidYear(int InYear) { // Returns whether or not the year is valid
if (InYear>1979&&InYear<3001) return 1;else return 0; }
bool IsLeap(int InYear) { // Returns whether year is leap or not
if (InYear % 4==0) return 1;else return 0; }
char* DateToStarSign(int InDay, int InMonth) { // Returns starsign from date
if ((InMonth==3&&InDay>19)||(InMonth==4&&InDay<19)) return "Aries";
else if ((InMonth==4&&InDay>18)||(InMonth==5&&InDay<20)) return "Taurus";
else if ((InMonth==5&&InDay>19)||(InMonth==6&&InDay<21)) return "Gemini";
else if ((InMonth==6&&InDay>20)||(InMonth==7&&InDay<22)) return "Cancer";
else if ((InMonth==7&&InDay>21)||(InMonth==8&&InDay<23)) return "Leo";
else if ((InMonth==8&&InDay>22)||(InMonth==9&&InDay<22)) return "Virgo";
else if ((InMonth==9&&InDay>21)||(InMonth==10&&InDay<23)) return "Libra";
else if ((InMonth==10&&InDay>22)||(InMonth==11&&InDay<22)) return "Scorpio";
else if ((InMonth==11&&InDay>21)||(InMonth==12&&InDay<20)) return "Sagittarius";
else if ((InMonth==12&&InDay>19)||(InMonth==1&&InDay<21)) return "Capricorn";
else if ((InMonth==1&&InDay>20)||(InMonth==2&&InDay<20)) return "Aquarious";
else if ((InMonth==2&&InDay>19)||(InMonth==3&&InDay<20)) return "Pisces";
else return "Error"; }
char* Mid(char InText[33], int InStart, int InLength) { // Chops specific parts from text
static char OutEdText[33] = "";
for (int TempLoopCount = 0;TempLoopCount<InLength;TempLoopCount++) {
OutEdText[TempLoopCount] = InText[TempLoopCount+InStart]; }
return OutEdText; }
bool DoesStringExist(char InText[33],char InSubString[33]) { // Scans the characters for the existance of a string
int TempVar;std::string TextCmp1 = InText;std::string TextCmp2 = InSubString;
for(int TempLoopCount = 0; TempLoopCount<TextCmp2.length(); TempLoopCount++) {
TextCmp2[TempLoopCount] = tolower(TextCmp2[TempLoopCount]); }
for(int TempLoopCount = 0; TempLoopCount<TextCmp1.length(); TempLoopCount++) {
TextCmp1[TempLoopCount] = tolower(TextCmp1[TempLoopCount]); }
TempVar=TextCmp1.find(TextCmp2,0);
if (TempVar < 0) return 0;
else return 1; }
int MonthParse(char InText[30]) { // Guesses the month from the text
if (DoesStringExist(InText, "jan")) return 1;
else if (DoesStringExist(InText, "feb")) return 2;
else if (DoesStringExist(InText, "mar")) return 3;
else if (DoesStringExist(InText, "apr")) return 4;
else if (DoesStringExist(InText, "may")) return 5;
else if (DoesStringExist(InText, "jun")) return 6;
else if (DoesStringExist(InText, "jul")) return 7;
else if (DoesStringExist(InText, "aug")) return 8;
else if (DoesStringExist(InText, "sep")) return 9;
else if (DoesStringExist(InText, "oct")) return 10;
else if (DoesStringExist(InText, "nov")) return 11;
else if (DoesStringExist(InText, "dec")) return 12;
else return 0; }
char* DateToSeason(int InDay,int InMonth) { // Returns the season from the date
if (InMonth>11&&InDay>20) return "Winter";
else if (InMonth>8&&InDay>22) return "Autumn";
else if (InMonth>5&&InDay>20) return "Summer";
else if (InMonth>2&&InDay>19) return "Spring";
else return "Winter"; }
char* MonthNumberToName(int InMonth) { // Returns the name of the month from the number
switch (InMonth) {
case 1:return "January";case 2:return "Febuary";case 3:return "March";
case 4:return "April";case 5:return "May";case 6:return "June";
case 7:return "July";case 8:return "August";case 9:return "September";
case 10:return "October";case 11:return "November";case 12:return "December";
default: return "Error"; }
}
char* DayNumToDayName(int InDayID) { // Returns the day name from a number
switch(InDayID) {
case 0:return "Sunday";case 1:return "Monday";case 2:return "Tuesday";
case 3:return "Wednesday";case 4:return "Thursday";case 5:return "Friday";
case 6:return "Saturday";default:return "Error"; }
}
char* NumberSuffix(int InNumber) { // Returns st for 1 nd for 2 etc
char TempInNumber[33];itoa(InNumber,TempInNumber,10);
if (InNumber==1) return "st";
else if (InNumber==2) return "nd";
else if (InNumber==3) return "rd";
else if (InNumber>3&&InNumber<10) return "th";
else if (TempInNumber[strlen(TempInNumber)-2]=='1') return "th";
else if (TempInNumber[strlen(TempInNumber)-1]=='1') return "st";
else if (TempInNumber[strlen(TempInNumber)-1]=='2') return "nd";
else if (TempInNumber[strlen(TempInNumber)-1]=='3') return "rd";
else return "th"; }
int DaysInFeb(int InYear) { // Returns the days in Febuary accounting for leap years
if (IsLeap(InYear)) return 29;else return 28; }
int DaysInYear(int InYear) { // Returns number of days in a year
if (IsLeap(InYear)) return 366;else return 365; }
int DaysInMonth(int InMonth, int InYear) { // Returns the number of days for a given month
switch(InMonth) {
case 1:return 31;case 2:return DaysInFeb(InYear);
case 3:return 31;case 4:return 30;case 5:return 31;
case 6:return 30;case 7:return 31;case 8:return 31;
case 9:return 30;case 10:return 31;case 11:return 30;
case 12:return 31;default:return 0; }
}
bool ValidDate(int InDay, int InMonth, int InYear) { // Returns whether or not the date is valid
if (!ValidDay(InDay)) return 0;
else if (!ValidMonth(InMonth)) return 0;
else if (!ValidYear(InYear)) return 0;
else if (InDay>DaysInMonth(InMonth,InYear)) return 0;
else return 1; }
int DaysElapsed(int InDay,int InMonth,int InYear) { // Returns the days elapsed in the current year from the date
int OutDaysGone=0,TempLoopCount=0;
while (TempLoopCount<InMonth-1) { TempLoopCount++;OutDaysGone+=DaysInMonth(TempLoopCount,InYear); }
OutDaysGone+=InDay-1;return OutDaysGone; }
int DaysLeft(int InDay,int InMonth,int InYear) { // Returns days left until the end of the year
return DaysInYear(InYear) - DaysElapsed(InDay,InMonth,InYear); }
int DateToDay(int InDay, int InMonth, int InYear) { // Returns the day of the week from the date
int OutDayID;
if (InMonth==1||InMonth==2) { InMonth+=12;InYear--; }
OutDayID = (InDay + (((InMonth + 1) * 26) / 10) + (InYear % 100) + ((InYear % 100) / 4) + ((InYear / 100) /4) - (2 * (InYear / 100))) % 7;
if (OutDayID<0) OutDayID+=7;return OutDayID-1; }
int InputYear() { // Gets the year
int KeyIn;char KeyDay[3];
for (int TempLoopVar=0;TempLoopVar<5;TempLoopVar++) {
KeyIn = getch();
if (KeyIn>48&&KeyIn<58&&TempLoopVar==0) {
KeyDay[TempLoopVar] = KeyIn;printf("%c",KeyDay[TempLoopVar]); }
else if (KeyIn>47&&KeyIn<58&&TempLoopVar<4&&TempLoopVar!=0) { KeyDay[TempLoopVar]=KeyIn;printf("%c",KeyDay[TempLoopVar]); }
else if (KeyIn==13&&TempLoopVar>3) TempLoopVar=5;
else if (KeyIn==8&&TempLoopVar>0) {
KeyIn = wherex();KeyIn--;KeyDay[TempLoopVar-1] = 'a';
gotoxy(KeyIn,wherey());printf(" ");gotoxy(KeyIn,wherey());TempLoopVar-=2; }
else TempLoopVar--; }
KeyIn = atoi(KeyDay);return KeyIn; }
int InputMonth() { // Gets the month
int KeyIn;char KeyDay[3];
for (int TempLoopVar=0;TempLoopVar<3;TempLoopVar++) {
KeyIn = getch();
if (KeyIn>47&&KeyIn<58&&TempLoopVar==0) { KeyDay[TempLoopVar] = KeyIn;printf("%c",KeyDay[TempLoopVar]); }
else if (KeyIn>47&&KeyIn<58&&TempLoopVar==1&&(KeyDay[0]=='1'||KeyDay[0]=='0')) {
if (KeyIn>47&&KeyIn<51&&KeyDay[0]=='1') { KeyDay[TempLoopVar]=KeyIn;printf("%c",KeyDay[TempLoopVar]); }
else if (KeyIn>48&&KeyIn<58&&KeyDay[0]=='0') { KeyDay[TempLoopVar]=KeyIn;printf("%c",KeyDay[TempLoopVar]); }
else TempLoopVar--; }
else if (KeyIn==13&&TempLoopVar>0&&(!(TempLoopVar==1&&KeyDay[0]=='0'))) TempLoopVar=3;
else if (KeyIn==8&&TempLoopVar>0) {
KeyIn = wherex();KeyIn--;KeyDay[TempLoopVar-1] = 'a';
gotoxy(KeyIn,wherey());printf(" ");gotoxy(KeyIn,wherey());TempLoopVar-=2; }
else TempLoopVar--; }
KeyIn = atoi(KeyDay);return KeyIn; }
int InputDay() { // Gets the day of the month
int KeyIn;char KeyDay[3];
for (int TempLoopVar=0;TempLoopVar<3;TempLoopVar++) {
KeyIn = getch();
if (KeyIn>47&&KeyIn<58&&TempLoopVar==0) {
KeyDay[TempLoopVar] = KeyIn;printf("%c",KeyDay[TempLoopVar]); }
else if (KeyIn>47&&KeyIn<58&&TempLoopVar==1&&(KeyDay[0]=='0'||KeyDay[0]=='1'||KeyDay[0]=='2'||KeyDay[0]=='3')) {
if (KeyIn>47&&KeyIn<50&&KeyDay[0]=='3') { KeyDay[TempLoopVar]=KeyIn;printf("%c",KeyDay[TempLoopVar]); }
else if (KeyIn>48&&KeyIn<58&&KeyDay[0]=='0') { KeyDay[TempLoopVar]=KeyIn;printf("%c",KeyDay[TempLoopVar]); }
else if (KeyDay[0]!='3'&&KeyDay[0]!='0') { KeyDay[TempLoopVar]=KeyIn;printf("%c",KeyDay[TempLoopVar]); }
else TempLoopVar--; }
else if (KeyIn==13&&TempLoopVar>0&&(!(TempLoopVar==1&&KeyDay[0]=='0'))) TempLoopVar=3;
else if (KeyIn==8&&TempLoopVar>0) {
KeyIn = wherex();KeyIn--;KeyDay[TempLoopVar-1] = 'a';
gotoxy(KeyIn,wherey());printf(" ");gotoxy(KeyIn,wherey());TempLoopVar-=2; }
else TempLoopVar--; }
KeyIn = atoi(KeyDay);return KeyIn; }
/* Body with examples of how to implement the date validation functions */
void main() {
int Year,Month,Day,TempVar1,TempVar2;char TempCA1[10];
do {
clrscr();printf("Input Year: ");Year = InputYear();
printf("\nInput Month: ");Month = InputMonth();
printf("\nInput day: ");Day = InputDay();
printf("\nYou entered %i",Day);
printf("/%i",Month);
printf("/%i",Year);
if (ValidDay(Day)) printf("\nDay is valid.\n");
else printf("\nDay is invalid.\n");
if (ValidMonth(Month)) printf("Month is valid.\n");
else printf("Month is invalid.\n");
if (ValidYear(Year)) printf("Year is valid.\n");
else printf("Year is invalid.\n");
if (ValidDate(Day,Month,Year)) printf("Date is valid.\n");
else { printf("Date is invalid.\n");
printf("Press X to exit or any other key to continue.\n");TempVar1 = getch();
if (TempVar1==88||TempVar1==120) exit(0);
}
} while (! ValidDate(Day,Month,Year));
printf("The day is %s",DayNumToDayName(DateToDay(Day,Month,Year)));
printf(".\n%i",DaysElapsed(Day,Month,Year));
printf(" days have elapsed and there are %i",DaysLeft(Day,Month,Year));
printf(" days left.\n");
printf("There are %i",DaysInYear(Year));
printf(" days in the year.\n");
if (IsLeap(Year)) printf("It is a leap year.\n");
else printf("It is not a leap year.\n");
printf("It is the %i",(DaysElapsed(Day,Month,Year)+1));
printf("%s",NumberSuffix((DaysElapsed(Day,Month,Year)+1)));
printf(" day of the year.\n");
printf("The Month is %s",MonthNumberToName(Month));
printf(".\nThe starsign is %s",DateToStarSign(Day,Month));
printf(".\nThe season is %s",DateToSeason(Day,Month));
printf(".\nEnter a Month as string:\n");
for (TempVar1 = 0;TempVar1 < 10;TempVar1++) {
TempVar2 = getch();
if ((TempVar2>96&&TempVar2<123)||(TempVar2>64&&TempVar2<91)) {
TempCA1[TempVar1] = TempVar2;printf("%c",TempCA1[TempVar1]); }
else if (TempVar2==13&&TempVar1>2) TempVar1=10;
else if (TempVar2==8&&TempVar1>0) {
TempVar2 = wherex();TempVar2--;
gotoxy(TempVar2,wherey());printf(" ");gotoxy(TempVar2,wherey());TempVar1-=2; }
else TempVar1--; }
printf("\nThe Month you entered was %s",MonthNumberToName(MonthParse(TempCA1)));
printf(" which is the %i",MonthParse(TempCA1));
printf("%s",NumberSuffix(MonthParse(TempCA1)));
printf(" month.\n");
printf("Press any key to end.\n");getch(); }

Teachers especially loved marking this. It was supposed to be in pascal but I got bored of that.

First attempt at assembly:

.COMMENT
;[ +++++++++++++++++++++++++++++++++	]
;[ quiz.asm Multiple choice questions v1.0	]
;[ (C) 2002 			]
;[ +++++++++++++++++++++++++++++++++	]
.MODEL TINY
.DATA	;Data declare section
	SCORE_0	DB	0	;Normal score
	SCORE_1	DB	0	;Ones
	SCORE_10	DB	0	;Tens
	SCORE_100	DB	0	;Hundreds
	POS_Q		DW	0	;Position of the question
	POS_A		DW	0	;Position of answer
	SPLASH_1	DB	'[ +++++++++++++++++++++++++++++++++	]',10,13,'$'	;Splash screen
	SPLASH_2	DB	'[ quiz.asm Multiple choice questions v1.0	]',10,13,'$'
	SPLASH_3	DB	'[ (C) 2002 			]',10,13,'$'
	SPLASH_4	DB	'[ +++++++++++++++++++++++++++++++++	]',10,13,'$'
	SPLASH_5	DB	'Press 1 for a plus questions or anyother key for general knowledge.',10,13,'$'
	QUESTION_1 	DB	'Question 1: Which is conventional memory?',10,13,'$'	;Question
	ANSWERS_1	DB	'1) 640K-1024K',10,13,'2) 1088K +',10,13,'3) 1K-640K',10,13,'4) 1024K-1088K',10,13,'$'	;Choices
	QUESTION_2	DB	'Question2: Which of these is not a networking protocol?',10,13,'$'
	ANSWERS_2	DB	'1) LANnet',10,13,'2) NetBEUI',10,13,'3) IPX/SPX',10,13,'4) TCP/IP',10,13,'$'
	QUESTION_3	DB	'Question3: Which of the following is a Windows Swap file?',10,13,'$'
	ANSWERS_3	DB	'1) WINSWP.TMP',10,13,'2) WIN386.SWP',10,13,'3) WINSWP.386',10,13,'4) TMPSWP.WIN',10,13,'$'
	QUESTION_4	DB	'Question4: DOS has a maximum number of characters in a filename of:',10,13,'$'
	ANSWERS_4	DB	'1) 8',10,13,'2) 10',10,13,'3) 255',10,13,'4) 11',10,13,'$'
	QUESTION_5	DB	'Question5: What is REGEDIT.EXE used to edit?',10,13,'$'
	ANSWERS_5	DB	'1) Regular files',10,13,'2) The registry',10,13,'3) Network settings',10,13,'4) Registration files',10,13,'$'
	QUESTION_6	DB	'Question6: What kind of file does Windows 3.x use for settings for DOS programs?',10,13,'$'
	ANSWERS_6	DB	'1) BAT',10,13,'2) COM',10,13,'3) EXE',10,13,'4) PIF',10,13,'$'
	QUESTION_7	DB	'Question7: Which DOS utility allows you to see memory usage?',10,13,'$'
	ANSWERS_7	DB	'1) MEM.EXE',10,13,'2) MEM.COM',10,13,'3) MEMORY.COM',10,13,'4) HIMEM.SYS',10,13,'$'
	QUESTION_8	DB	'Question8: What is the minimum processor needed to install Windows 95?',10,13,'$'
	ANSWERS_8	DB	'1) 286',10,13,'2) 386SX',10,13,'3) 386DX',10,13,'4) 486SX',10,13,'$'
	QUESTION_9	DB	'Question9: What is the Windows 95 diagnostic mode called?',10,13,'$'
	ANSWERS_9	DB	'1) GPF Protection',10,13,'2) Safe',10,13,'3) Crash Prevent',10,13,'4) Safety',10,13,'$'
	QUESTION_10	DB	'Question10: Internal DOS Commands are in:',10,13,'$'
	ANSWERS_10	DB	'1) CONFIG.SYS',10,13,'2) COMMAND.SYS',10,13,'3) PROGRAM.COM',10,13,'4) COMMAND.COM',10,13,'$'
	QUESTION_11	DB	'Question11: Upper Memory blocks are located where?',10,13,'$'
	ANSWERS_11	DB	'1) Conventional',10,13,'2) Extended',10,13,'3) Expanded',10,13,'4) Reserved',10,13,'$'
	QUESTION_12	DB	'Question12: How do you allow device drivers and TSRs to be loaded into Upper Memory Blocks?',10,13,'$'
	ANSWERS_12	DB	'1) Dos=High',10,13,'2) loadhigh=',10,13,'3) Dos=UMB',10,13,'4) devicehigh=',10,13,'$'
	QUESTION_13	DB	'Question13: To find out how much memory is available, you could type:',10,13,'$'
	ANSWERS_13	DB	'1) MEM',10,13,'2) EMM',10,13,'3) CHKDSK',10,13,'4) MEMMAKER',10,13,'$'
	QUESTION_14	DB	'Question14: During the normal PC boot process, which of the following is active first?',10,13,'$'
	ANSWERS_14	DB	'1) RAM BIOS',10,13,'2) CMOS',10,13,'3) ROM BIOS',10,13,'4) Floppy Drive Boot Sector',10,13,'$'
	QUESTION_15	DB	'Question15: Which of the following is loaded for CD-ROM support?',10,13,'$'
	ANSWERS_15	DB	'1) MSCDEX.EXE',10,13,'2) CDROM.EXE',10,13,'3) CDDEX.EXE',10,13,'4) DOSLDCd.EXE',10,13,'$'
	QUESTION_16	DB	'Question16: After searching the current directory where does Command.Com search next?',10,13,'$'
	ANSWERS_16	DB	'1) Path Statement',10,13,'2) C:\DOS\PATH',10,13,'3) Config.sys',10,13,'4) Autoexec.bat',10,13,'$'
	QUESTION_17	DB	'Question17: What is the order in which Command.Com searches for programs to execute?',10,13,'$'
	ANSWERS_17	DB	'1) EXE, COM, BAT',10,13,'2) EXE, BAT, COM',10,13,'3) COM, EXE, BAT',10,13,'4) BAT, COM. EXE',10,13,'$'
	QUESTION_18	DB	'Question18: A permanent swap file has what file extension?',10,13,'$'
	ANSWERS_18	DB	'1) SWP',10,13,'2) SWAP',10,13,'3) EXT',10,13,'4) PAR',10,13,'$'
	QUESTION_19	DB	'Question19: What switch would you use to view Smartdrive statistics?',10,13,'$'
	ANSWERS_19	DB	'1) /v',10,13,'2) /t',10,13,'3) /s',10,13,'4) /c:st',10,13,'$'
	QUESTION_20	DB	'Question20: Which Windows file contains hardware information?',10,13,'$'
	ANSWERS_20	DB	'1) WIN.INI',10,13,'2) SYS.INI',10,13,'3) CONTROL.INI',10,13,'4) SYSTEM.INI',10,13,'$'
	QUESTION_21	DB	'Question1: How many legs does a dog have?',10,13,'$'
	ANSWERS_21	DB	'1) 5',10,13,'2) 2.5',10,13,'3) 2',10,13,'4) 4',10,13,'$'
	QUESTION_22	DB	'Question2: Which of these can you put in a a microwave?',10,13,'$'
	ANSWERS_22	DB	'1) Dog',10,13,'2) Egg',10,13,'3) Pierced Potato',10,13,'4) Metal Knife',10,13,'$'
	QUESTION_23	DB	'Question3: What is the outer layer of an egg called?',10,13,'$'
	ANSWERS_23	DB	'1) Shell',10,13,'2) Coat',10,13,'3) Skin',10,13,'4) Feces',10,13,'$'
	QUESTION_24	DB	'Question4: Which one of these is not waste material?',10,13,'$'
	ANSWERS_24	DB	'1) Phantasy Star',10,13,'2) Eastenders',10,13,'3) Excrement',10,13,'4) Chelsea',10,13,'$'
	QUESTION_25	DB	'Question5: Where is Eastenders set?',10,13,'$'
	ANSWERS_25	DB	'1) Wales',10,13,'2) East London',10,13,'3) Tokyo',10,13,'4) Australia',10,13,'$'
	QUESTION_26	DB	'Question6: What is the capital of Wales?',10,13,'$'
	ANSWERS_26	DB	'1) W',10,13,'2) London',10,13,'3) Cardiff',10,13,'4) Fork',10,13,'$'
	QUESTION_27	DB	'Question7: Which of the following should you eat with a fork:',10,13,'$'
	ANSWERS_27	DB	'1) Bread',10,13,'2) Boiled Egg',10,13,'3) Soup',10,13,'4) Suasage',10,13,'$'
	QUESTION_28	DB	'Question8: Which of these shouldn''t be put in a sandwich:',10,13,'$'
	ANSWERS_28	DB	'1) Peanut Butter',10,13,'2) Cement',10,13,'3) Jam',10,13,'4) Marmite',10,13,'$'
	QUESTION_29	DB	'Question9: How many questions have you answered?',10,13,'$'
	ANSWERS_29	DB	'1) 8',10,13,'2) 6',10,13,'3) 7',10,13,'4) 9',10,13,'$'
	QUESTION_30	DB	'Question10: How many questions have you not answered?',10,13,'$'
	ANSWERS_30	DB	'1) 20',10,13,'2) 13',10,13,'3) 11',10,13,'4) 3',10,13,'$'
	QUESTION_31	DB	'Question11: Which of these is a question mark:',10,13,'$'
	ANSWERS_31	DB	'1) &',10,13,'2) ?',10,13,'3) !',10,13,'4) :',10,13,'$'
	QUESTION_32	DB	'Question12: What is 1+1?',10,13,'$'
	ANSWERS_32	DB	'1) -2',10,13,'2) 3',10,13,'3) 11',10,13,'4) 2',10,13,'$'
	QUESTION_33	DB	'Question13: What was the answer to question 1?',10,13,'$'
	ANSWERS_33	DB	'1) 7',10,13,'2) 3',10,13,'3) 4',10,13,'4) 1',10,13,'$'
	QUESTION_34	DB	'Question14: How many wheels does a bike have?',10,13,'$'
	ANSWERS_34	DB	'1) 38',10,13,'2) 2',10,13,'3) 7',10,13,'4) 1',10,13,'$'
	QUESTION_35	DB	'Question15: What does babi mean in Malaysian?',10,13,'$'
	ANSWERS_35	DB	'1) Towel',10,13,'2) Baby',10,13,'3) Mother',10,13,'4) Pig',10,13,'$'
	QUESTION_36	DB	'Question16: What does je mean in French?',10,13,'$'
	ANSWERS_36	DB	'1) I',10,13,'2) am',10,13,'3) an',10,13,'4) elephant',10,13,'$'
	QUESTION_37	DB	'Question17: What language is this word from, "nussima":',10,13,'$'
	ANSWERS_37	DB	'1) Welsh',10,13,'2) Indian',10,13,'3) Estonian',10,13,'4) Spanish',10,13,'$'
	QUESTION_38	DB	'Question18: What has 40 balls and makes women sweat?',10,13,'$'
	ANSWERS_38	DB	'1) National lottery',10,13,'2) Bingo',10,13,'3) Tony Blair',10,13,'4) Winter',10,13,'$'
	QUESTION_39	DB	'Question19: What is the answer of this question?',10,13,'$'
	ANSWERS_39	DB	'1) 1',10,13,'2) 4',10,13,'3) 2',10,13,'4) 3',10,13,'$'
	QUESTION_40	DB	'Question20: How many shillings are in a pound?',10,13,'$'
	ANSWERS_40	DB	'1) 9',10,13,'2) 6',10,13,'3) 3',10,13,'4) 20',10,13,'$'
	INCORRECT 	DB	'You got it wrong!',10,13,'$'	;Wrong answer
	CORRECT 	DB 	'That is right! How did you know!?',10,13,'$'	;Right answer
	BAD_INPUT 	DB 	'Invalid input, please enter a number from 1 to 4.',10,13,'$'	;Bad key
	YOUR_SCORE_F	DB	'You got $'	;Template for score
	YOUR_SCORE_B	DB	' out of 20 which is $'
	YOUR_SCORE_P	DB	'%!',10,13,'$'
	PASSED		DB	'You passed!',10,13,'$'
	FAILED		DB	'You failed!',10,13,'$'
.CODE	;Code section
START:	;Start main code (code ran on program start)
	MOV 	DX,OFFSET SPLASH_1	;Show the starting screen
	MOV 	AH,9
	INT 	21h
	MOV 	DX,OFFSET SPLASH_2	;Move position of SPLASH_1 to DX
	MOV 	AH,9	;Set command as print string
	INT 	21h	;Call interupt
	MOV 	DX,OFFSET SPLASH_3
	MOV 	AH,9
	INT 	21h
	MOV 	DX,OFFSET SPLASH_4
	MOV 	AH,9
	INT 	21h
	MOV 	DX,OFFSET SPLASH_5
	MOV 	AH,9
	INT 	21h
	MOV	AH,01	;Get a key, choose general or a plus
	INT	21H
	CALL	NEW_LINE
	CMP	AL,'1'	;Comapre key to 1
	JNE	GENKNOW
	MOV 	POS_Q,OFFSET QUESTION_1	;Set question 1
	MOV 	POS_A,OFFSET ANSWERS_1	;Set answers 1
	CALL	ANSWER_3	;Get input answer is 3
	MOV 	POS_Q,OFFSET QUESTION_2
	MOV 	POS_A,OFFSET ANSWERS_2
	CALL	ANSWER_1	;Get input answer is 1
	MOV 	POS_Q,OFFSET QUESTION_3
	MOV 	POS_A,OFFSET ANSWERS_3
	CALL	ANSWER_2	;Get input answer is 2
	MOV 	POS_Q,OFFSET QUESTION_4
	MOV 	POS_A,OFFSET ANSWERS_4
	CALL	ANSWER_4	;Get input answer is 4
	MOV 	POS_Q,OFFSET QUESTION_5
	MOV 	POS_A,OFFSET ANSWERS_5
	CALL	ANSWER_2
	MOV 	POS_Q,OFFSET QUESTION_6
	MOV 	POS_A,OFFSET ANSWERS_6
	CALL	ANSWER_4
	MOV 	POS_Q,OFFSET QUESTION_7
	MOV 	POS_A,OFFSET ANSWERS_7
	CALL	ANSWER_1
	MOV 	POS_Q,OFFSET QUESTION_8
	MOV 	POS_A,OFFSET ANSWERS_8
	CALL	ANSWER_3
	MOV 	POS_Q,OFFSET QUESTION_9
	MOV 	POS_A,OFFSET ANSWERS_9
	CALL	ANSWER_2
	MOV 	POS_Q,OFFSET QUESTION_10
	MOV 	POS_A,OFFSET ANSWERS_10
	CALL	ANSWER_4
	MOV 	POS_Q,OFFSET QUESTION_11
	MOV 	POS_A,OFFSET ANSWERS_11
	CALL	ANSWER_4
	MOV 	POS_Q,OFFSET QUESTION_12
	MOV 	POS_A,OFFSET ANSWERS_12
	CALL	ANSWER_3
	MOV 	POS_Q,OFFSET QUESTION_13
	MOV 	POS_A,OFFSET ANSWERS_13
	CALL	ANSWER_1
	MOV 	POS_Q,OFFSET QUESTION_14
	MOV 	POS_A,OFFSET ANSWERS_14
	CALL	ANSWER_3
	MOV 	POS_Q,OFFSET QUESTION_15
	MOV 	POS_A,OFFSET ANSWERS_15
	CALL	ANSWER_1
	MOV 	POS_Q,OFFSET QUESTION_16
	MOV 	POS_A,OFFSET ANSWERS_16
	CALL	ANSWER_1
	MOV 	POS_Q,OFFSET QUESTION_17
	MOV 	POS_A,OFFSET ANSWERS_17
	CALL	ANSWER_3
	MOV 	POS_Q,OFFSET QUESTION_18
	MOV 	POS_A,OFFSET ANSWERS_18
	CALL	ANSWER_4
	MOV 	POS_Q,OFFSET QUESTION_19
	MOV 	POS_A,OFFSET ANSWERS_19
	CALL	ANSWER_3
	MOV 	POS_Q,OFFSET QUESTION_20
	MOV 	POS_A,OFFSET ANSWERS_20
	CALL	ANSWER_4
	JMP	QUESTIONS_FIN
GENKNOW:
	MOV 	POS_Q,OFFSET QUESTION_21
	MOV 	POS_A,OFFSET ANSWERS_21
	CALL	ANSWER_4
	MOV 	POS_Q,OFFSET QUESTION_22
	MOV 	POS_A,OFFSET ANSWERS_22
	CALL	ANSWER_3
	MOV 	POS_Q,OFFSET QUESTION_23
	MOV 	POS_A,OFFSET ANSWERS_23
	CALL	ANSWER_1
	MOV 	POS_Q,OFFSET QUESTION_24
	MOV 	POS_A,OFFSET ANSWERS_24
	CALL	ANSWER_1
	MOV 	POS_Q,OFFSET QUESTION_25
	MOV 	POS_A,OFFSET ANSWERS_25
	CALL	ANSWER_2
	MOV 	POS_Q,OFFSET QUESTION_26
	MOV 	POS_A,OFFSET ANSWERS_26
	CALL	ANSWER_3
	MOV 	POS_Q,OFFSET QUESTION_27
	MOV 	POS_A,OFFSET ANSWERS_27
	CALL	ANSWER_4
	MOV 	POS_Q,OFFSET QUESTION_28
	MOV 	POS_A,OFFSET ANSWERS_28
	CALL	ANSWER_2
	MOV 	POS_Q,OFFSET QUESTION_29
	MOV 	POS_A,OFFSET ANSWERS_29
	CALL	ANSWER_1
	MOV 	POS_Q,OFFSET QUESTION_30
	MOV 	POS_A,OFFSET ANSWERS_30
	CALL	ANSWER_3
	MOV 	POS_Q,OFFSET QUESTION_31
	MOV 	POS_A,OFFSET ANSWERS_31
	CALL	ANSWER_2
	MOV 	POS_Q,OFFSET QUESTION_32
	MOV 	POS_A,OFFSET ANSWERS_32
	CALL	ANSWER_4
	MOV 	POS_Q,OFFSET QUESTION_33
	MOV 	POS_A,OFFSET ANSWERS_33
	CALL	ANSWER_3
	MOV 	POS_Q,OFFSET QUESTION_34
	MOV 	POS_A,OFFSET ANSWERS_34
	CALL	ANSWER_2
	MOV 	POS_Q,OFFSET QUESTION_35
	MOV 	POS_A,OFFSET ANSWERS_35
	CALL	ANSWER_4
	MOV 	POS_Q,OFFSET QUESTION_36
	MOV 	POS_A,OFFSET ANSWERS_36
	CALL	ANSWER_1
	MOV 	POS_Q,OFFSET QUESTION_37
	MOV 	POS_A,OFFSET ANSWERS_37
	CALL	ANSWER_3
	MOV 	POS_Q,OFFSET QUESTION_38
	MOV 	POS_A,OFFSET ANSWERS_38
	CALL	ANSWER_2
	MOV 	POS_Q,OFFSET QUESTION_39
	MOV 	POS_A,OFFSET ANSWERS_39
	CALL	ANSWER_1
	MOV 	POS_Q,OFFSET QUESTION_40
	MOV 	POS_A,OFFSET ANSWERS_40
	CALL	ANSWER_4
QUESTIONS_FIN:
	MOV 	DX,OFFSET YOUR_SCORE_F	;Template for score
	MOV 	AH,9
	INT 	21h
	MOV	DL,SCORE_10	;Print 10s
	ADD	DL,48
	MOV	AH,2
	INT	21h
	MOV	DL,SCORE_1	;Print 1s
	ADD	DL,48
	MOV	AH,2
	INT	21h
	MOV 	DX,OFFSET YOUR_SCORE_B
	MOV 	AH,9
	INT 	21h
	MOV	AH,SCORE_0	;Set AH as the score, counter
	PUSH	AX	;Save score
	MOV	SCORE_1,0	;Reset 1s
	MOV	SCORE_10,0	;Reset 10s
	MOV	SCORE_100,0	;Reset 100s
	CMP	AH,0	;Compare AH to 0
	JE	PERCENT_LOOP_FIN	;Skip loop if equal
PERCENT_LOOP:	;Loop start section
	CALL	SCORE_PLUS_ONE	;Find percent (100/20=5) each right is worth 5%
	CALL	SCORE_PLUS_ONE	;Increase percent, usinf score vars and code
	CALL	SCORE_PLUS_ONE	;to optimise
	CALL	SCORE_PLUS_ONE
	CALL	SCORE_PLUS_ONE
	DEC	AH	;Decrease counter
	CMP	AH,0	;Comape AH to 0
	JNE	PERCENT_LOOP	;End if equal
PERCENT_LOOP_FIN:	;End of loop section
	MOV	DL,SCORE_100	;Print percent same way as score
	ADD	DL,48
	MOV	AH,2
	INT	21h
	MOV	DL,SCORE_10
	ADD	DL,48
	MOV	AH,2
	INT	21h
	MOV	DL,SCORE_1
	ADD	DL,48
	MOV	AH,2
	INT	21h
	MOV 	DX,OFFSET YOUR_SCORE_P	;Final part of template
	MOV 	AH,9
	INT 	21h
	POP	AX	;Restore score
	CMP	AH,15	;Compare to pass mark plus one
	JB	FAILE	;If below then skip to FAILE
	MOV 	DX,OFFSET PASSED	;Else say they passed
	MOV 	AH,9
	INT 	21h
	JMP	PASFAI_FIN	;Skip failed code
FAILE:
	MOV 	DX,OFFSET FAILED	;Say they failed
	MOV 	AH,9
	INT 	21h
PASFAI_FIN:
	MOV	AH,4Ch
	INT	21h
END START	;End main code section

SCORE_PLUS_ONE PROC	;Increase the score variables
	PUSH 	AX	;Save AX
	CMP	SCORE_1,9	;Compare 1s to 9
	JE	SCORE_PLUS_10	;Go to SCORE_PLUS_10 is equal
	MOV	AH,SCORE_1	;Add to position 1
	ADD 	AH,1
	MOV 	SCORE_1,AH
	JMP	SCORE_PLUS_FIN	;Jump to end
SCORE_PLUS_10:
	CMP	SCORE_10,9	;Compare 10s to 9
	JE	SCORE_PLUS_100	;Goto here if equal
	MOV 	AH,SCORE_10	;Add a ten, reset ones
	MOV	SCORE_1,0
	ADD	AH,1
	MOV	SCORE_10,AH
	JMP	SCORE_PLUS_FIN
SCORE_PLUS_100:
	MOV 	AH,SCORE_100	;Reset 10s and 1s add 100
	MOV	SCORE_1,0
	MOV	SCORE_10,0
	ADD	AH,1
	MOV	SCORE_100,AH
SCORE_PLUS_FIN:	;End section
	MOV 	AH,SCORE_0	;Increase normal score variable (not for printing)
	ADD	AH,1
	MOV	SCORE_0,AH
	POP 	AX
	RET
SCORE_PLUS_ONE ENDP	;End procedure
NEW_LINE PROC	;Go down one line, CRLF
	PUSH	DX
	PUSH	AX
	MOV	DL,0Ah
	MOV	AH,2
	INT	21h
	MOV	DL,0Dh
	MOV	AH,2
	INT	21h
	POP	AX
	POP	DX
	RET
NEW_LINE ENDP
ANSWER_1 PROC	;Key input for if right answer is 1
	MOV	DX,POS_Q	;Print question
	MOV 	AH,9
	INT 	21h
	MOV	DX,POS_A
	MOV 	AH,9
	INT 	21h
	MOV	AH,01	;Get a key
	INT	21H
	CMP	AL,'1'	;Comapre key to 1
	JE	CORRECT_ANSWER	;If equal jump to correct answer section
	CMP	AL,'2'
	JE	INCORRECT_ANSWER	;If equal jump to incorrect answer section
	CMP	AL,'3'
	JE	INCORRECT_ANSWER
	CMP	AL,'4'
	JE 	INCORRECT_ANSWER
	CALL	NEW_LINE
	MOV	DX,OFFSET BAD_INPUT	;Not matchs, wrong key print incorrect key pressed
	MOV	AH,9
	INT	21h
	CALL	ANSWER_1	;Get the key again
	RET	;Exit procedure
CORRECT_ANSWER:	;Correct answer section
	CALL	SCORE_PLUS_ONE	;Increase score
	CALL	NEW_LINE	;CrLf
	MOV	DX,OFFSET CORRECT	;Print result
	MOV	AH,9
	INT	21h
	RET
INCORRECT_ANSWER:	;Wrong question
	CALL	NEW_LINE
	MOV	DX,OFFSET INCORRECT	;Print result
	MOV	AH,9
	INT	21h
	RET
ANSWER_1 ENDP
ANSWER_2 PROC
	MOV	DX,POS_Q
	MOV 	AH,9
	INT 	21h
	MOV	DX,POS_A
	MOV 	AH,9
	INT 	21h
	MOV	AH,01
	INT	21H
	CMP	AL,'2'
	JE	CORRECT_ANSWER
	CMP	AL,'1'
	JE	INCORRECT_ANSWER
	CMP	AL,'3'
	JE	INCORRECT_ANSWER
	CMP	AL,'4'
	JE 	INCORRECT_ANSWER
	CALL	NEW_LINE
	MOV	DX,OFFSET BAD_INPUT
	MOV	AH,9
	INT	21h
	CALL	ANSWER_2
	RET
CORRECT_ANSWER:
	CALL	SCORE_PLUS_ONE
	CALL	NEW_LINE
	MOV	DX,OFFSET CORRECT
	MOV	AH,9
	INT	21h
	RET
INCORRECT_ANSWER:
	CALL	NEW_LINE
	MOV	DX,OFFSET INCORRECT
	MOV	AH,9
	INT	21h
	RET
ANSWER_2 ENDP
ANSWER_3 PROC
	MOV	DX,POS_Q
	MOV 	AH,9
	INT 	21h
	MOV	DX,POS_A
	MOV 	AH,9
	INT 	21h
	MOV	AH,01
	INT	21H
	CMP	AL,'3'
	JE	CORRECT_ANSWER
	CMP	AL,'2'
	JE	INCORRECT_ANSWER
	CMP	AL,'1'
	JE	INCORRECT_ANSWER
	CMP	AL,'4'
	JE 	INCORRECT_ANSWER
	CALL	NEW_LINE
	MOV	DX,OFFSET BAD_INPUT
	MOV	AH,9
	INT	21h
	CALL	ANSWER_3
	RET
CORRECT_ANSWER:
	CALL	SCORE_PLUS_ONE
	CALL	NEW_LINE
	MOV	DX,OFFSET CORRECT
	MOV	AH,9
	INT	21h
	RET
INCORRECT_ANSWER:
	CALL	NEW_LINE
	MOV	DX,OFFSET INCORRECT
	MOV	AH,9
	INT	21h
	RET
ANSWER_3 ENDP
ANSWER_4 PROC
	MOV	DX,POS_Q
	MOV 	AH,9
	INT 	21h
	MOV	DX,POS_A
	MOV 	AH,9
	INT 	21h
	MOV	AH,01
	INT	21H
	CMP	AL,'4'
	JE	CORRECT_ANSWER
	CMP	AL,'2'
	JE	INCORRECT_ANSWER
	CMP	AL,'3'
	JE	INCORRECT_ANSWER
	CMP	AL,'1'
	JE 	INCORRECT_ANSWER
	CALL	NEW_LINE
	MOV	DX,OFFSET BAD_INPUT
	MOV	AH,9
	INT	21h
	CALL	ANSWER_4
	RET
CORRECT_ANSWER:
	CALL	SCORE_PLUS_ONE
	CALL	NEW_LINE
	MOV	DX,OFFSET CORRECT
	MOV	AH,9
	INT	21h
	RET
INCORRECT_ANSWER:
	CALL	NEW_LINE
	MOV	DX,OFFSET INCORRECT
	MOV	AH,9
	INT	21h
	RET
ANSWER_4 ENDP
END	;End everything

Probbly the most inefficient program ever. Primarily because I had no idea how to implement an array.


Why did I use whitespace so rarely? Working on a dos sized screen, something like 70 by 40 characters. Clever people know that the biggest area of consciously accessibly short term memory is the eyes. So with the tiny screen I wanted to see as much as possible. Now I use huge screen my code layout is immaculate and highly consistant. I even turn on show tabs/spaces and make sure I don't randomly mix one with the other.