Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Small problem Posted by IT_Kid on 6 Feb 2011 at 8:36 PM
Ok I'm relatively new to programming see i wrote this program and was pretty sure it was right but when i compile it says ';' expected on last line, but thing is it is the last line so it's '.' instead of ';' so could someone maybe help me find whats causing the problem.
Program FFL;
Uses WinCRT;

var
Member_name : Array[1..26] of string;
Membership_Dues : Array[1..26] of real;
Mission_Dues : Array[1..26] of real;
Building_Fund : Array[1..26] of real;
Project_Hope : Array[1..26] of real;
x : integer;
Mems_TC : Array[1..26] of real;
Procedure Members_Total_Contribution;
Begin
For x := 1 to 26 Do
Begin
Writeln('Enter a members name');
Readln(Member_name[x]);
Writeln('Enter membership dues');
Readln(Membership_Dues[x]);
Writeln('Enter mission dues');
Readln(Mission_Dues[x]);
Writeln('Enter Building fund contribution');
Readln(Building_Fund[x]);
Writeln('Enter Contribution to Project Hope');
Readln(Project_Hope[x]);
Mems_TC[x] := Membership_Dues[x] + Mission_Dues[x] + Building_Fund[x] + Project_Hope[x];
Writeln('Members total contribution is ',Mems_TC[x]);
End;
End;
Procedure Total_For_Category;
var
Membership_Dues_Total : real;
Mission_Dues_Total : real;
Building_Fund_Total : real;
Project_Hope_Total : real;
Begin
Membership_Dues_Total := 0;
Mission_Dues_Total := 0;
Building_Fund_Total := 0;
Project_Hope_Total := 0;
For x := 1 to 26 Do
Begin
Membership_Dues_Total := Membership_Dues_Total + Membership_Dues[x];
Mission_Dues_Total := Mission_Dues_Total + Mission_Dues[x];
Building_Fund_Total := Building_Fund_Total + Building_Fund[x];
Project_Hope_Total := Project_Hope_Total + Project_Hope[x];
End;
Writeln('Total membership dues is ',Membership_Dues_Total:2:2);
Writeln('Total mission dues is ',Mission_Dues_Total:2:2);
Writeln('Total Builduing Fund contribution is ',Building_Fund_Total:2:2);
Writeln('Total Project Hope contribution is ',Project_Hope_Total:2:2);
End;
Procedure Contribution_Percentage;
var
Overall_Contribution : real;
Percentage : real;
Begin
Overall_Contribution :=0;
For x := 1 to 26 Do
Begin
Overall_Contribution := Overall_Contribution + Mems_TC[x];
End;
For x := 1 to 26 Do
Begin
Percentage := (Mems_TC[x] / Overall_Contribution) *100;
Writeln('Percentage contribution is ',Percentage);
End;
End;
Procedure Search;
var
Found : boolean;
index : integer;
Search_value : string;
max : integer;
Begin
found := false;
max := 26;
index := 1;
Writeln('Enter the name of person you wish to search for');
Readln(Search_value);
While (found = false) and (index<max) Do
Begin
If Member_name[index] = Search_value then
Begin
Found := true;
End
Else
Begin
index := index + 1;
End;
End;
If Found = true then
Begin
Writeln('The person searched for is ',Member_name[index]);
Writeln('Thier total contribution is ',Mems_TC[index]:2:2);
End
Else
Begin
Writeln('Person not found');
End;
Begin
Members_Total_Contribution;
Total_For_Category;
Contribution_Percentage;
Search;
Readln;
End.
Small problem I know but if anyone could help I'd be grateful.
Report
Re: Small problem Posted by _Atex_ on 6 Feb 2011 at 11:38 PM
: Ok I'm relatively new to programming see i wrote this program and
: was pretty sure it was right but when i compile it says ';' expected
: on last line, but thing is it is the last line so it's '.' instead
: of ';' so could someone maybe help me find whats causing the problem.
: Program  FFL;
: Uses WinCRT;
: 
: var
:   Member_name : Array[1..26] of string;
:   Membership_Dues : Array[1..26] of real;
:   Mission_Dues : Array[1..26] of real;
:   Building_Fund : Array[1..26] of real;
:   Project_Hope : Array[1..26] of real;
:   x : integer;
:   Mems_TC : Array[1..26] of real;
: Procedure Members_Total_Contribution;
:           Begin
:           For x := 1 to 26 Do
:               Begin
:               Writeln('Enter a members name');
:               Readln(Member_name[x]);
:               Writeln('Enter membership dues');
:               Readln(Membership_Dues[x]);
:               Writeln('Enter mission dues');
:               Readln(Mission_Dues[x]);
:               Writeln('Enter Building fund contribution');
:               Readln(Building_Fund[x]);
:               Writeln('Enter Contribution to Project Hope');
:               Readln(Project_Hope[x]);
:               Mems_TC[x] := Membership_Dues[x] + Mission_Dues[x] + 
: Building_Fund[x] + Project_Hope[x];
:               Writeln('Members total contribution is ',Mems_TC[x]);
:               End;
:           End;
: Procedure Total_For_Category;
: var
: Membership_Dues_Total : real;
: Mission_Dues_Total : real;
: Building_Fund_Total : real;
: Project_Hope_Total : real;
:           Begin
:           Membership_Dues_Total := 0;
:           Mission_Dues_Total := 0;
:           Building_Fund_Total := 0;
:           Project_Hope_Total := 0;
:           For x := 1 to 26 Do
:               Begin
:               Membership_Dues_Total := Membership_Dues_Total + 
: Membership_Dues[x];
:               Mission_Dues_Total := Mission_Dues_Total + 
: Mission_Dues[x];
:               Building_Fund_Total := Building_Fund_Total + 
: Building_Fund[x];
:               Project_Hope_Total := Project_Hope_Total + 
: Project_Hope[x];
:               End;
:           Writeln('Total membership dues is 
: ',Membership_Dues_Total:2:2);
:           Writeln('Total mission dues is ',Mission_Dues_Total:2:2);
:           Writeln('Total Builduing Fund contribution is 
: ',Building_Fund_Total:2:2);
:           Writeln('Total Project Hope contribution is 
: ',Project_Hope_Total:2:2);
:           End;
: Procedure Contribution_Percentage;
: var
: Overall_Contribution : real;
: Percentage : real;
:           Begin
:           Overall_Contribution :=0;
:           For x := 1 to 26 Do
:               Begin
:               Overall_Contribution := Overall_Contribution + 
: Mems_TC[x];
:               End;
:           For x := 1 to 26 Do
:               Begin
:               Percentage := (Mems_TC[x] / Overall_Contribution) *100;
:               Writeln('Percentage contribution is ',Percentage);
:               End;
:           End;
: Procedure Search;
: var
: Found : boolean;
: index : integer;
: Search_value : string;
: max : integer;
:           Begin
:           found := false;
:           max := 26;
:           index := 1;
:           Writeln('Enter the name of person you wish to search for');
:           Readln(Search_value);
:           While (found = false) and (index<max) Do
:                  Begin
:                      If Member_name[index] = Search_value then
:                         Begin
:                         Found := true;
:                         End
:                      Else
:                         Begin
:                         index := index + 1;
:                         End;
:                  End;
:           If Found = true then
:              Begin
:              Writeln('The person searched for is 
: ',Member_name[index]);
:              Writeln('Thier total contribution is 
: ',Mems_TC[index]:2:2);
:              End
:           Else
:   {           Begin }
:              Writeln('Person not found');
:              End;
: Begin
:      Members_Total_Contribution;
:      Total_For_Category;
:      Contribution_Percentage;
:      Search;
:      Readln;
: End. 

: Small problem I know but if anyone could help I'd be grateful.
:

Report
Re: Small problem Posted by IT_Kid on 12 Feb 2011 at 5:39 PM
Thank you I knew it was a little screw up.
Report
This post has been deleted. Posted by lanxiang on 16 Feb 2011 at 1:19 AM
This post has been deleted.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.