HELP PLEASE s tymto :
program interval;
uses crt;
var dh,hh,cislo:integer;
begin
write('Zadaj cislo:');
readln(cislo);
writeln('Zadaj dolnu a hornu hranicu intervalu:');
readln(dh,hh);
if dh < cislo and hh > cislo then
begin
writeln('Zadane cislo ',cislo,' je z intervalu <',dh,',',hh,'>');
writeln('Na ukoncenie programu stlac Enter...');
end;
if dh > cislo or hh < cislo then
begin
writeln('Zadane cislo ',cislo,' nie je z intervalu <',dh,',',hh,'>');
writeln('Na ukoncenie programu stlac Enter...');
end;
readln;
end.
Fórum › Pascal
Vyr.SMAZAT

skus takto:
program interval;
uses crt;
var dh,hh,cislo:integer;
begin
write('Zadaj cislo:');
readln(cislo);
writeln('Zadaj dolnu a hornu hranicu intervalu:');
readln(dh,hh);
if (dh < cislo) and (hh > cislo) then
begin
writeln('Zadane cislo ',cislo,' je z intervalu <',dh,',',hh,'>');
writeln('Na ukoncenie programu stlac Enter...');
end
else
begin
writeln('Zadane cislo ',cislo,' nie je z intervalu <',dh,',',hh,'>');
writeln('Na ukoncenie programu stlac Enter...');
end;
readln;
end.
//edit: dalaman ma predbehol :D
ok dik,, este mozte poradit ako spravit toto?
Vytvorte program, ktorý vypíše prienik dvoch intervalov <a,b> a <c,d>.
Príklady vstupov a výstupov:
Vstup Výstup
5
10
8
15 Prienikom intervalov <5,10> a <8,15> je interval <8,10>
Vstup Výstup
7
20
35
60 Prienikom intervalov <7,20> a <35,60> je prazdna mnozina
Pri riešení tejto úlohy treba uvažovať všetky možnosti (napr. interval v intervale atď.)
program Intervaly;
uses crt;
var dh1,dh2,hh1,hh2:integer;
begin
readln(dh1,hh1,dh2,hh2);
write('Prunikem intervalu <',dh1,',',hh1,'> a <',dh2,',',hh2,'> je ');
if (dh1 > hh2) or (dh2 > hh1) then {prázdná množina}
writeln('prazdna mnozina') else
if hh1 = dh2 then
writeln('cislo ',hh1) else
if hh2 = dh1 then
writeln('cislo ',hh2) else
begin
write('interval <');
if dh1 > dh2 then
write(dh1)
else
write(dh2);
write(',');
if hh1 > hh2 then
write(hh2)
else
write(hh1);
writeln('>');
end;
readln;
end.
Musíš si ale doplnit texty, ... a nekontroluje to nesmyslné vstupy (např. 10,2,12,2), ale s tím se mi nechtělo hrát

Přidej příspěvek
Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×






























































Uživatelé prohlížející si toto vlákno
Uživatelé on-line: 0 registrovaných, 6 hostů
Podobná vlákna
Jak smazat složku/složky? — založil kaqpa
Jak smazat prvek v poli — založil Rygy
Nejde smazat složka, nevíte jak na to ? :) — založil gatuso
PHP Smazat záznam z MySQL + dialog — založil Jajty
Proč nemohu smazat řádek v tabulce — založil jAkErCZ
Moderátoři diskuze