<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pascal Programming</title>
	<atom:link href="http://www.pascalprogramming.info/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pascalprogramming.info</link>
	<description>learn pascal programming for free</description>
	<lastBuildDate>Sat, 08 Aug 2009 12:38:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>If Statement Exercises</title>
		<link>http://www.pascalprogramming.info/if-statement-exercises/</link>
		<comments>http://www.pascalprogramming.info/if-statement-exercises/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 12:38:18 +0000</pubDate>
		<dc:creator>adminpascal</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.pascalprogramming.info/?p=226</guid>
		<description><![CDATA[1.    Ask for the user’s age to be typed in at the keyboard, then display a message that states whether or not the user is old enough to drive 2.    Ask for two numbers to be typed in at the keyboard, then display the larger of the two numbers 3.    Ask for a number to [...]]]></description>
			<content:encoded><![CDATA[<p>1.    Ask for the user’s age to be typed in at the keyboard, then display a message that states whether or not the user is old enough to drive</p>
<p>2.    Ask for two numbers to be typed in at the keyboard, then display the larger of the two numbers</p>
<p>3.    Ask for a number to be typed in at the keyboard, then display a message to say whether or not the number is within the range 0 to 100</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pascalprogramming.info/if-statement-exercises/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Function Excercises</title>
		<link>http://www.pascalprogramming.info/function-excercises/</link>
		<comments>http://www.pascalprogramming.info/function-excercises/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 12:31:50 +0000</pubDate>
		<dc:creator>adminpascal</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.pascalprogramming.info/?p=223</guid>
		<description><![CDATA[There are several other types of functions: Number functions – work out what each of these do •    INT •    TRUNC •    FRAC •    ROUND Arithmetic Functions – work out what each of these do •    SQR •    SQRT •    ABS]]></description>
			<content:encoded><![CDATA[<p>There are several other types of functions:</p>
<p>Number functions – work out what each of these do<br />
•    INT<br />
•    TRUNC<br />
•    FRAC<br />
•    ROUND</p>
<p>Arithmetic Functions – work out what each of these do<br />
•    SQR<br />
•    SQRT<br />
•    ABS</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pascalprogramming.info/function-excercises/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loop Exercises</title>
		<link>http://www.pascalprogramming.info/loop-exercises/</link>
		<comments>http://www.pascalprogramming.info/loop-exercises/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 15:59:11 +0000</pubDate>
		<dc:creator>adminpascal</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.pascalprogramming.info/?p=219</guid>
		<description><![CDATA[For Loops Display the message “Hello World!” 25 times Change the program so that the user can decide how many times to display “Hello World” on the screen. Display the number of the repetition on the screen as well (eg. 1. Hello World!, 2. Hello World!, etc.) Ask the user which times table they wish [...]]]></description>
			<content:encoded><![CDATA[<p><strong>For Loops</strong></p>
<ol>
<li>Display the message “Hello World!” 25 times</li>
<li>Change the program so that the user can decide how many times to display “Hello World” on the screen.</li>
<li>Display the number of the repetition on the screen as well (eg. 1. Hello World!, 2. Hello World!, etc.)</li>
<li>Ask the user which times table they wish to see, then display it in the following format:<br />
1 * 7 = 7<br />
2 * 7 = 14<br />
.<br />
.<br />
12 * 7 = 84</li>
<li>Ask the user how many stars they want to see in one row. Display the row of stars</li>
<li>Expand your solution and ask the user how many rows of stars they want to see. Display the rectangle of stars as specified by the user. Hint – you will need to nest one For loop inside another!</li>
</ol>
<p><strong>While Loops</strong></p>
<ol>
<li> Ask the user to enter a whole number greater than 99. If the user enters a number less than 100, display an error message and ask them again. Repeat this process until the user enters a valid number.</li>
<li>Expand your solution to only accept numbers between 100 and 200</li>
</ol>
<p><strong>Repeat Loops</strong></p>
<ol>
<li>Add up a series of whole numbers entered by the user, until the user enters zero.</li>
<li>Expand your solution to display the average value of the numbers entered. Hint: do not count the final zero as a value to be averaged.<strong><br />
</strong></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.pascalprogramming.info/loop-exercises/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First Program</title>
		<link>http://www.pascalprogramming.info/first-program/</link>
		<comments>http://www.pascalprogramming.info/first-program/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 13:23:05 +0000</pubDate>
		<dc:creator>adminpascal</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Add new tag]]></category>

		<guid isPermaLink="false">http://www.pascalprogramming.info/?p=208</guid>
		<description><![CDATA[This lesson outlines the basics of creating your first program and is intended for those of you who are new to programming and pascal all together. The majority of programs that you make in pascal will always follow the below format, it is first typed into the compiler when making your program: program ProgramName; {$APPTYPE [...]]]></description>
			<content:encoded><![CDATA[<p>This lesson outlines the basics of creating your first program and is intended for those of you who are new to programming and pascal all together.</p>
<p>The majority of programs that you make in pascal will <strong>always</strong> follow the below format, it is first typed into the compiler when making your program:</p>
<pre class="brush: pascal;">
program ProgramName;

{$APPTYPE CONSOLE}

uses SysUtils;

begin

end.</pre>
<p>You would write a meaningful program named where I wrote &#8220;ProgramName&#8221; as to tell the person who is reading your source code, what the program does. Then perhaps a <a href="http://www.pascalprogramming.info/comments/">comment</a> afterwards to describe what purpose your program serves. </p>
<p>Between &#8220;begin&#8221; and &#8220;end.&#8221; is where you write the main part of your program. Below is an example of a simple program which would display &#8220;Hello World&#8221; on the screen. </p>
<pre class="brush: pascal;">
program HelloWorld;
{a program which displays "hello world" on the screen }

{$APPTYPE CONSOLE}

uses SysUtils;

begin
             {the code that displays Hello World! on the screen}
             writeln('Hello World');
end.
</pre>
<p>Try it out in your compiler to see how it works. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pascalprogramming.info/first-program/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Guide</title>
		<link>http://www.pascalprogramming.info/guide/</link>
		<comments>http://www.pascalprogramming.info/guide/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 10:33:02 +0000</pubDate>
		<dc:creator>adminpascal</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.pascalprogramming.info/?p=209</guid>
		<description><![CDATA[Below is a guide to the site, a way to go through all the material. This is your Pascal programming course. First Program Effective Use of Comments Variables Declaration Input &#38; Output Assignment Operators - to be edited -]]></description>
			<content:encoded><![CDATA[<p>Below is a guide to the site, a way to go through all the material. This is your Pascal programming course.</p>
<ol>
<li><a href="http://www.pascalprogramming.info/first-program/">First Program</a></li>
<li><a href="http://www.pascalprogramming.info/comments/">Effective Use of Comments</a></li>
<li><a href="http://www.pascalprogramming.info/variables/">Variables</a></li>
<li><a href="http://www.pascalprogramming.info/declaration/">Declaration</a></li>
<li><a href="http://www.pascalprogramming.info/input-and-output/">Input &amp; Output</a></li>
<li><a href="http://www.pascalprogramming.info/assignment/">Assignment</a></li>
<li><a href="http://www.pascalprogramming.info/operators/">Operators</a></li>
</ol>
<p>- to be edited -</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pascalprogramming.info/guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>String Manipulation</title>
		<link>http://www.pascalprogramming.info/string-manipulation/</link>
		<comments>http://www.pascalprogramming.info/string-manipulation/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 17:25:53 +0000</pubDate>
		<dc:creator>adminpascal</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.pascalprogramming.info/?p=182</guid>
		<description><![CDATA[program stringss; uses wincrt; var s : string; l,p : integer; s1,s2,s3 : string; begin s := 'This is a string'; writeln( s ); writeln; l := length(s); {Find length of a string} writeln('String length: ', l); {16} p := pos('This',s); {find position of text in a string} writeln('Position of ''This'': ', p); {1} writeln; [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: pascal;">
program stringss;

uses
    wincrt;
var
   s          : string;

   l,p        : integer;
   s1,s2,s3   : string; 

begin

  s := 'This is a string';
  writeln( s );
  writeln; 

  l := length(s); {Find length of a string}
  writeln('String length: ', l); {16}

  p := pos('This',s); {find position of text in a string}
  writeln('Position of ''This'': ', p); {1}
  writeln; 

  (***** "Join" together strings to create one big string *****)
  s1 := 'This';
   s2 := ' is a ';
    s3 := 'string.';
     writeln( concat(s1,s2,s3) ); {This is a string.}

end.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.pascalprogramming.info/string-manipulation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centigrade to Fahrenheit</title>
		<link>http://www.pascalprogramming.info/centigrade-to-fahrenheit/</link>
		<comments>http://www.pascalprogramming.info/centigrade-to-fahrenheit/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 16:56:52 +0000</pubDate>
		<dc:creator>adminpascal</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.pascalprogramming.info/?p=179</guid>
		<description><![CDATA[{----------------------------------- Program: Cent2Fahr Author: http://www.pascalprogramming.info Version: 1.4 Last Modified: 23/09/08 -----------------------------------} program cent2fahr; {program to convert centigrade to fahrenheit} uses wincrt; const space = ' '; head = '##################'; var temp :real; enter :string; begin {start cent2fahr} {start screen } gotoxy(30,0); writeln( head ); gotoxy(32,2); writeln( '.:Cent2Fahr:.' ); gotoxy(33,3); writeln( 'Version 1.0' ); gotoxy(32,4); writeln( [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: pascal;">
{-----------------------------------
Program: Cent2Fahr
Author:  http://www.pascalprogramming.info
Version: 1.4
Last Modified: 23/09/08
-----------------------------------}

program cent2fahr; {program to convert centigrade to fahrenheit}

uses wincrt;

const

     space = '  ';
     head  = '##################'; 

var
   temp  :real;
   enter :string;

begin {start cent2fahr}

      {start screen }
     gotoxy(30,0);
      writeln( head );
     gotoxy(32,2);
      writeln( '.:Cent2Fahr:.' );
     gotoxy(33,3);
      writeln( 'Version 1.0' );
     gotoxy(32,4);
      writeln( 'By http://www.pascalprogramming.info' );
     gotoxy(30,5);
      writeln( head );
     gotoxy(29,7);
      write( 'Press enter to start' );
      readln( enter );
      {end start screen}

     clrscr;

      {main program}
     writeln( '' );
     write( 'Please enter today''s temperature in centigrade',space );
     read( temp );
     if temp < -273 then
        begin
             write( 'This temprature does not exist!' );
        end
     else
        begin
             write( 'Today''s temperature in Fahrenheit is:',space );
             temp := ((temp/5)*9)+32;
             writeln( temp:5:2 );
             writeln( 'Thanks for using Cent2Fahr' );
        end;
      {end main program }

end. {end cent2fahr}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.pascalprogramming.info/centigrade-to-fahrenheit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Who Wants To Be A Millionaire</title>
		<link>http://www.pascalprogramming.info/who-wants-to-be-a-millionaire/</link>
		<comments>http://www.pascalprogramming.info/who-wants-to-be-a-millionaire/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 15:54:20 +0000</pubDate>
		<dc:creator>adminpascal</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.pascalprogramming.info/?p=175</guid>
		<description><![CDATA[{============================================== Program: who wants to be a millionaire Author: http://www.pascalprogramming.info Last Modified: 10/10/08 ==============================================} {----------------PROGRAM-----------------------} program millionaire; {-----------------USES-------------------------} uses WinCrt; {---------------CONSTANTS----------------------} const max = 15; {how many questions there are} arrow = '->'; {---------------VARIABLES----------------------} var {question data} question_amount : array[1..max] of longint; question : array[1..max] of string; question_answer : array[1..max] of char; question_a : array[1..max] [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: pascal;">
{==============================================

Program: who wants to be a millionaire
Author: http://www.pascalprogramming.info
Last Modified: 10/10/08

==============================================}

{----------------PROGRAM-----------------------}
program
       millionaire;
{-----------------USES-------------------------}

uses
    WinCrt;
{---------------CONSTANTS----------------------}
const
     max = 15; {how many questions there are}
     arrow = '->';
{---------------VARIABLES----------------------}
var
   {question data}
   question_amount      : array[1..max] of longint;
   question             : array[1..max] of string;
   question_answer      : array[1..max] of char;
   question_a           : array[1..max] of string;
   question_b           : array[1..max] of string;
   question_c           : array[1..max] of string;
   question_d           : array[1..max] of string;
   {life lines}
   phone,fifty,audience :string[3];
   {50/50}
   takea,takeb          :string[3];
   takec, taked         :string[3];
   {misc}
   user_answer, choice  : char;
   i,rand,rand2,rand3   : integer;
   lost                 : string[3];
   keya,keyb,keyc,keyd  : integer;
   store,n              : integer;
   mark                 : array[1..max] of string[5];

{------------VARIABLE DELCARATION--------------}
procedure variable;
          begin
               phone    := 'yes';
               fifty    := 'yes';
               audience := 'yes'; 

               lost     := 'no';
               i        := 0;
               n        := 0;

               takea    := 'no';
               takeb    := 'no';
               takec    := 'no';
               taked    := 'no';
          end;
{---------------QUESTION DATA------------------}
procedure question_data;
          begin
           {question one}
           question_amount[1] := 100;
           question[1]        := 'What is the capital of England? (£100)';
           question_answer[1] := 'b';
           question_a[1]      := 'England';
           question_b[1]      := 'London';
           question_c[1]      := 'Madrid';
           question_d[1]      := 'Paris';
           {question two}
           question_amount[2] := 200;
           question[2]        := 'Who won the first rugby world cup? (£200)';
           question_answer[2] := 'c';
           question_a[2]      := 'South Africa';
           question_b[2]      := 'Australia';
           question_c[2]      := 'New Zealand';
           question_d[2]      := 'England';
           {question three}
           question_amount[3] := 300;
           question[3]        := 'The River Foyle is found in which part of the UK? (£300)';
           question_answer[3] := 'a';
           question_a[3]      := 'Ireland';
           question_b[3]      := 'England';
           question_c[3]      := 'Scotland';
           question_d[3]      := 'Wales';
           {question four}
           question_amount[4] := 500;
           question[4]        := 'The chemical symbol for Silver is what? (£500)';
           question_answer[4] := 'a';
           question_a[4]      := 'Ag';
           question_b[4]      := 'Si';
           question_c[4]      := 'Zi';
           question_d[4]      := 'Ga';
           {question five}
           question_amount[5] := 1000;
           question[5]        := 'How many stomachs does a cow have? (£1000)';
           question_answer[5] := 'd';
           question_a[5]      := '1';
           question_b[5]      := '2';
           question_c[5]      := '3';
           question_d[5]      := '4';
           {question six}
           question_amount[6] := 2000;
           question[6]        := 'Gazpacho is from which country? (£2000)';
           question_answer[6] := 'c';
           question_a[6]      := 'Italy';
           question_b[6]      := 'Argentina';
           question_c[6]      := 'Spain';
           question_d[6]      := 'Maxico';
           {question seven}
           question_amount[7] := 4000;
           question[7]        := 'Which ocean goes to the deepest depths? (£4000)';
           question_answer[7] := 'a';
           question_a[7]      := 'Pacific';
           question_b[7]      := 'Atlantic';
           question_c[7]      := 'Arctic';
           question_d[7]      := 'Indian';
           {question eight}
           question_amount[8] := 8000;
           question[8]        := 'What year did the London Underground first open? (£8000)';
           question_answer[8] := 'd';
           question_a[8]      := '1860';
           question_b[8]      := '1862';
           question_c[8]      := '1901';
           question_d[8]      := '1863';
           {question nine}
           question_amount[9] := 16000;
           question[9]        := 'What is the currency in Chili? (£16,000)';
           question_answer[9] := 'd';
           question_a[9]      := 'Dollar';
           question_b[9]      := 'Real';
           question_c[9]      := 'Nuevo Sol';
           question_d[9]      := 'Peso';
           {question ten}
           question_amount[10] := 32000;
           question[10]        := 'A Ruby Aniversary is after how many years of being married? (£32,000)';
           question_answer[10] := 'b';
           question_a[10]      := '20';
           question_b[10]      := '40';
           question_c[10]      := '30';
           question_d[10]      := '50';
           {question eleven}
           question_amount[11] := 64000;
           question[11]        := 'What is the highest mountain in Africa? (£64,000)';
           question_answer[11] := 'b';
           question_a[11]      := 'Mount Kenya';
           question_b[11]      := 'Mount Kiimanjaro';
           question_c[11]      := 'Mawesi';
           question_d[11]      := 'Mount Luigi di Savoia';
           {question twelve}
           question_amount[12] := 125000;
           question[12]        := 'What is the worlds longest snake? (£125,000)';
           question_answer[12] := 'a';
           question_a[12]      := 'Python';
           question_b[12]      := 'Anaconda';
           question_c[12]      := 'Boa';
           question_d[12]      := 'Viper';
           {question thirteen}
           question_amount[13] := 250000;
           question[13]        := 'What was Shakespeares first performed play?? (£250,000)';
           question_answer[13] := 'd';
           question_a[13]      := 'Comedy of Errors';
           question_b[13]      := 'Richard III';
           question_c[13]      := 'Henry VI, part I';
           question_d[13]      := 'Henry VI, part II';
           {question fourteen}
           question_amount[14] := 500000;
           question[14]        := 'Who was the first prime mininster of England? (£500,000)';
           question_answer[14] := 'c';
           question_a[14]      := 'The Earl of Wilmington';
           question_b[14]      := 'Henry Palham';
           question_c[14]      := 'Sir Robert Walpole';
           question_d[14]      := 'The Duke of Newcastle';
           {question fifteen}
           question_amount[15] := 1000000;
           question[15]        := 'How old is the earth? (£1,000,000)';
           question_answer[15] := 'd';
           question_a[15]      := '8.7 Billion';
           question_b[15]      := '3 Billion';
           question_c[15]      := '6.5 Billion';
           question_d[15]      := '4.5 Billion';

          end;
{---------------------HEADER------------------------}
procedure header; {displays life lines remaining}
          begin
               writeln( '------------------------------------------------------------------------------' );
               write( 'Lifelines:  ' );
               if phone <> 'no' then
                  write( 'Phone a Friend (x)   ');
               if fifty <> 'no' then
                  write( '50/50 (y)   ');
               if audience <> 'no' then
                  write( 'Ask the Audience (z)   ' );
               if phone = 'no' then
                  if fifty = 'no' then
                     if audience = 'no' then
                             write( 'You have no more life lines!' );
               writeln;

               writeln( '------------------------------------------------------------------------------' );
          end;
{-------------------- MONEY CLIMB---------------------}
procedure money_climb;
          begin

              for n:=1 to 15 do
                  begin
                       mark[n] := '';
                  end;
              writeln( '==============================');
               {set marker/arrow}
               if question_amount[i] = 100 then
                  mark[1] := arrow;
               if question_amount[i] = 200 then
                  mark[2] := arrow;
               if question_amount[i] = 300 then
                  mark[3] := arrow;
               if question_amount[i] = 500 then
                  mark[4] := arrow;
               if question_amount[i] = 1000 then
                  mark[5] := arrow;
               if question_amount[i] = 2000 then
                  mark[6] := arrow;
               if question_amount[i] = 4000 then
                  mark[7] := arrow;
               if question_amount[i] = 8000 then
                  mark[8] := arrow;
               if question_amount[i] = 16000 then
                  mark[9] := arrow;
               if question_amount[i] = 32000 then
                  mark[10] := arrow;
               if question_amount[i] = 64000 then
                  mark[11] := arrow;
               if question_amount[i] = 125000 then
                  mark[12] := arrow;
               if question_amount[i] = 250000 then
                  mark[13] := arrow;
               if question_amount[i] = 500000 then
                  mark[14] := arrow;
               if question_amount[i] = 100000 then
                  mark[15] := arrow;

               {display money!}
               writeln( mark[15],'£1 MILLION' );
               writeln( mark[14],'£500,000' );
               writeln( mark[13],'£250,000' );
               writeln( mark[12],'£125,000' );
               writeln( mark[11],'£64,000' );
               writeln( mark[10],'£32,000' );
               writeln( mark[9],'£16,000' );
               writeln( mark[8],'£8,000' );
               writeln( mark[7],'£4,000' );
               writeln( mark[6],'£2,000' );
               writeln( mark[5],'£1,000' );
               writeln( mark[4],'£500' );
               writeln( mark[3],'£300' );
               writeln( mark[2],'£200' );

               writeln( mark[1],'£100' );

              writeln( '==============================');
          end;

{----------------------LOOSE------------------------}
procedure loose;
          begin
               clrscr;
               writeln( 'Answer Incorrect. The correct answer was: ',question_answer[i] );

               if question_amount[i] <= 1000 then
               begin
                       writeln( 'You go home with nothing!' );
               end else
               if question_amount[i] <= 32000 then
               begin
                        writeln( 'You go home with £1000!' );
               end else
               if question_amount[i] <= 1000000 then
                        writeln('You go home with £32,000!' );
               readln;
               donewincrt;
          end;
{-----------------------WINNER----------------------}
procedure winner;
          begin
               writeln( 'YOU JUST WON 1 MILLION POUNDS!' );
               readln;
               writeln( 'If only this was the real game though...' );
               writeln( 'CONGRATULATIONS on winning!' );
               readln;
               donewincrt;
          end;

{------------------PHONE A FRIEND-------------------}
procedure phone_friend;
          begin
          if phone <> 'no' then
             begin
              phone := 'no';
              writeln( 'You phone your friend....' );
              readln;
              writeln( 'He picks up the phone, you ask the question, and he replies:' );
              readln;
              writeln( '-Hi, im pretty sure the answer is ',question_answer[i],' , good luck!-' );
              readln;
              end; {end if statement -> phone isnt equal to no}
          end;
{-------------ASK THE AUDIENCE-----------------}
procedure ask_audience;
          begin
          if audience <> 'no' then
             begin
               audience := 'no';
               writeln( 'The audience vote on their keypads...' );
               readln;

               {create 4 random numbers which all add up to 100}
               randomize;
               repeat
               keya := random(100);
               until keya > 60;
               keyb := random(100 - keya);
               keyc := random(100 - keya - keyc);
               keyd := 100 - keya - keyb - keyc;
               {make it so correct answer has highest percentage/number}
               if question_answer[i] = 'b' then
                  begin
                          store := keyb;
                          keyb  := keya;
                          keya  := store;
                  end;
               if question_answer[i] = 'c' then
                  begin
                          store := keyc;
                          keyc  := keya;
                          keya  := store;
                  end;
               if question_answer[i] = 'd' then
                  begin
                          store := keyd;
                          keyd  := keya;
                          keya  := store;
                  end;

               writeln( keya,'% of the audience think the answer is A' );
               readln;
               writeln( keyb,'% of the audience think the answer is B' );
               readln;
               writeln( keyc,'% of the audience think the answer is C' );
               readln;
               writeln( keyd,'% of the audience think the answer is D' );
               readln;
              end; {end if statement -> audience isnt equal to no}
          end;
{------------------50/50-----------------------}
procedure fifty_fifty;
          begin
               if fifty <> 'no' then
                  begin
                       fifty := 'no';
                       writeln( 'Computer, please take away 2 random wrong answers!' );
                       readln;
                       {set rand3 a number according to correct answer}
                       if question_answer[i] = 'a' then
                          rand3 := 1;
                       if question_answer[i] = 'b' then
                          rand3 := 2;
                       if question_answer[i] = 'c' then
                          rand3 := 3;
                       if question_answer[i] = 'd' then
                          rand3 := 4;
                       {generate a random number}
                       randomize;
                       repeat
                       rand2 := random(4)+1;
                       until rand2{random number} <> rand3{question to keep number};
                       {choose whice answers to take away}
                       if question_answer[i] <> 'a' then
                       begin
                         if rand2 <> 1 then
                         takea := 'yes';
                       end;
                       if question_answer[i] <> 'b' then
                       begin
                         if rand2 <> 2 then
                         takeb := 'yes';
                       end;
                       if question_answer[i] <> 'c' then
                       begin
                         if rand2 <> 3 then
                         takec := 'yes';
                       end;
                       if question_answer[i] <> 'd' then
                       begin
                         if rand2 <> 4 then
                         taked := 'yes';
                       end;
                  end;
          end;
{--------------QUESTION ASKER------------------}
procedure question_ask;
          begin
          while lost <> 'yes' do
          begin
                         clrscr;
                         question_data;
                         i := i + 1;

                         header;  

                         writeln( question[i] );
                         if takea <> 'yes' then writeln( 'A - ',question_a[i] );
                         if takeb <> 'yes' then writeln( 'B - ',question_b[i] );
                         if takec <> 'yes' then writeln( 'C - ',question_c[i] );
                         if taked <> 'yes' then writeln( 'D - ',question_d[i] );
                         if i = 16 then
                            begin
                                 clrscr;
                                 winner;
                            end;
                         readln( user_answer );
                         case user_answer of
                                   'a':begin
                                            if question_answer[i] <> 'a' then
                                               begin
                                                    lost := 'yes';
                                                    loose;
                                               end;

                                       end;
                                   'b':begin
                                            if question_answer[i] <> 'b' then
                                               begin
                                                    lost := 'yes';
                                                    loose;
                                               end;

                                       end;
                                   'c':begin
                                            if question_answer[i] <> 'c' then
                                               begin
                                                    lost := 'yes';
                                                    loose;
                                               end;

                                       end;
                                   'd':begin
                                            if question_answer[i] <> 'd' then
                                               begin
                                                    lost := 'yes';
                                                    loose;
                                               end;

                                       end;
                                   'x':begin
                                            phone_friend;
                                            i := i - 1;
                                            question_ask;
                                       end;
                                   'z':begin
                                            ask_audience;
                                            i := i - 1;
                                            question_ask;
                                       end;
                                   'y':begin
                                            fifty_fifty;
                                            i := i - 1;
                                            question_ask;
                                       end;

                                   else
                                       begin
                                             i := i- 1;
                                             question_ask;
                                       end;
                          end;{ends case}
                         writeln( 'Well done! That was the correct answer!' );
                         readln;
                         clrscr;
                         header;
                         money_climb;
                         readln;
                         if fifty = 'no' then
                            begin
                                 takea := 'no';
                                 takeb := 'no';
                                 taked := 'no';
                                 takec := 'no';
                            end;
          end; {end while loop}
end; {ends procedure}

begin
     variable;
     question_ask;
end.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.pascalprogramming.info/who-wants-to-be-a-millionaire/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Assignment</title>
		<link>http://www.pascalprogramming.info/assignment/</link>
		<comments>http://www.pascalprogramming.info/assignment/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 15:39:38 +0000</pubDate>
		<dc:creator>adminpascal</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.pascalprogramming.info/?p=172</guid>
		<description><![CDATA[Assignment Assignment is an operation used to store a value in a variable, storing something in our box. Here is what we would write, if we wanted to store the value 9 in a variable called &#8220;NumberOne&#8221;. NumberOne := 9; We read the above as: &#8220;NumberOne becomes equal to 9&#8243;. The assignment can also consist [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Assignment</strong><br />
Assignment is an operation used to store a value in a variable, storing something in our box. Here is what we would write, if we wanted to store the value 9 in a variable called &#8220;NumberOne&#8221;.</p>
<pre class="brush: pascal;">
NumberOne := 9;
</pre>
<p></p>
<p>We read the above as: &#8220;NumberOne becomes equal to 9&#8243;. The assignment can also consist of an expression, a formula. And then the value or outcome of that expression is stored in the variable. For example, the value of 6 is stored in a variable named &#8220;NumberOne&#8221; and 5 in &#8220;NumberTwo&#8221;. What would be the value of &#8220;Sum&#8221; in the following example?</p>
<pre class="brush: pascal;">
Sum := NumberOne + NumberTwo;
</pre>
<p>The value of &#8220;Sum&#8221;, would of course be 11. For more information on operators please click <a href="http://www.pascalprogramming.info/operators/">here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pascalprogramming.info/assignment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Declaration</title>
		<link>http://www.pascalprogramming.info/declaration/</link>
		<comments>http://www.pascalprogramming.info/declaration/#comments</comments>
		<pubDate>Sat, 23 May 2009 10:57:31 +0000</pubDate>
		<dc:creator>adminpascal</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.pascalprogramming.info/?p=160</guid>
		<description><![CDATA[Strongly typed programming languages are ones which require that you declare the data types of each variable before they can be assigned a value. The compiler can then check for errors more easily as if variables String1 and String2 are being divided and both have a string data type, this will result in an illegal [...]]]></description>
			<content:encoded><![CDATA[<p>Strongly typed programming languages are ones which require that you declare the data types of each variable before they can be assigned a value. The compiler can then check for errors more easily as if variables String1 and String2 are being divided and both have a string data type, this will result in an illegal operation as it is not possible. </p>
<p><strong>Declaring variables</strong><br />
Above any instructions which you write, you first need to include the declaration block where you will declare all of your variables. Below is the basic layout of a complete program:</p>
<pre class="brush: pascal;">
program
{program name here}
uses
{library which pascal uses}
const
{constant declaration block}
var
{variable declaration block}
function
{any functions that are used}
procedure
{any procedures that are used}
begin
{start of main program block}
end.
{end of main program block and program}
</pre>
<p>The next example shows an exemplar declaration block which declares three variables:</p>
<pre class="brush: pascal;">
var
     number1, number2  : integer;
     myPhrase          : string;
</pre>
<p>As in the example above, variables sharing the same data type can be separated by commas and  after the variable(s) comes a colon which is followed by the data type. It is also good practice to align up all colons and then data types respectively for easing reading. </p>
<p>If you declare variables, as in the above layout of a complete program, in the variable declaration block which is above any procedures or functions, these are <strong>global variables</strong>, of which can be accessed anywhere in the code. However they are not always desirable as they could be accidental changed which is why <strong>local variables</strong> exist. <strong>Local variables</strong> are declared within a routine, such as a function or a procedure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pascalprogramming.info/declaration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

