# Pascal program Help!!!!!!

January 30, 2010 at 08:33:34
Specs: Windows XP
 HiI'm doing my A Level Computing. We are doing a program on a battleship game.This is the program code below..program battleshipgame2;{\$APPTYPE CONSOLE}uses SysUtils;VarBattleship:Array[0..9,0..9] of Char;R,C:Integer;row,col:Integer; AllTargets---:Boolean;begin for R:=0 to 9 do begin for C:=0 to 9 do Battleship [R,C]:= 'M'; end; Battleship [2,2]:='S'; Battleship [5,5]:='S'; Battleship [7,7]:='S';repeat for R:=0 to 9 do begin for C:=0 to 9 do if (Battleship [R,C]= 'U') then Writeln (Battleship[row,col]); end; Writeln ('Please enter a row number'); Readln (row); Writeln ('Please enter a column number'); Readln (col); if (Battleship [row,col])= 'S' then Writeln ('Target Hit') else begin; AllTargets---:=False; Writeln ('Miss, Try Again'); end; Battleship [row,col]:= 'U'; for R:=0 to 9 do begin for C:=0 to 9 do if Battleship [2,2]='U' Battleship [5,5]='U' Battleship [7,7]='U'; Battleship [R,C]='U' then begin; AllTargets---:=True; Writeln ('All Battleships Sunk.. Game Over..Congratulations.. You Win'); end; end; until AllTargets---=True;Readlnend.I want help in the how the program ends. The program ends when all the battleships are sunk or when all the elements in the array have been used. Can you also please check if the whole program works. I also want the program to show the coordinates already used by the person before they enter the next numbers so that they dont enter the same numbers. Can u please help????? I am trying to this for weeks now. Can u please do it in a simple way as it is A-Level work.Thanks.

See More: Pascal program Help!!!!!!

#1
January 30, 2010 at 09:06:12
 Wrong forum. Try posting in Programming.

Report •
Related Solutions