Add to Favorites    Make Home Page 4008 Online  
 Language Categories  
 Our Services  

Home » ASP Home » Array Home » simple hangman-pascalsource

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title simple hangman-pascalsource
Author Seabert
Author Email jjtaks [at] cs.ruu.nl
Description
Category ASP » Array
Hits 377779
Code Select and Copy the Code
Code : Program Hanger; {a simple hangman-pascalsource by Seabert SoftWare, 1996} {comments & suggestions : jjtaks@cs.ruu.nl} Uses Crt, WinDos; Var Words: Array[1..100] of String; Sizes: Array[1..100] of Integer; PlayWord, ChLine, word: String[10]; Ch: Char; WordFile: Text; i, j, lgt, Max, ChLgt: Integer; Function ReadFile( FileName: String): Boolean; begin if ( FileName = '') then ReadFile := False else begin ReadFile := True; i := 0; Assign( WordFile, FileName) Reset( WordFile); While( not( EoF( WordFile))) do begin Inc( i); ReadLn( WordFile, word); Words[i] := word; ReadLn( WordFile, lgt); Sizes[i] := lgt; end; Max := i; Close( WordFile); end; end; Function ChooseWord: Boolean; begin Repeat Randomize; j := Random( Max); Until (( j > 0) and ( j <= Max)); PlayWord := Words[j]; ChLgt := Sizes[j]; if ( PlayWord <> '') then ChooseWord := True else ChooseWord := False; end; Procedure InitArrays; begin for i := 1 to 100 do begin Words[i] := ''; Sizes[i] := 0; end; end; Procedure GamePlay; Procedure ClrWord; begin For i := 1 to 10 do PlayWord[i] := ''; end; Procedure SetChLine; begin For i := 1 to 10 do ChLine[i] := '-'; end; begin SetChLine; Repeat GoToXY( 15, 3); For i := 1 to Max do Write(ChLine[i]); GoToXY( 1, 3); Write('Enter a character: '); ReadLn( Ch) For i := 1 to Max do begin if ( Ch = PlayWord[i]) then ChLine[i] := Ch; end; if ( ChLine = PlayWord) then begin GoToXY( 15, 1); Write('You got it!'); end; Until ( ChLine = PlayWord); ClrScr; ClrWord; SetChLine; end; Begin ClrScr; Repeat InitArrays; if ( ReadFile( 'WORDS.TXT') = True) then begin if ( ChooseWord = True) then GamePlay else begin WriteLn('No words found.'); Halt(1); end; end else begin WriteLn('Unable to read file WORDS.TXT.'); Halt(1); end; Write(' Again? '); ReadLn( Ch); Until ( UpCase( Ch) = 'N'); End. { WORDS.TXT ( example): ape 3 book 4 circle 6 } ------ SeaBert ------------- | E-Mail: jjtaks@cs.ruu.nl | ------ C-Bert --------------

Related Source Codes

Script Name Author
ııııııııııııııııııııı VyomWorld
Resistor color code reader A.Chermarajan.
Telephone Directory dhivya
card swapping game (Mini Project) nityanand
college dirtectory (Mini Project) msridhar
Poll Application John van Meter
ASP Daily Hit Counter. Tejaskumar Gandhi
To avoid null in asp environment using sql Sami
Maklumbalas webmaster
poll John van Meter
EasyASP Template Engine. TjoekBezoer
Basic Calculator using HTML & Javascript. Patrick M. D Souza
What servers support ASP ? VyomWorld
What is ASP? VyomWorld
European Weeknumber menno

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptId=911


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review