Jump to content

problem on the main program

- - - - -

  • Please log in to reply
1 reply to this topic

#1
rrwe

rrwe

    Newbie

  • Members
  • Pip
  • 4 posts
the following cannot be ran as the sample output shown :
F: (0)
E:** (2)
D:****** (6)
C:*********(9)
B:**** (4)
A:**(2)

how can solved this problem?
many thanks to you guys
program barchart;

var

   count : array ['A'..'F'] of integer;

   mark : array [1..15] of integer;

   i: integer;

   ch: char;


procedure countgrade;

var

   ch : char;

   i : integer;

begin

   for ch := 'A' to 'F' do

       count[ch] := 0;

   for i := 1 to 15 do

       case mark[i] of

	      0..50 : count['F'] := count['F'] + 1;

	      51..60 : count['E'] := count['E'] + 1;

	      61..70 : count['D'] := count['D'] + 1;

	      71..80 : count['C'] := count['C'] + 1;

	      81..90 : count['B'] := count['B'] + 1;

	      91..100 : count['A'] := count['A'] + 1;

       end

end;


procedure plotchart;

var

   ch : char;

   i : integer;

begin

   for ch := 'F' to 'A' do

   begin

      write(ch, ':');

      for i := 1 to count[ch] do

         write('*');

      writeln('(', count[ch], ')')

   end

end;


begin

   for i:=1 to 15 do

      begin

         write('Enter test mark for student ',i,': ' );

         readln(mark[i]);

      end;


   countgrade;

   plotchart;

   readln

end.


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
What's your input?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users