StartprogrammingusingObjectPascal:RestaurantProgramUsingIfCondition: Difference between revisions
Jump to navigation
Jump to search
Onionmixer (talk | contribs) (SPOP if조건문을사용한레스토랑프로그램 페이지 추가) |
Onionmixer (talk | contribs) (소스코드 수정) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==if 조건문을 사용한 레스토랑 프로그램== | |||
<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 42: | Line 42: | ||
end. | end. | ||
</syntaxhighlight> | </syntaxhighlight> | ||
다음 예제에서는, 프로그램이 학생들의 성적을 계산해서 A 그리고 B, C, D, E, F 등급으로 변환해줍니다. | 다음 예제에서는, 프로그램이 학생들의 성적을 계산해서 A 그리고 B, C, D, E, F 등급으로 변환해줍니다. | ||
[[Category:StartprogrammingusingObjectPascal]] | [[Category:StartprogrammingusingObjectPascal]] |
Latest revision as of 11:34, 4 April 2013
if 조건문을 사용한 레스토랑 프로그램
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);
if Meal = 1 then
Writeln('You have ordered Chicken, this will take 15 minutes')
else
if Meal = 2 then
Writeln('You have ordered Fish, this will take 12 minutes')
else
if Meal = 3 then
Writeln('You have ordered meat, this will take 18 minutes')
else
if Meal = 4 then
Writeln('You have ordered Salad, this will take 5 minutes')
else
if Meal = 5 then
Writeln('You have ordered Orange juice,' ,
' this will take 2 minutes')
else
if Meal = 6 then
Writeln('You have ordered Milk, this will take 1 minute')
else
Writeln('Wrong entry');
end;
Write('Press enter key to close');
Readln;
end.
다음 예제에서는, 프로그램이 학생들의 성적을 계산해서 A 그리고 B, C, D, E, F 등급으로 변환해줍니다.