Fatal syntax error expected but identifier writeln found

135 / 22 hclroh~1.pas Fatal: Syntax error, ; expected but identifier WRITELN

Actually, the code contains more errors than what we guess. On my quick inspection I found it uses same name as the index for multiple level for-do loopings. Testing to compile the code, I got 6 compile time errors. See the image below.

And here is the code after put in to the code tag:

  1. Program HCL (input,output);

  2. CONST

  3. Max=45;

  4. Positive=‘Qualified’;

  5. Negative=‘Not Qualified’;

  6. QualifyClark=10000;

  7. QualifyBGarden=7500;

  8. QualifySkyfall=5500;

  9. BTime=3;

  10. ZERO=0;

  11. BRate=10/100;

  12. CCTime=3/2;

  13. CCRate=15/100;

  14. CUTime=3;

  15. DependentAllowance=75;

  16. Half=1/2;

  17. CORRECT=‘Approved’;

  18. WRONG=‘Not Approved’;

  19. TYPE

  20. StringArray=ARRAY[1..Max] OF String;

  21. RealArray=ARRAY[1..Max] OF Real;

  22. IntegerArray=ARRAY[1..Max] OF Integer;

  23. VAR

  24. ApplicantName:StringArray;

  25. HousingCommunity:StringArray;

  26. ApplicantGrossSalary:RealArray;

  27. ApplicantSalaryDeductions:RealArray;

  28. ApplicantSpouse:StringArray;

  29. SpouseGrossSalary:RealArray;

  30. SpouseSalaryDeductions:RealArray;

  31. ApplicationStatus:StringArray;

  32. FinalApplicationStatus:StringArray;

  33. NetSalaries:RealArray;

  34. ApplicantExpenses:RealArray;

  35. ApplicantRepayments:RealArray;

  36. Applicant:Integer;

  37. Name:String;

  38. Housing:String;

  39. GSalary:Real;

  40. Deductions:Real;

  41. Spouse:String;

  42. SpouseSalary:Real;

  43. SpouseDeductions:Real;

  44. TotalGrossSalary:Real;

  45. TotalSalaryDeductions:Real;

  46. NetSalary:Real;

  47. HalfNetSalary:Real;

  48. Balance:Real;

  49. Groceries:Real;

  50. Water:Real;

  51. Telephone:Real;

  52. Electricity:Real;

  53. Transport:Real;

  54. Dependents:Integer;

  55. Miscellaneous:Real;

  56. CCBalance:Real;

  57. CCInterest:Real;

  58. TotalCCAmount:Real;

  59. CCMonthlyPayments:Real;

  60. BPrinciple:Real;

  61. BLoanInterest:Real;

  62. TotalBLoanAmount:Real;

  63. BMonthlyPayments:Real;

  64. CUPrinciple:Real;

  65. CUInterest:Real;

  66. TotalCULoanAmt:Real;

  67. CUMonthlyPayments:Real;

  68. TotalMonthlyRepayments:Real;

  69. Sum:Integer;

  70. BEGIN{MAIN}

  71. FOR Applicant:=1 TO Max DO

  72. BEGIN{FOR}

  73.            ApplicantName[Applicant]:=»;

  74.            HousingCommunity[Applicant]:=»;

  75.            ApplicantGrossSalary[Applicant]:=0;

  76.            ApplicantSalaryDeductions[Applicant]:=0;

  77.            ApplicantSpouse[Applicant]:=»;

  78.            SpouseGrossSalary[Applicant]:=0;

  79.            SpouseSalaryDeductions[Applicant]:=0;

  80.            ApplicationStatus[Applicant]:=»;

  81.            FinalApplicationStatus[Applicant]:=»;

  82.            NetSalaries[Applicant]:=0;

  83.            ApplicantExpenses[Applicant]:=0;

  84.            ApplicantRepayments[Applicant]:=0;

  85. FOR Applicant:=1 TO Max DO

  86. BEGIN{FOR}

  87. Write(‘What is the name of the applicant?’);

  88. Readln(Name);

  89.            ApplicantName[Applicant]:=Name;

  90. Write(‘For which of the following housing communities are applications being made: «ClarkVillas», «BrentwoodGardens» or «SkyfallCourts»?’);

  91. Readln(Housing);

  92.            HousingCommunity[Applicant]:=Housing;

  93. Write(‘What is the applicants gross salary?’);

  94. Readln(GSalary);

  95.            ApplicantGrossSalary[Applicant]:=GSalary;

  96. Write(‘What are the applicants salary deductions?’);

  97. Readln(Deductions);

  98.            ApplicantSalaryDeductions[Applicant]:=Deductions;

  99. Write(‘Does the applicant have a spouse?’);

  100. Readln(Spouse);

  101.            ApplicantSpouse[Applicant]:=Spouse;

  102. IF Spouse=‘Yes’ THEN

  103. BEGIN{IF}

  104. Write(‘What is the spouses gross salary?’);

  105. Readln(SpouseSalary);

  106.                 SpouseGrossSalary[Applicant]:=SpouseSalary;

  107. Write(‘What are the spouses salary deductions?’);

  108. Readln(SpouseDeductions);

  109.                 SpouseSalaryDeductions[Applicant]:=SpouseDeductions;

  110. BEGIN{ELSE}

  111.                 SpouseSalary:=ZERO;

  112.                 SpouseGrossSalary[Applicant]:=SpouseSalary;

  113.                 SpouseDeductions:=ZERO;

  114.                 SpouseSalaryDeductions[Applicant]:=SpouseDeductions;

  115. FOR Applicant:=1 TO Max DO

  116. BEGIN{FOR}

  117.            TotalGrossSalary:=ApplicantGrossSalary[Applicant]+SpouseGrossSalary[Applicant];

  118.            TotalSalaryDeductions:=ApplicantSalaryDeductions[Applicant]+SpouseSalaryDeductions[Applicant];

  119.            NetSalary:= TotalGrossSalaryTotalSalaryDeductions;

  120.            NetSalaries[Applicant]:=NetSalary;

  121. FOR Applicant:=1 TO Max DO

  122. BEGIN{FOR}

  123. IF HousingCommunity[Applicant]=‘ClarkVillas’ THEN

  124. BEGIN{IF}

  125. IF NetSalaries[Applicant]>QualifyClark THEN

  126. BEGIN{IF}

  127. Writeln(‘Qualified’);

  128.                      ApplicationStatus[Applicant]:=Positive;

  129. Writeln(‘Not Qualified’);

  130.                      ApplicationStatus[Applicant]:=Negative;

  131. IF HousingCommunity =‘BrentWoodGardens’ THEN

  132. IF NetSalaries[Applicant]>QualifyBGarden THEN

  133. Writeln(‘Qualified’);

  134.                      ApplicationStatus[Applicant]:=Positive; THEN

  135. Writeln(‘Not Qualified’);

  136.                      ApplicationStatus[Applicant]:=Negative;

  137. IF HousingCommunity[Applicant]:=‘SkyfallCourts’ THEN

  138. IF NetSalaries[Applicant]>QualifySkyfall THEN

  139. Writeln(‘Qualified’);

  140.                      ApplicationStatus[Applicant]:=Positive; THEN

  141. Writeln(‘Not Qualified’);

  142.                      ApplicationStatus[Applicant]:=Negative;

  143. FOR Applicant:=1 TO Max DO

  144. IF ApplicationStatus[Applicant]:=Postive THEN

  145. Write(‘What is the principle loan Amount borrowed from the bank?’);

  146. Readln(BPrinciple);

  147. Write(‘What is the outstanding balance on the credit card?’);

  148. Readln(CCBalance);

  149. Write(‘What is the principle loan Amount borrowed from the credit union?’);

  150. Readln(CUPriniple);

  151.                 BLoanInterest:=(BPrinciple*BTime*BRate)/100;

  152.                 TotalBLoanAmt:=BLoanInterest+BPrinciple;

  153.                 BMonthlyPayments:=TotalBLoanAmt/36;

  154.                 CCInterest:=(CCBalance*CCTime*CCRate)/100;

  155.                 TotalCCAmt:=CCInterest+CCBalance;

  156.                 CCMonthlyPayents:=TotalCCAmt/18;

  157.                 CUInterest:=(CUPrinciple*CUTime*CURate)/100;

  158.                 TotalCULoanAmt:=CUInterest+CUPrinciple;

  159.                 CCMonthlyPayments:=TotalCULoanAmt/36;

  160.                 TotalMonthlyRepayments:= BMonthlyPayments + CCMonthlyPayments + CUMonthlyPayments;

  161.                 ApplicantRepayments[Applicant]:=TotalMonthlyRepayments;

  162. Write (‘How much money is spent on groceries?’);

  163. Readln (Groceries);

  164. Write (‘What is the value of the water bill?’);

  165. Readln (Water);

  166. Write (‘What is the value of the electricity bill?’);

  167. Readln (Electricity);

  168. Write (‘What is the value of the telephone bill?’);

  169. Readln (Telephone);

  170. Write (‘How much money is spent on transport’);

  171. Readln (Transport);

  172. Write (‘How many dependents does the applicant have?’);

  173. Readln (Dependents);

  174.                 Miscellaneous:= Dependents * DependentAllowance;

  175.                 TotalExpenses:= Groceries + Water + Telephone + Electricity + Transport + Miscellaneous;

  176.                 ApplicantExepenses:= TotalExpenses;

  177. FOR Applicant:=1 TO Max DO

  178. IF ApplicationStatus=Positive THEN

  179.                 HalfNetSalary:=NetSalaries[Applicant]*Half;

  180.                 Balance:=NetSalaries[Applicant] (ApplicantRepayments[Applicant] + ApplicantExpenses[Applicant]);

  181. IF Balance>HalfNetSalaries THEN

  182. Writeln (‘Approved’);

  183.                      FinalApplicationStatus[Applicant]:=CORRECT;

  184.                      Sum:= Sum + 1; ELSE

  185. Writeln(‘Not Approved’);

  186.                      FinalApplicationStatus[Applicant]:=WRONG;

  187. Writeln(‘THE DETAILS FOR THE APPLICATIONS MADE ARE AS FOLLOWS:’);

  188. Writeln (‘Application Details                 Applicant Information’);

  189. FOR Applicant:=1 TO Max DO

  190. Writeln (‘Name of Applicant:        ‘, ApplicantName[Applicant]:25);

  191. Writeln (‘Housing Community:        ‘, HousingCommunity[Applicant]:25);

  192. Writeln (‘Initial Application Status’, ApplicationStatus[Applicant]:25);

  193. Writeln (‘Final Application Status  ‘, FinalApplicationStatus[Applicant]:25);

  194. Writeln (‘A total of ‘, Sum,‘ applicants were approved for Housing.’);

  195. end;

  196. end;

  197. end;

  198. end;

  199. end;

  200. end;

  201. end;

  202. end;

  203. end;

  204. end;

  205. end;

  206. END.

It seems like a class homework and the TS only care about the urgency to finish it. Well, impatient is a big no for programming. >:D

Those bugs can be solved easily but I will let others who is willing to help impatient student to help.

Arefev596

1 / 1 / 0

Регистрация: 15.01.2021

Сообщений: 29

1

22.04.2021, 17:20. Показов 1993. Ответов 4

Метки нет (Все метки)


На паскале пишу код ровно один день,не понимаю,почему ругается…Буду благодарен за помощь!Программа должна выводить значение Y в зависимости от того, какое X дано. После того,как условие выполняется,значение должно записаться в некий столбец.
Сам код:

Pascal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
program main;
 
var y, eps: real; 
var x, r, xstart, xend : Integer;
begin
    r := 3;
    xstart := -9;
    xend := 9;
    eps := 0.0001;
    writeln('   x    |  ','   y   ');
    for x :=-9 to 9 do
    begin
        if (x < -6 - r) or (x > 9) then y := 0 ; 
        writeln('   x    |  ','   y   ');
        else if x < -6 then y := -sqrt(sqr(r) - sqr(x + 6))  
        writeln('   x    |  ','   y   ')
        else if x < -3 then y := x + 3
        writeln('   x    |  ','   y   ')
        else if x < 0 then y := sqrt(sqr(3) - sqr(x))
        writeln('   x    |  ','   y   ')
        else if x < 3 then y := 3 - x
        writeln('   x    |  ','   y   ')
        else if x <= 9 then y := (x - 3) / 2
        writeln('   x    |  ','   y   ')
        readln
    end
end.

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

22.04.2021, 17:20

Ответы с готовыми решениями:

Error: Incompatible types: got «Boolean» expected «Int64»
Здравствуйте, возникла ошибка в программе project1.lpr(43,6) Error: Incompatible types: got…

Error: Incompatible types: got «Extended» expected «SmallInt»
Задание. Написать программу решения задачи, используя функции: в основной функции вычислить с…

Составить фразу «текстовый редактор» из слов «тесто», «редакция», «мотор», «который»
1) Составить фразу &quot;текстовый редактор&quot; из слов &quot;тесто&quot;, &quot;редакция&quot;, &quot;мотор&quot;, &quot;который&quot;.

Составить фразу «письменный стол» из слов «тесненный», «полка», «речь», «миф».
1) Составить фразу &quot;письменный стол&quot; из слов &quot;тесненный&quot;, &quot;полка&quot;, &quot;речь&quot;, &quot;миф&quot;.
2) Вывести…

4

Почетный модератор

64272 / 47571 / 32739

Регистрация: 18.05.2008

Сообщений: 115,182

22.04.2021, 18:26

2

Цитата
Сообщение от Arefev596
Посмотреть сообщение

Ошибка .pas(15,9) Fatal: Syntax error, «;» expected but «ELSE» found

Эта ошибка легко исправляется, просто нужно убрать очку сзапятой( в конце строки 13.
Но программа написана явно неправильно, приведите точное и полное условие задачи.



0



ValentinNemo

2373 / 775 / 561

Регистрация: 15.01.2019

Сообщений: 2,394

22.04.2021, 18:54

3

Лучший ответ Сообщение было отмечено Arefev596 как решение

Решение

Pascal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
program main;
 
var
  y, eps: real;
  x, r, xstart, xend : Integer;
begin
  r := 3;
  xstart := -9;
  xend := 9;
  eps := 0.0001;
  writeln(' x  |  y  ');
  writeln;
  for x := -9 to 9 do
    begin
      if (x < -6 - r) or (x > 9) then
        y := 0
      else
        if x < -6 then
          y := -sqrt(sqr(r) - sqr(x + 6))
        else
          if x < -3 then
            y := x + 3
          else
            if x < 0 then
              y := sqrt(sqr(3) - sqr(x))
            else
              if x < 3 then
                y := 3 - x
              else
                if x <= 9 then
                  y := (x - 3) / 2;
        writeln(x:3,y:9:4);
    end;
  readln;
end.



1



1 / 1 / 0

Регистрация: 15.01.2021

Сообщений: 29

22.04.2021, 20:02

 [ТС]

4

Полное условие задачи:
Вычислить и вывести на экран или в файл в виде таблицы значения функции, заданной графически, на интервале от Xнач до Xкон с шагом dx. Интервал и шаг задать таким образом, чтобы проверить все ветви программы. Таблица должна иметь заголовок и шапку.

Миниатюры

Ошибка .pas(15,9) Fatal: Syntax error, ";" expected but "ELSE" found
 



0



1 / 1 / 0

Регистрация: 15.01.2021

Сообщений: 29

22.04.2021, 20:07

 [ТС]

5

Убрав ; получил: «.pas(14,9) Fatal: Syntax error, «;» expected but «identifier WRITELN» found»

Добавлено через 3 минуты
Всем большое спасибо за помощь!
Хорошего вам вечера/дня/утра!)



0



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

22.04.2021, 20:07

Помогаю со студенческими работами здесь

Составить фразу «программное обеспечение» из слов «программист», «оборот», «анчоус», «измерение»
Составить фразу &quot;программное обеспечение&quot; из слов &quot;программист&quot;, &quot;оборот&quot;, &quot;анчоус&quot;,…

Заменить символы «1», «2», «3» словами «один», «два», «три»
Дана строка символов. Заменить символы &quot;1&quot;, &quot;2&quot;, &quot;3&quot; словами &quot;один&quot;, &quot;два&quot;, &quot;три&quot;. Оформить в…

Ошибка компиляции: Error 85: «;» expected
Не компилится код ? Сижу гадаю, все перепробовал. Но видимо остался какой то один верный вариант,…

Ошибка компиляции: Error 85: «;» expected
….
begin
set_col(norm_col,norm_bc);
repeat
clrscr;

Составить програму, которая б после каждой буквы «е» в данном слове дописывала букву «о» и меняла словосочетание «да» на «нет»
Составить програму, которая б после каждой буквы &quot;е&quot; в данном слове дописывала букву &quot;о&quot; и меняла…

Построить последовательно применяя методы «отобразить», «сдвинуть», «изменить размеры», «спрятать» иерархии обьектов
построить последовательно применяя методы &quot;отобразить&quot;, &quot;сдвинуть&quot;, &quot;изменить размеры&quot;,…

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

5

Fatal syntax error expected but identifier writeln found

ProgramerForever
Дата 15.4.2010, 15:43 (ссылка) | (нет голосов) Загрузка .

Опытный

Профиль
Группа: Участник
Сообщений: 554
Регистрация: 15.11.2006
Где: Новосибирск

Репутация: нет
Всего: 5

Возникла проблема с Free Pascal. Не компилирует программы: ошибка » Fatal: Compilation aborted «.
Путь установки не менял, всё оставил по умолчанию. Версия компилятора — fpc-2.4.0.i386-win32.

Проблема решена: насколько я понял, *.pas файлы надо СОЗДАВАТЬ в программе, а не ОТКРЫВАТЬ их.

Вопрос в силе. Всё опять повторилось.

Вот, например, начал набрасывать программку:

Код
program kr4;
uses crt;

Const N=10;
var
a:array[1..N] of string;
i,l:integer;

l:=i-1;
for i:=1 to l
begin
writeln(a[i]);
end;
repeat until keypressed;
end.

Код
kr4.pas(12,3) Error: Illegal expression
kr4.pas(13,5) Fatal: Syntax error, «;» expected but «identifier WRITELN» found
kr4.pas(0) Fatal: Compilation aborted
Код
kr4.pas(0) Fatal: Compilation aborted

Это сообщение отредактировал(а) ProgramerForever — 15.4.2010, 21:16

Ozzя
Дата 26.4.2010, 09:20 (ссылка) | (нет голосов) Загрузка .

Шустрый

Профиль
Группа: Участник
Сообщений: 86
Регистрация: 19.7.2004

Репутация: нет
Всего: 1

ProgramerForever
Дата 26.4.2010, 09:33 (ссылка) | (нет голосов) Загрузка .

Опытный

Профиль
Группа: Участник
Сообщений: 554
Регистрация: 15.11.2006
Где: Новосибирск

Репутация: нет
Всего: 5

Romtek
Дата 27.4.2010, 13:26 (ссылка) | (нет голосов) Загрузка .

Бывалый

Профиль
Группа: Участник
Сообщений: 153
Регистрация: 7.12.2004
Где: Холон

Репутация: нет
Всего: 4

Цитата(ProgramerForever @ 15.4.2010, 15:43 )
do
Writeln(‘Press for end;’);
Writeln(‘Array[‘,i:1:0,’] = ‘);
Readln(a[i]);
i:=i+1;
until (a[i-1]<>»);

Разве в Паскале существует конструкция DO UNTIL?

Добавлено через 8 минут и 14 секунд
Writeln(‘Array[‘,i:1:0,’] = ‘);
Указывать i:1:0 можно только для действительных чисел.

ProgramerForever
Дата 27.4.2010, 15:21 (ссылка) | (нет голосов) Загрузка .

Опытный

Профиль
Группа: Участник
Сообщений: 554
Регистрация: 15.11.2006
Где: Новосибирск

Репутация: нет
Всего: 5

Ozzя
Дата 24.5.2010, 16:29 (ссылка) | (нет голосов) Загрузка .

Шустрый

Профиль
Группа: Участник
Сообщений: 86
Регистрация: 19.7.2004

Репутация: нет
Всего: 1

ProgramerForever
Дата 24.5.2010, 17:01 (ссылка) | (нет голосов) Загрузка .

Опытный

Профиль
Группа: Участник
Сообщений: 554
Регистрация: 15.11.2006
Где: Новосибирск

Репутация: нет
Всего: 5

Romtek
Дата 27.5.2010, 14:14 (ссылка) | (нет голосов) Загрузка .

Бывалый

Профиль
Группа: Участник
Сообщений: 153
Регистрация: 7.12.2004
Где: Холон

Репутация: нет
Всего: 4

Цитата(ProgramerForever @ 27.4.2010, 15:21 )
Да, там много косяков

А программа разве ещё неготова?

ProgramerForever
Дата 27.5.2010, 14:34 (ссылка) | (голосов:2) Загрузка .

Опытный

Профиль
Группа: Участник
Сообщений: 554
Регистрация: 15.11.2006
Где: Новосибирск

Репутация: нет
Всего: 5

1. Обсуждать и делится взломанными компонентами или программным обеспечением

2. Публиковать ссылки на варез

  • Действия модераторов можно обсудить здесь
  • С просьбами о написании курсовой, реферата и т.п. обращаться сюда
  • Вопросы по реализации алгоритмов рассматриваются здесь
  • 90% ответов на свои вопросы можно найти в DRKB (Delphi Russian Knowledge Base) — крупнейшем в рунете сборнике материалов по Дельфи

Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, THandle, Rrader, volvo877.

0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | Object Pascal: кроссплатформенные технологии | Следующая тема »

[ Время генерации скрипта: 0.1584 ] [ Использовано запросов: 21 ] [ GZIP включён ]

Источник

Читайте также:  Leeco le max 2 x820 прошивка андроид 11

Adblock
detector

Status
Not open for further replies.

  • #1

Program TypeofCreditCard;
Var
AppliName: array[1..99] of String;
SSnum: array[1..99] of Integer;
GSal: array[1..99] of Integer;
TSalD: array[1..99] of Integer;

Name, CC : String;
Rep,Exp, GS,NS,Sum,TSD , YS,SSN,i,C_Amt,PofIncome : integer ;

Begin
Writeln ( ‘Enter applicants who applied for a type of credit card’);
Readln (Rep,Exp,GS,YS,NS,Sum,TSD,SSN,CC,PofInco… ;

While ( Name <> ‘ Stop ‘ ) do
Begin
NS:= GS-TSD ;
Sum:= Exp + Rep ;
PofIncome:=(NS * 0.45);
Begin
If ( GS >4000) AND ( CC = ‘Bronze Card’ ) then
YS:= GS * 12 ;
C_Amt := YS * 0.25;
i:= i + 1;
AppliName := Name;
SSNum := SSN ;
GSal [ i]:= GS ;
TSalD := TSD ;
End ;
Begin
If (GS >= 7500) AND [CC= ‘Gold Card’] then
YS:= GS * 12 ;
C_Amt:= YS * 0.3;
i:= i + 1 ;
AppliName := Name;
SSnum:=SSN;
GSal:=GS;
TSalD:=TSD;
End;
Begin
If (GS>=10,000) AND ( CC = ‘ Platinum Card’) then
YS := GS * 12;
C_Amt: = YS * 0.4;
i:= i + 1;
A ppliName := Name;
SSNum := SSN;
GSal :=GS;
TSalD := TSD;

End if
End if
End if
End While
End.

The five errors are :
1. Error:Incompatible types: got «Boolean» expected «LongInt» — For this line : If (GS >= 7500) AND [CC= ‘Gold Card’] then

2.Error:Incompatible types: got » Set of Boolean» expected » LongInt» — for the same line (If (GS >= 7500) AND [CC= ‘Gold Card’] then )

3.Error:Incompatible types: got «single» expected «smallint» — for C_Amt := YS * 0.25 ; in Bronze Card

4.Error:Incompatible types: got «extended» expected «smallint» for C_Amt := YS * 0.3; in Gold Card

5.Fatal:syntax error , «)» expected but «,» found — (If GS >= 10000) AND [CC= ‘Platinum’] then )

Thanks for any help. I know my program is by no means perfect because I am awful at Pascal and desperately need help on fixing these things. So I am open to anything that will get this program running in Pascal. Thanks.

Hawkeye22



Feb 10, 2006



713



0



19,460

95


  • #2

1 & 2. Square brackets should be parenthesis:
This: If (GS >= 7500) AND [CC= ‘Gold Card’] then
Should be this: If (GS >= 7500) AND (CC= ‘Gold Card’) then

3 & 4:
You have C_Amt and YS declared as integer yet you are multiplying by a real.

5: there should be no parenthesis at the end of that line.

Your code is hard to read. try indenting where needed. if it was already indented before you copied/pasted, then use the [code ] bbcodes in order to keep the formatting.

Hawkeye22



Feb 10, 2006



713



0



19,460

95


  • #2

1 & 2. Square brackets should be parenthesis:
This: If (GS >= 7500) AND [CC= ‘Gold Card’] then
Should be this: If (GS >= 7500) AND (CC= ‘Gold Card’) then

3 & 4:
You have C_Amt and YS declared as integer yet you are multiplying by a real.

5: there should be no parenthesis at the end of that line.

Your code is hard to read. try indenting where needed. if it was already indented before you copied/pasted, then use the [code ] bbcodes in order to keep the formatting.

Onus



Jan 27, 2006



724



0



19,210

64


  • #3

Well for one thing, the «[» and «]» may not be used in place of parentheses «(» and «)» in boolean expressions to be evaluated. Second, if you want to assign the integer portion of a real number to an integer variable, you need to use a function like TRUNC, as in «integer_var := TRUNC(real_expression);»



Jan 13, 2011



4,165



4



35,260

1,357


  • #4

This is how your program looks when enclosed in [ code ] and [ / code ] tags:

Program TypeofCreditCard; 
Var 
    AppliName: array[1..99] of String; 
    SSnum: array[1..99] of Integer; 
    GSal: array[1..99] of Integer; 
    TSalD: array[1..99] of Integer; 

    Name, CC : String; 
    Rep,Exp, GS,NS,Sum,TSD , YS,SSN,i,C_Amt,PofIncome : integer ; 

Begin 
    Writeln ( 'Enter applicants who applied for a type of credit card'); 
    Readln (Rep,Exp,GS,YS,NS,Sum,TSD,SSN,CC,PofInco... ; 

    While ( Name <> ' Stop ' ) do 
    Begin 
        NS:= GS-TSD ; 
        Sum:= Exp + Rep ; 
        PofIncome:=(NS * 0.45); 
        Begin 
            If ( GS >4000) AND ( CC = 'Bronze Card' ) then 
                YS:= GS * 12 ; 
            C_Amt := YS * 0.25; 
            i:= i + 1; 
            AppliName := Name; 
            SSNum := SSN ; 
            GSal [ i]:= GS ; 
            TSalD := TSD ; 
        End ; 
        Begin 
            If (GS >= 7500) AND [CC= 'Gold Card'] then 
                YS:= GS * 12 ; 
            C_Amt:= YS * 0.3; 
            i:= i + 1 ; 
            AppliName := Name; 
            SSnum:=SSN; 
            GSal:=GS; 
            TSalD:=TSD; 
        End; 
        Begin 
            If (GS>=10,000) AND ( CC = ' Platinum Card') then 
                YS := GS * 12; 
            C_Amt: = YS * 0.4; 
            i:= i + 1; 
            AppliName := Name; 
            SSNum := SSN; 
            GSal :=GS; 
            TSalD := TSD; 
        End if 
        End if 
        End if 
    End While 
End.



Jan 13, 2011



4,165



4



35,260

1,357


  • #5

(sorry for double-post, it will be easier)…

Appart from the errore already discussed, there are some more:
— there are not «end if» and «end while» operators in Pascal (OK, at least in the popular ones);
— your ReadLn statement probably won’t work — string variables will get empty values. Split it on several Write / ReadLn statements
— you have several arrays, but assignment statements are missing [Index] part of the array, e.g. AppliName := Name;
— you are not checking if one will enter more that 100 applicants

  • #6

Thank you everyone. I will give you all an update when i incorporate all of these corrections.

By the way, I am using Free IDE Pascal .

Onus



Jan 27, 2006



724



0



19,210

64


  • #7

I used to use Turbo Pascal. Ah, those were the days…

  • #8

I’m down to 2 errors now and I am pleased but I just really need it to run.
This is the error — Fatal:Syntax Error, «;» expected but «identifier Writeln found — Source of error- Writeln ( ‘Enter applicants who applied for a type of credit card’);

Is there some sort of documentation about what each error means??I want to learn.

Ijack



Jul 30, 2008



1,035



0



20,360

113


  • #9

The message means exactly what it says. The compiler was expecting to find «;» but instead it found «Writeln». Normally this means the semicolon is missing from the line before the one listed but your program, as you list it, has no statement before that line. Have you added something since?

  • #10

The message means exactly what it says. The compiler was expecting to find «;» but instead it found «Writeln». Normally this means the semicolon is missing from the line before the one listed but your program, as you list it, has no statement before that line. Have you added something since?

I’ve done nothing but do the changes I’ve been told to made.



Jan 13, 2011



4,165



4



35,260

1,357


  • #11

@Tactical, post your complete code, here or on e.g. PasteBin. If you post it here, encclose it in «code» tags
that is, (omit ‘_’ from example below)
[_code_]
Program something;

end.
[_/code_]

Ijack



Jul 30, 2008



1,035



0



20,360

113


  • #13

You have deleted the «Begin» between the variable declarations and the program statements. Reinstate it (just before the offending line) and try again.

  • #14

You have deleted the «Begin» between the variable declarations and the program statements. Reinstate it (just before the offending line) and try again.

I inserted that beginning then one more error came up and it said
Fatal syntax error, «;’ expected but » BEGIN» found



Jan 13, 2011



4,165



4



35,260

1,357


  • #15

@Tactical — it would be helpful if you mention what compiler you’re using, and (when errors happen) — at what line.

On your program:
— Put a «Begin» before first «WriteLn»;
— Put «I := 0» before «while» statement
— change «while» to check that I is less than 100
— change internal «If» to check for «Name <> ‘Stop'»
— Remove last two «End;» before «End.»;

Probably there are more… Change your program, re-post it on PasteBin for further help

  • #16

So i followed through and continued to attempt to run the program and eventually after trying to follow and fix every error , I think it started running but i don’t understand because its been more than 5 hours now that it has said that the PASCAL file is now running but i can not type anything in the black screen and it can not be closed down.Additionally, because I didn’t know it would run after i corrected the last error, this means that I have not saved the most recent version of the PASCAL yet. The problem with that is for my assignment it says » You have to show evidence that your program ran (a print screen after it compiled. Print screen of some data that you entered and a print screen of the output) «

Will it ever run or come off of this screen that it seems to be stuck on?



Jan 13, 2011



4,165



4



35,260

1,357


  • #17

@Tactical — for God’s sake, what version of Pascal are you using?
Try pressing <Ctrl>-<Break>, or <Ctrl>-C, to terminate your program. If you have a debugger in your environment, you can try to terminate your program from there as well.

And since we don’t know how your program looks now, noone can tell what will come out of it ;)

Ijack



Jul 30, 2008



1,035



0



20,360

113


  • #18

The last version of the program that you listed had an infinite loop in it. You never change the value of «Name» inside the «While» loop. This is why the program keeps running.

As the previous poster said, just break into the program. How you do that depends upon your environment.

Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date

B

Solved! Apple Community Reload Error Apps General Discussion 4 Jun 14, 2022

K

Question cache deleted in error Apps General Discussion 1 Apr 25, 2022

xarzu

Question How do I update my computer because I have an error? Apps General Discussion 0 Apr 12, 2022

C

Question Photoshop Elements 2021 error codes 81 and 501 won’t allow installation? How to fix. Apps General Discussion 1 May 5, 2021

aymen9309

Question i need help in a simple pascal program Apps General Discussion 1 Jun 18, 2020

David___Only

Question How to fix“ ERROR-invalid argument/option — ‘Live’ ” in this code? Apps General Discussion 0 Jul 21, 2019

KloneCSGO

Question PUBG Lite launcher error Apps General Discussion 2 Jul 1, 2019

reble

Question Win dos shell syntax error Apps General Discussion 2 Apr 11, 2019

I

Solved! Getting error 502 Bad Gateway, is it proxy or website itself Apps General Discussion 5 Jan 23, 2019

U

ASCII in Pascal programming Apps General Discussion 4 Dec 13, 2015

A

Pascal homework help Apps General Discussion 2 Mar 7, 2015

shiftyape

need help with pascal programming Apps General Discussion 4 Feb 22, 2014

shiftyape

why wont this pascal program work? idk Apps General Discussion 18 Dec 13, 2013

shiftyape

need help with this pascal programming. Apps General Discussion 3 Dec 13, 2013

shiftyape

why doesnt this pascal program work? Apps General Discussion 1 Dec 7, 2013

shiftyape

need help with pascal programming? Apps General Discussion 2 Dec 7, 2013

shiftyape

i need help fixing this pascal program Apps General Discussion 13 Dec 5, 2013

L

Which programming languages will I need to learn as an actuary? Apps General Discussion 2 Dec 12, 2012

M

** A CHALLENGE ** UCSD P-sytem Pascal ** Apps General Discussion 7 Oct 15, 2010

P

pascal quation.. Apps General Discussion 7 Nov 13, 2008

  • Advertising
  • Cookies Policies
  • Privacy
  • Term & Conditions
  • Topics

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal syntax error expected but identifier write found
  • Fatal syntax error expected but const char found
  • Fatal syntax error begin expected but end of file found lazarus
  • Fatal string manager failed to initialize properly как исправить ошибку
  • Fatal string manager failed to initialize properly red alert 2 ошибка fatal

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии