StartprogrammingusingObjectPascal:RestaurantProgram: Difference between revisions
Jump to navigation
Jump to search
Onionmixer (talk | contribs) (page 원복) |
Onionmixer (talk | contribs) (오류수정) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==음식점 프로그램== | |||
<syntaxhighlight lang="pascal"> | <syntaxhighlight lang="pascal"> | ||
Line 6: | Line 6: | ||
begin | begin | ||
Writeln('Welcome to Pascal Restaurant. Please select your order'); | Writeln('Welcome to Pascal Restaurant. Please select your order'); | ||
Writeln('1 | Writeln('1 - Chicken (10$)'); | ||
Writeln('2 | Writeln('2 - Fish (7$)'); | ||
Writeln('3 | Writeln('3 - Meat (8$)'); | ||
Writeln('4 | Writeln('4 - Salad (2$)'); | ||
Writeln('5 - Orange Juice (1$)'); | Writeln('5 - Orange Juice (1$)'); | ||
Writeln('6 | Writeln('6 - Milk (1$)'); | ||
Writeln; | Writeln; | ||
Write('Please enter your selection: '); | Write('Please enter your selection: '); | ||
Line 34: | Line 34: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
if 조건문을 사용하여 같은 프로그램을 작성한다면, 더 복잡하게 될 것이고, | |||
if 조건문을 사용하여 같은 프로그램을 작성한다면, 더 복잡하게 될 것이고, 코드가 중복 될 것입니다. | |||
[[Category:StartprogrammingusingObjectPascal]] | [[Category:StartprogrammingusingObjectPascal]] |
Latest revision as of 11:38, 4 April 2013
음식점 프로그램
var
Meal: Byte;
begin
Writeln('Welcome to Pascal Restaurant. Please select your order');
Writeln('1 - Chicken (10$)');
Writeln('2 - Fish (7$)');
Writeln('3 - Meat (8$)');
Writeln('4 - Salad (2$)');
Writeln('5 - Orange Juice (1$)');
Writeln('6 - Milk (1$)');
Writeln;
Write('Please enter your selection: ');
Readln(Meal);
case Meal of
1: Writeln('You have ordered Chicken,',
' this will take 15 minutes');
2: Writeln('You have ordered Fish, this will take 12 minutes');
3: Writeln('You have ordered meat, this will take 18 minutes');
4: Writeln('You have ordered Salad, this will take 5 minutes');
5: Writeln('You have ordered Orange juice,',
' this will take 2 minutes');
6: Writeln('You have ordered Milk, this will take 1 minute');
else
Writeln('Wrong entry');
end;
Write('Press enter key to close');
Readln;
end.
if 조건문을 사용하여 같은 프로그램을 작성한다면, 더 복잡하게 될 것이고, 코드가 중복 될 것입니다.