** บทความและโครงงานนี้เป็นความคิดเห็นของผู้เขียนเอง ซึ่งผู้อ่านไม่จำเป็นต้องเห็นด้วยเสมอไปครับ
หาก มีข้อเสนอแนะ หรือพบข้อความใดๆ ผิก กรุณาแจ้งมายังผู้เขียนด้วยครับ จะได้ทำการแก้ไขข้อมุลให้
ถูกต้อง ครับ
กลับหน้าหลัก บทความ
 

???? C ??? ??????????????

??????????????????????????????????????????????? ??????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????? ???? ?????????????????????? ???????
?????? if
? ?????? if ????????????????????????????????????????? ????? if ?????? ? ???? ??????????????????????????? ????
??? ?????????????????????? 80 ??????? A
??? ????????????????????? 70-79 ??????? B ???????
??????
if ( condition)
{
Statements ;
}
??????
condition ??? ????????????????????
Statements ??? ??????????????????????????????????????

?????????????????????????????????????


???????????????


???????? code
?????????? a = 5 ????????????????????
??? a = 5 ???? ??????????????? YES
??? a != 5 ??????????????? NO


????????????? ??? YES


??????????????????? a ????????????????????????? 5 ???????????? ??? NO


????????????? ??? YES


?????? if?.else
? ????????????????????????????????????????????? if ??????? else ?????????????????????????????????????????????????
??????
if ( condition)
{
Statements1;
}
elas
{
Statements2;
}
?????
condition ??? ????????????????????
Statements1 ??? ??????????????????????????????????????
Statements2 ??? ??????????????????????????????????????
???????????????????????????????????


???????????????


???????? code
?????????? a = 5 ????????????????????
??? a = 5 ???? ??????????????? YES
??? a != 5 ??????????????? NO


?????????????????????????????



?????????????????????????????


?????? if?.else if
? ???????????????????????????????????????? ??????????????????????????????????? if..else
??????
if (condition 1)
{
Statements 1
}
elas if (condition 2)
{
Statements 2
}
elas if (condition ..n)
{
Statements..n
}
Else
{
Statements ( ????????????????????)
}
condition ??? ????????????????????
Statements ??? ??????????????????????????????????????
?????????????????????????????????????


???????????????

???????? code ???????????????????? ( ?????????????)
?????? switch ? case
? ??????????????????????????????????????? if..else ??? ?????????????????? 2 ???????? ?????????????????????????? ??????? (>) ???? ??????????? (<)
??????
switch (condition)
{
case constant 1:
Statements 1;
break;
case constant 2:
Statements 2;
break;
- - -
case constant N:
Statements N;
break;
default :
}
?????
condition ??? ????????????????????
constant ??? ??????????????????????????????????
Statements ??? ??????????????????????????????????????????
Code ????????
?????????????????????? a ???????????????????????????????????????????????


??????????????????? a = 1



??????????????????? a = 2



??????????????????? a >3


???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????? ?????????? ???????????????????????????? ????


เขียนเมื่อ 20 ??.?. 2554