Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 5th, 2011, 05:39 PM
Mr K Mr K is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 158 Mr K User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 6 m 40 sec
Reputation Power: 0
Pascal - Exit code =1

Hi guys, maybe there is someone out there that could give a hand with the following code. I get the message "Exit code=1" and it won't compile. Also, it seems to have another problem that i can't seem to figure out. Can someone give me a hand here?

To let you see what may be the problem, I have provided the code. Big thanks for the help!

{ AUTHOR:
DATE: 3-APRIL-2011

THE FUNCTION OF THIS PROGRAM IS TO AVERAGE GRADES
AND DETERMINE WHETHER THE STUDENT HAS PASSED OR FAILED}


program StdAverage;


{DECLARATION OF VARIABLES
AmtGrade: represent the total number of grades that will be entered and works like a grade counter
grades: an array of real numbers where entered grades will be stored
enteredgrade: temporary location of a recently entered grade
StdAverage: is the grade average
StdID: is the student’s ID
StdName: represents the name of the students }

var
StdID, StdName : string;
AmtGrade : integer;
grade: array[1..10] of real;
EnterGrade, gradeCount, newgrade : integer;
gradesum, average, total: real;

{PROGRAM STARTS HERE}
begin
gradeSum:= 0.0;
gradeCount:= 0; {INITIALIZATION OF VARIABLES}
total := 0.0;
average := 0.0;

{block requests students data}
writeln('Average Calculator ');
Writeln('Enter Student ID: ');
readln(StdID);
Writeln('Enter Student Name: ');
readln(StdName);

{requests amount of grades to be entered}
writeln('Enter amount of grades to be used: ');
readln(AmtGrade);

{while loop that runs as many times needed to enter all grades required and keeps track of total}
WHILE gradeCount < AmtGrade DO
begin
gradeCount := gradeCount + 1;
writeln('EnterGrade ', StdID, ':');
readln(newgrade);
grade[gradeCount] := newgrade;
total := total + grade[gradeCount];
end;

{average is calculated here}
average := total / AmtGrade;

{PRINT STUDENTS DATA}
writeln();
writeln('Student ID: ', StdID);
writeln('Student Name: ', StdName);
writeln('StdAverage is ',average : 4 : 1);

{THIS IF CONDITION DETERMINE WHETHER STUDENT MEETS CRITERIA TO PASS AND PRINTS THE CORRECT RESULT}
if (average>=70) then
writeln('Student has Passed')
else
writeln('Student has Failed');
readln();


end.
{PROGRAM ENDS HERE}

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Pascal - Exit code =1

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap