All pastes #973883 Raw Edit

Stuff

public text v1 · immutable
·published 2008-04-06 11:44 UTC
rendered paste body
with priority_queue_pkg;
with Ada.Text_IO;
use Ada.Text_IO;
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
--with Ada.Text_IO.Integer_IO;
--use Ada.Text_IO.Integer_IO;

procedure main is
    type prior_t is (Very_Low, Low, Medium, High, Very_High);
    subtype sztring is string(1..20);
    package priorsor_p is new priority_queue_pkg(sztring,prior_t);

    n:natural;
begin
    Put_Line("Add meg hány feladatot akarsz felvenni!");
    get(n);

    declare
    psor:priorsor_p.p_sor(n);
    pr:prior_t;
    feladat:sztring;
    pr_int:natural;
    len:natural;
    begin
    for i in 1..n loop
        Put_Line("Add meg az uj feladat nevet!");
        get_line(feladat,len);
        feladat:="                    ";
        get_line(feladat,len);
        Put_Line("Add meg a feladat prioritasat(1:Very_Low,2:Low,3:Medium,4:High,5:Very_High)!");
        get(pr_int);

        case pr_int is
       when 1 => pr:=Very_Low;
       when 2 => pr:=Low;
       when 3 => pr:=Medium;
       when 4 => pr:=High;
       when 5 => pr:=Very_High;
       when others => Put_Line("Hibas prioritast adtal meg");
        end case;

        priorsor_p.Push(psor,pr,feladat);
    end loop;

    Put_Line("A feladatok fontossagi sorrendje(csokkeno):");
    while not priorsor_p.Empty(psor) loop
        priorsor_p.Top(psor,pr,feladat);
        priorsor_p.Pop(psor);

        put_line(feladat);
    end loop;
    end;
end main;