Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program ma_hien;
- uses crt;
- var ctl:string;
- procedure kt;
- begin
- while (ctl<>'roi') or (ctl<>'chua') do
- begin
- write('Cau tra loi khong hop le! Nhap lai cau tra loi: ');
- readln(ctl);
- if (ctl='roi') or (ctl='chua') then break;
- end;
- exit;
- end;
- {------------------------}
- procedure chua;
- begin
- while ctl='chua' do
- begin
- writeln('Ve nha di!');
- write('Ve den nha chua? ');
- readln(ctl);
- if ctl='roi' then break;
- if ctl<>'chua' then
- begin
- write('Cau tra loi khong hop le! Nhap lai cau tra loi: ');
- continue;
- end;
- end;
- end;
- {------------------------}
- procedure roi;
- begin
- writeln('Tot! O yen day!');
- readln;
- halt;
- end;
- {---------------------}
- begin
- clrscr;
- writeln('Chi tra loi "roi" hoac "chua"!');
- write('Da o nha chua? ');
- readln(ctl);
- if (ctl<>'roi') and (ctl<>'chua') then kt; (Kiem tra cau tra loi co hop le}
- if ctl = 'roi' then roi;
- {Chuong trinh se ket thuc neu tra loi roi va se chay tiep phan code duoi neu cau tra loi la chua}
- writeln('Ve nha di!');
- write('Ve den nha chua? ');
- readln(ctl);
- if (ctl<>'roi') and (ctl<>'chua') then kt; (Kiem tra cau tra loi co hop le)
- if ctl = 'roi' then roi else chua;
- if ctl='roi' then roi else chua;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement