fork download
  1. program ideone;
  2. VAR
  3. count1:integer;
  4. count2:integer;
  5. count3:integer;
  6. count4:integer;
  7. count5:integer;
  8. string1:array[0..75]of char;
  9. amt1:array[0..15]of integer;
  10. amt2:array[0..15]of integer;
  11. amt3:array[0..15]of integer;
  12. amt4:array[0..15]of integer;
  13. amt5:array[0..15]of integer;
  14. sum_1:integer;
  15. sum_2:integer;
  16. sum_3:integer;
  17. sum_4:integer;
  18. sum_5:integer;
  19. mas_name:char;
  20. c_cost:real;
  21. section1:char;
  22. section2:char;
  23. section3:char;
  24. section4:char;
  25. section5:char;
  26. amt_paid:integer;
  27.  
  28. section_counter:array[0..4] of integer;
  29. section_pay:array[0..4] of integer;
  30. total_paid:integer;
  31. exit_flag:boolean;
  32. exit_input:string;
  33. i:integer;
  34.  
  35. BEGIN
  36. // This initializes the exit flag, ensuring that we enter the main loop.
  37. exit_flag := true;
  38.  
  39. // This initializes our counters and amount paid for each section.
  40. for i:= 0 to 4 do
  41. begin
  42. section_counter[i] := 0;
  43. section_pay[i] := 0;
  44. end;
  45.  
  46. // This initializes our total paid.
  47. total_paid := 0;
  48.  
  49. // Welcome message.
  50. Writeln('****WELCOME TO THE COMMAZ BAND EXCLUSIVE CARNIVAL. FOLLOW THE INSTRUCTIONS THAT ARE GIVEN.****');
  51.  
  52. // We enter the loop here.
  53. while(exit_flag) do
  54. begin
  55. Writeln('Enter the Masqueraders name: ');
  56. readln(string1);
  57. Writeln('Enter the cost of the costume: ');
  58. readln(c_cost);
  59. Writeln('Enter the Amount Paid by the Masquerader: ');
  60. readln(amt_paid);
  61. // Section 1.
  62. if ((amt_paid = 144) or (amt_paid = 184)) then
  63. begin
  64. // Section 1.
  65. Writeln('THIS MASQUERADER IS IN SECTION: Section 1');
  66. Inc(section_counter[0]);
  67. section_pay[0] += amt_paid;
  68. total_paid += amt_paid;
  69. end
  70. else if ((amt_paid = 198) or (amt_paid = 253)) then
  71. begin
  72. // Section 2.
  73. Writeln('THIS MASQUERADER IS IN SECTION: Section 2');
  74. Inc(section_counter[1]);
  75. section_pay[1] += amt_paid;
  76. total_paid += amt_paid;
  77. end
  78. else if ((amt_paid = 252) or (amt_paid = 322)) then
  79. begin
  80. // Section 3.
  81. Writeln('THIS MASQUERADER IS IN SECTION: Section 3');
  82. Inc(section_counter[2]);
  83. section_pay[2] += amt_paid;
  84. total_paid += amt_paid;
  85. end
  86. else if ((amt_paid = 315) or (amt_paid = 405)) then
  87. begin
  88. // Section 4.
  89. Writeln('THIS MASQUERADER IS IN SECTION: Section 4');
  90. Inc(section_counter[3]);
  91. section_pay[3] += amt_paid;
  92. total_paid += amt_paid;
  93. end
  94. else if ((amt_paid =383) or (amt_paid = 489)) then
  95. begin
  96. // Section 5.
  97. Writeln('THIS MASQUERADER IS IN SECTION: Section 4');
  98. Inc(section_counter[4]);
  99. section_pay[4] += amt_paid;
  100. total_paid += amt_paid;
  101. end;
  102.  
  103. // Now that we've finished one run-through of the program, we ask if
  104. // we want to do this again.
  105.  
  106. Writeln('Do you want to add another masquerader? Input Yes to do so.');
  107. readln(exit_input);
  108.  
  109. if((exit_input <> 'yes') and (exit_input <> 'YES')
  110. and (exit_input <> 'Yes')) then
  111. begin
  112. exit_flag := false;
  113. end;
  114. end;
  115.  
  116. // Now that we're out of the loop, we print everything.
  117.  
  118. Writeln('Totals for each section:');
  119.  
  120. for i:= 0 to 4 do
  121. begin
  122. write('Section ', i + 1, '\n');
  123. write('Number of masqueraders: ', section_counter[i], '\n');
  124. write('Amount paid: ', section_pay[i], '\n');
  125. Writeln();
  126. end;
  127.  
  128. write('Total paid: ', total_paid, '\n')
  129.  
  130.  
  131. END.
Runtime error #stdin #stdout 0s 288KB
stdin
Standard input is empty
stdout
****WELCOME TO THE COMMAZ BAND EXCLUSIVE CARNIVAL. FOLLOW THE INSTRUCTIONS THAT ARE GIVEN.****
Enter the Masqueraders name: 
Enter the cost of the costume: 
Runtime error 106 at $080481F7
  $080481F7
  $08063C93