1. ã¯ããã«
Cèšèªã¯ãå€ãã®ããã°ã©ãã³ã°èšèªã®åºç€ãšãªã£ãŠããã·ã³ãã«ã§åŒ·åãªèšèªã§ãããã®äžã§ãè«çæŒç®åãã¯ãæ¡ä»¶å€æãç¹°ãè¿ãåŠçãªã©ãããŸããŸãªå Žé¢ã§äœ¿ãããéèŠãªèŠçŽ ã§ããè«çæŒç®åãæ£ããç解ããããšã§ãè€éãªããã°ã©ã ã®æ¡ä»¶åå²ã容æã«çµã¿ç«ãŠãããããã«ãªããã³ãŒãã®å¹çãå€§å¹ ã«åäžããŸãã
ãã®èšäºã§ã¯ãCèšèªã®è«çæŒç®åã«ã€ããŠè©³ãã解説ããããããã®ç¹åŸŽã䜿ãæ¹ãå ·äœçãªäŸãéããŠãã®æŽ»çšæ¹æ³ãåŠãã§ãããŸããç¹ã«ãANDæŒç®åãORæŒç®åãšãã£ãåºæ¬çãªè«çæŒç®åã®ç解ã¯ãã¡ããããããæŒç®åãšã®éãã誀ãããããã€ã³ãã玹ä»ããŠãããŸãã
ããããåŠã¶å 容ãéããŠãCèšèªã®è«çæŒç®åã«ã€ããŠã®ç¥èãæ·±ããå®éã®ããã°ã©ã ã«åœ¹ç«ã€ã¹ãã«ã身ã«ã€ããŸãããã
2. è«çæŒç®åãšã¯ïŒCèšèªã§ã®åºç€ç¥èïŒ
Cèšèªã«ãããè«çæŒç®åã¯ãäž»ã«æ¡ä»¶æãã«ãŒãã®äžã§æ¡ä»¶ã®çåœãè©äŸ¡ããããã«äœ¿çšãããŸããè«çæŒç®åã¯ãæ¡ä»¶ããçïŒTrueïŒãããåœïŒFalseïŒããã確èªããããã«å¿ããåŠçãè¡ãããã®éèŠãªåœ¹å²ãæã£ãŠããŸããè«çæŒç®åã䜿ãããšã§ãè€æ°ã®æ¡ä»¶ãçµã¿åãããããæ¡ä»¶ãå転ãããããšãããã°ã©ã ã®æè»æ§ãé«ããããšãã§ããŸãã
è«çæŒç®åã®åœ¹å²ãšçšé
è«çæŒç®åã«ã¯äž»ã«ä»¥äžã®3çš®é¡ããããããããç°ãªãçšéã§äœ¿çšãããŸãã
- è«çç©ïŒANDïŒæŒç®åïŒ
&&
- 2ã€ã®æ¡ä»¶ããçãã§ããå Žåã«ãçããšè©äŸ¡ãããŸããæ¡ä»¶ã®äž¡æ¹ãæç«ããå Žåã®ã¿ã次ã®åŠçã«é²ããããªã±ãŒã¹ã§äœ¿ãããŸãã
- è«çåïŒORïŒæŒç®åïŒ
||
- ããããã®æ¡ä»¶ããçãã§ããã°ãçããšè©äŸ¡ãããŸãããããã1ã€ã®æ¡ä»¶ãæç«ããŠããå Žåã«åŠçãé²ãããå Žåã«äœ¿çšãããŸãã
- è«çåŠå®ïŒNOTïŒæŒç®åïŒ
!
- æ¡ä»¶ã®çåœãå転ãããŸããæ¡ä»¶ããçãã§ããå Žåã«ãåœããšè©äŸ¡ãããéã«ãåœãã§ããã°ãçããšããŠæ±ãããŸãã
è«çæŒç®åã¯ãCèšèªã®ifæãwhileã«ãŒããªã©ã®æ¡ä»¶åŒã«çµã¿èŸŒãããšã§ãããã°ã©ã ã®æåãå¶åŸ¡ããåãçºæ®ããŸãããã®ãããªæŒç®åãå¹æçã«å©çšããããšã§ãæ¡ä»¶åå²ãé§äœ¿ããè€éãªããã°ã©ã ãç°¡æœã«è¡šçŸããããšãã§ããŸãã
è«çæŒç®åã®åºæ¬çãªæžãæ¹
è«çæŒç®åã¯ã以äžã®ãããªåœ¢ã§æžãããšãäžè¬çã§ãã
if (æ¡ä»¶1 && æ¡ä»¶2) {
// æ¡ä»¶1ãšæ¡ä»¶2ãå
±ã«çã®å Žåã®åŠç
}
if (æ¡ä»¶1 || æ¡ä»¶2) {
// æ¡ä»¶1ãŸãã¯æ¡ä»¶2ãçã®å Žåã®åŠç
}
if (!æ¡ä»¶) {
// æ¡ä»¶ãåœã®å Žåã®åŠç
}
è«çæŒç®åã®å©çšã·ãŒã³
è«çæŒç®åã¯ãæ¡ä»¶ã®çµã¿åãããè€éã«ãªãå Žåã«ç¹ã«æå¹ã§ããäŸãã°ã幎霢ã20æ³ä»¥äžãã€èº«é·ã160cm以äžã®äººã®ã¿ã察象ãšããåŠçãè¡ãããå ŽåãANDæŒç®åã䜿ã£ãŠ2ã€ã®æ¡ä»¶ãåæã«è©äŸ¡ããããšãå¯èœã§ãã
è«çæŒç®åãç解ã掻çšããããšã¯ãCèšèªã§ã®æ¡ä»¶åŠçãå¹æçã«è¡ãããã®ç¬¬äžæ©ã§ãã次ã®ã»ã¯ã·ã§ã³ã§ã¯ãCèšèªã«ãããå ·äœçãªè«çæŒç®åã®äœ¿ãæ¹ã«ã€ããŠãããã«è©³ããèŠãŠãããŸãããã
3. Cèšèªã®äž»èŠãªè«çæŒç®åãšãã®äœ¿ãæ¹
Cèšèªã§ãã䜿ãããè«çæŒç®åã«ã¯ãè«çç©ïŒANDïŒãè«çåïŒORïŒãè«çåŠå®ïŒNOTïŒã®3ã€ããããããããç°ãªãæ¡ä»¶ã®è©äŸ¡ã«çšããããŸããããã§ã¯ãåè«çæŒç®åã®äœ¿ãæ¹ãšå ·äœäŸã«ã€ããŠè©³ããèŠãŠãããŸãããã
3.1 è«çç©ïŒANDïŒæŒç®åïŒ&&
è«çç©æŒç®åïŒ&&
ïŒã¯ã2ã€ã®æ¡ä»¶ãã©ã¡ãããçãã®å Žåã«ãçããè¿ããŸããäž¡æ¹ã®æ¡ä»¶ãæç«ããŠãããšãã®ã¿åŠçãè¡ãå Žåã«äŸ¿å©ã§ãã
䜿çšäŸ
#include <stdio.h>
int main() {
int age = 25;
int height = 170;
if (age >= 20 && height >= 160) {
printf("æ¡ä»¶ã«äžèŽããŸããã
");
} else {
printf("æ¡ä»¶ã«äžèŽããŸããã§ããã
");
}
return 0;
}
解説
ãã®ã³ãŒãã§ã¯ã幎霢ã20æ³ä»¥äžãã€èº«é·ã160cm以äžã®å Žåã«æ¡ä»¶ãæºãããããæ¡ä»¶ã«äžèŽããŸãããããšè¡šç€ºãããŸãããããã1ã€ã§ãæ¡ä»¶ãæºãããŠããªãå Žåã¯ãæ¡ä»¶ã«äžèŽããŸããã§ããããã衚瀺ãããŸãã
3.2 è«çåïŒORïŒæŒç®åïŒ||
è«çåæŒç®åïŒ||
ïŒã¯ãããããäžæ¹ã®æ¡ä»¶ããçãã§ããã°ãçããè¿ããŸããã©ã¡ããäžæ¹ã®æ¡ä»¶ãæç«ããŠããã°åŠçãè¡ãå Žåã«é©ããŠããŸãã
䜿çšäŸ
#include <stdio.h>
int main() {
int age = 18;
int student = 1; // 1ã¯ãåŠçã§ããããè¡šããã©ã°ãšããŸã
if (age >= 20 || student == 1) {
printf("å²åŒãé©çšãããŸãã
");
} else {
printf("å²åŒå¯Ÿè±¡å€ã§ãã
");
}
return 0;
}
解説
ãã®ã³ãŒãã§ã¯ã幎霢ã20æ³ä»¥äžãŸãã¯åŠçã§ããã°ãå²åŒãé©çšãããŸããããšè¡šç€ºãããŸãã幎霢ã20æ³æªæºã§ããããã€åŠçã§ããªãå Žåã«ã¯ãå²åŒå¯Ÿè±¡å€ã§ããããšè¡šç€ºãããŸãã
3.3 è«çåŠå®ïŒNOTïŒæŒç®åïŒ!
è«çåŠå®æŒç®åïŒ!
ïŒã¯ãæ¡ä»¶ã®çåœãå転ããã圹å²ãæã¡ãŸããå
·äœçã«ã¯ãæ¡ä»¶ããçãã§ããã°ãåœãã«ãæ¡ä»¶ããåœãã§ããã°ãçãã«è©äŸ¡ãããŸããæ¡ä»¶ãæç«ããŠããªãå Žåã«ç¹å®ã®åŠçãè¡ããããšãã«äŸ¿å©ã§ãã
䜿çšäŸ
#include <stdio.h>
int main() {
int registered = 0; // 0ã¯ãæªç»é²ããè¡šã
if (!registered) {
printf("æªç»é²ã®ãŠãŒã¶ãŒã§ãã
");
} else {
printf("ç»é²æžã¿ã®ãŠãŒã¶ãŒã§ãã
");
}
return 0;
}
解説
ãã®ã³ãŒãã§ã¯ããæªç»é²ããæå³ããregistered
ã0ã§ãããããè«çåŠå®æŒç®å!
ã«ãã£ãŠæ¡ä»¶ããçããšè©äŸ¡ããããæªç»é²ã®ãŠãŒã¶ãŒã§ããããšè¡šç€ºãããŸããããregistered
ã1ïŒç»é²æžã¿ïŒã§ããã°ããç»é²æžã¿ã®ãŠãŒã¶ãŒã§ãããã衚瀺ãããŸãã
3.4 è«çæŒç®åã®æŽ»çšäŸãŸãšã
è«çæŒç®åã¯ãæ¡ä»¶ã®çµã¿åãããçšãããšãã«éåžžã«åœ¹ç«ã¡ãŸããè€éãªæ¡ä»¶ãç°¡æœã«è¡šçŸã§ããã³ãŒãã®å¯èªæ§ãé«ãŸããŸãããŸããè«çç©ãè«çåãè«çåŠå®ã®3ã€ã®æŒç®åãçµã¿åãããŠäœ¿çšããããšã§ãããã«æè»ãªæ¡ä»¶èšå®ãå¯èœã«ãªããŸãã
4. è«çæŒç®åã®åªå é äœãšçµåèŠå
Cèšèªã§ã¯ãè€æ°ã®æŒç®åã䜿çšããè€éãªæ¡ä»¶åŒãçµã¿ç«ãŠãããšãå€ã ãããŸãããã®éãæŒç®åã®åªå é äœãšçµåèŠåãç解ããŠããªããšãæå³ããªãè©äŸ¡çµæãåºãããšããããŸããããã§ã¯ãè«çæŒç®åã®åªå é äœãšçµåèŠåã«ã€ããŠè©³ãã説æããæ£ããæ¡ä»¶åŒãè©äŸ¡ããããã®ãã€ã³ããåŠã³ãŸãã
4.1 è«çæŒç®åã®åªå é äœ
Cèšèªã«ãããè«çæŒç®åã®åªå é äœã¯ä»¥äžã®ããã«ãªããŸãïŒäžããé ã«é«ãé ïŒã
- è«çåŠå®ïŒNOTïŒæŒç®åïŒ
!
- è«çç©ïŒANDïŒæŒç®åïŒ
&&
- è«çåïŒORïŒæŒç®åïŒ
||
ããã«ãããæ¡ä»¶åŒã®äžã§è€æ°ã®è«çæŒç®åã䜿ãããŠããå Žåã!
â &&
â ||
ã®é ã§è©äŸ¡ãããŸãã
äŸïŒ
#include <stdio.h>
int main() {
int a = 1;
int b = 0;
int c = 1;
if (!a || b && c) {
printf("æ¡ä»¶ãçãšè©äŸ¡ãããŸããã
");
} else {
printf("æ¡ä»¶ãåœãšè©äŸ¡ãããŸããã
");
}
return 0;
}
解説
ãã®äŸã§ã¯ã!a
ãæåã«è©äŸ¡ãããŸãïŒa
ã1ãªã®ã§!a
ã¯0ïŒã次ã«b && c
ãè©äŸ¡ãããb
ã0ã§ããããb && c
ã¯0ã§ããæçµçã«ã0 || 0
ãè©äŸ¡ãããŠæ¡ä»¶ã¯ãåœããšãªãããæ¡ä»¶ãåœãšè©äŸ¡ãããŸããããã衚瀺ãããŸãã
4.2 çµåèŠå
è«çæŒç®åã®çµåèŠåã¯ã以äžã®ããã«ãªã£ãŠããŸãã
- è«çåŠå®ïŒNOTïŒæŒç®åïŒ
!
ã¯å³ããå·Šãžã®çµåæ§ãæã¡ãŸãã - è«çç©ïŒANDïŒæŒç®åïŒ
&&
ã¯å·Šããå³ãžã®çµåæ§ãæã¡ãŸãã - è«çåïŒORïŒæŒç®åïŒ
||
ãå·Šããå³ãžã®çµåæ§ãæã¡ãŸãã
çµåèŠåã«ãããåãåªå é äœã®æŒç®åãé£ç¶ããŠããå Žåãè©äŸ¡ã¯å·Šããå³ã®é ã§è¡ãããŸãã
äŸïŒ
#include <stdio.h>
int main() {
int a = 1;
int b = 1;
int c = 0;
if (a && b || c) {
printf("æ¡ä»¶ãçãšè©äŸ¡ãããŸããã
");
} else {
printf("æ¡ä»¶ãåœãšè©äŸ¡ãããŸããã
");
}
return 0;
}
解説
ãã®å Žåãa && b
ãå
ã«è©äŸ¡ãããäž¡æ¹ã1ïŒçïŒãªã®ã§a && b
ã¯1ã«ãªããŸãã次ã«ã1 || c
ãè©äŸ¡ãããc
ã0ïŒåœïŒã§ãã£ãŠã||
æŒç®åã«ããæ¡ä»¶ã¯ãçããšè©äŸ¡ããããæ¡ä»¶ãçãšè©äŸ¡ãããŸããããã衚瀺ãããŸãã
4.3 æŒç®åã®åªå é äœãšçµåèŠåã䜿çšããæ£ããè©äŸ¡
è€éãªæ¡ä»¶åŒã䜿çšããéã«ã¯ãæŒç®åã®åªå
é äœãšçµåèŠåã«æ³šæããªããšãäºæããªãè©äŸ¡çµæãåºãããšããããŸããç¹ã«ãè€æ°ã®è«çæŒç®åãçµã¿åãããå Žåã«ã¯ãé©åã«æ¬åŒ§()
ã䜿ã£ãŠæ¡ä»¶ãæ瀺ããããšãéèŠã§ãã
äŸïŒ
#include <stdio.h>
int main() {
int a = 1;
int b = 0;
int c = 1;
if ((a || b) && c) {
printf("æ¡ä»¶ãçãšè©äŸ¡ãããŸããã
");
} else {
printf("æ¡ä»¶ãåœãšè©äŸ¡ãããŸããã
");
}
return 0;
}
解説
ãã®ã³ãŒãã§ã¯ãæ¬åŒ§ã䜿çšããŠè©äŸ¡ã®é åºãæ瀺ããŠããŸããa || b
ãå
ã«è©äŸ¡ãããa
ã1ãªã®ã§a || b
ã¯1ã«ãªããŸãã次ã«ã1 && c
ãè©äŸ¡ãããc
ã1ãªã®ã§æ¡ä»¶å
šäœããçããšãªãããæ¡ä»¶ãçãšè©äŸ¡ãããŸããããã衚瀺ãããŸãã
4.4 æŒç®ååªå é äœã«é¢ãããã€ã³ã
- è€éãªæ¡ä»¶åŒã§ã¯æ¬åŒ§ãç©æ¥µçã«äœ¿ããæå³ããè©äŸ¡é ãæ確ã«ããããšãéèŠã§ãã
- åªå é äœãæ··ä¹±ããå Žåã¯ãæ¬åŒ§ã䜿ãããšã§ã³ãŒãã®å¯èªæ§ãåäžãã誀解ãé²ãããããªããŸãã
- ãããã°æã«ã¯ãæ¡ä»¶åŒã®è©äŸ¡çµæãåå¥ã«ç¢ºèªããæå³ããè©äŸ¡ãè¡ãããŠããã確èªãããšè¯ãã§ãããã
5. å ·äœçãªäœ¿çšäŸïŒæ¡ä»¶åå²ãã«ãŒãã§ã®è«çæŒç®åã®æŽ»çš
Cèšèªã®è«çæŒç®åã¯ãããã°ã©ã ã®åäœãå¶åŸ¡ããããã®éèŠãªåœ¹å²ãæãããŸããç¹ã«ãifæãwhileã«ãŒããšçµã¿åãããããšã§ãè€æ°ã®æ¡ä»¶ãæè»ã«èšå®ããå¿ èŠãªæ¡ä»¶ãæç«ããå Žåã«ã®ã¿åŠçãè¡ãããšãã§ããŸããããã§ã¯ãè«çæŒç®åã䜿ã£ãå ·äœçãªã³ãŒãäŸã玹ä»ããã©ã®ããã«æ¡ä»¶åå²ãã«ãŒãã®äžã§æŽ»çšã§ãããã解説ããŸãã
5.1 è«çæŒç®åã䜿ã£ãæ¡ä»¶åå²ïŒifæïŒ
ifæã§è«çæŒç®åã䜿çšããããšã§ãè€æ°ã®æ¡ä»¶ãçµã¿åãããŠæ¡ä»¶åå²ãè¡ãããšãå¯èœã§ããäŸãã°ããŠãŒã¶ãŒã幎霢æ¡ä»¶ãšäŒå¡ã¹ããŒã¿ã¹ã®äž¡æ¹ãæºãããŠãããã確èªããéã«ANDæŒç®åã掻çšã§ããŸãã
䜿çšäŸ
#include <stdio.h>
int main() {
int age = 22;
int is_member = 1; // 1ã¯ãäŒå¡ã§ããããæå³ãã
if (age >= 18 && is_member == 1) {
printf("ãµãŒãã¹ãå©çšã§ããŸãã
");
} else {
printf("ãµãŒãã¹ãå©çšã§ããŸããã
");
}
return 0;
}
解説
ãã®ã³ãŒãã§ã¯ã幎霢ã18æ³ä»¥äžãã€äŒå¡ã§ããå Žåã«ãµãŒãã¹ãå©çšã§ãããšå€æããŠããŸããæ¡ä»¶ãäž¡æ¹ãšãæç«ããå Žåã«ã®ã¿ããµãŒãã¹ãå©çšã§ããŸããããšè¡šç€ºãããŸããããããäžæ¹ã®æ¡ä»¶ãæºããããŠããªãå Žåã«ã¯ãããµãŒãã¹ãå©çšã§ããŸããããã衚瀺ãããŸãã
5.2 è«çæŒç®åã䜿ã£ãæ¡ä»¶åå²ïŒif-elseæïŒ
ORæŒç®åã䜿çšãããšãããããäžæ¹ã®æ¡ä»¶ãæç«ããŠãããã©ããã確èªã§ããŸããäŸãã°ãå²åŒãé©çšããæ¡ä»¶ãã幎霢ã65æ³ä»¥äžããŸãã¯ãåŠçã§ãããå Žåã«ãããããã®æ¡ä»¶ãçµã¿åãããããšãã§ããŸãã
䜿çšäŸ
#include <stdio.h>
int main() {
int age = 20;
int is_student = 1; // 1ã¯ãåŠçã§ããããæå³ãã
if (age >= 65 || is_student == 1) {
printf("å²åŒãé©çšãããŸãã
");
} else {
printf("å²åŒã¯é©çšãããŸããã
");
}
return 0;
}
解説
ãã®ã³ãŒãã§ã¯ã幎霢ã65æ³ä»¥äžãŸãã¯åŠçã§ããå Žåã«å²åŒãé©çšããããšå€æããŠããŸããããããäžæ¹ã®æ¡ä»¶ãæç«ããã°ãå²åŒãé©çšãããŸãããã衚瀺ãããã©ã¡ãã®æ¡ä»¶ãæºãããªãå Žåã¯ãå²åŒã¯é©çšãããŸãããããšè¡šç€ºãããŸãã
5.3 è«çæŒç®åã䜿ã£ãã«ãŒãæ¡ä»¶ïŒwhileã«ãŒãïŒ
whileã«ãŒãã§ã¯ãæ¡ä»¶ããçãã§ããéãã«ãŒããç¶è¡ãããŸããè«çæŒç®åã䜿ã£ãŠè€æ°ã®æ¡ä»¶ãåæã«æºããããå Žåããããããäžæ¹ãæºããããå Žåã«ã«ãŒããå¶åŸ¡ããããšãå¯èœã§ãã
䜿çšäŸ
#include <stdio.h>
int main() {
int count = 0;
int limit = 5;
while (count < limit && count != 3) {
printf("ã«ãŠã³ã: %d
", count);
count++;
}
printf("ã«ãŒãçµäºã
");
return 0;
}
解説
ãã®ã³ãŒãã§ã¯ãcount
ãlimit
æªæºã§ããã€count
ã3ã§ã¯ãªãå Žåã«ã«ãŒããç¶è¡ãããŸããã«ãŒãå
ã§ã¯count
ã®å€ãæ¯åã€ã³ã¯ãªã¡ã³ããããcount
ã3ã«ãªããã5以äžã«ãªããšã«ãŒããçµäºãããã«ãŒãçµäºãããšè¡šç€ºãããŸãããã®ããã«ANDæŒç®åã䜿ãããšã§ã2ã€ã®æ¡ä»¶ãåæã«æºãããŸã§ã«ãŒããç¶è¡ã§ããŸãã
5.4 è«çæŒç®åãçµã¿åãããè€éãªæ¡ä»¶èšå®
è€æ°ã®è«çæŒç®åãçµã¿åãããããšã§ãè€éãªæ¡ä»¶åŒãäœæããããšãå¯èœã§ããäŸãã°ãç¹å®ã®æ¡ä»¶ãæºããå Žåã«ã®ã¿ç¹å®ã®ã¢ã¯ã·ã§ã³ãå®è¡ããããã«ãããå Žåã«ãè«çæŒç®åãããŸã掻çšã§ããŸãã
䜿çšäŸ
#include <stdio.h>
int main() {
int age = 30;
int income = 500000;
int is_member = 1;
if ((age > 25 && income >= 300000) || is_member == 1) {
printf("ç¹å
žãé©çšãããŸãã
");
} else {
printf("ç¹å
žã¯é©çšãããŸããã
");
}
return 0;
}
解説
ãã®ã³ãŒãã§ã¯ã幎霢ã25æ³ä»¥äžã§åå
¥ã300,000å以äžã§ããå ŽåããŸãã¯äŒå¡ã§ããå Žåã«ãç¹å
žãé©çšãããŸããããšè¡šç€ºãããŸãããã®ããã«ANDããã³ORæŒç®åãçµã¿åãããããšã§ãè€æ°ã®æ¡ä»¶ãæè»ã«èšå®ããããšãã§ããŸãã
5.5 æ¡ä»¶åå²ãšã«ãŒãã§ã®è«çæŒç®åã®æŽ»çšãŸãšã
è«çæŒç®åã¯ãifæãwhileã«ãŒãã§è€æ°ã®æ¡ä»¶ãèšå®ããããã°ã©ã ã®æµããæè»ã«å¶åŸ¡ããããã«éåžžã«æå¹ã§ããè€æ°ã®æ¡ä»¶ãçµã¿åãããããšã§ãæ¡ä»¶åå²ãå€æ§åããè€éãªæ¡ä»¶ã«å¿ããåŠçãè¡ãããšãå¯èœã«ãªããŸããè«çæŒç®åãå¹æçã«äœ¿ãããªãããšã§ãããå¹ççã§ããããããã³ãŒããæžãããšãã§ããã§ãããã
6. è«çæŒç®åãšãããæŒç®åã®éã
Cèšèªã§ã¯ãè«çæŒç®åãšãããæŒç®åããããã©ã¡ãã䌌ããããªèšå·ã䜿ããŸããããã®åäœã䜿ãæ¹ã«ã¯å€§ããªéãããããŸããåå¿è
ã®ãã¡ã¯ãç¹ã«&&
ãš&
ã||
ãš|
ãæ··åãããããããããããã®éããç解ããŠæ£ãã䜿ãåããããšãéèŠã§ãããã®ã»ã¯ã·ã§ã³ã§ã¯ãè«çæŒç®åãšãããæŒç®åã®éãã«ã€ããŠè§£èª¬ããæ··ä¹±ãé¿ããããã®ãã€ã³ãã玹ä»ããŸãã
6.1 è«çæŒç®åãšãããæŒç®åã®åºæ¬çãªéã
è«çæŒç®åãšãããæŒç®åã®éãããŸãšãããšã以äžã®ããã«ãªããŸãã
- è«çæŒç®åïŒ
&&
ã||
ã!
ïŒ
è«çæŒç®åã¯æ¡ä»¶åŒã®ãçãïŒTrueïŒãŸãã¯ãåœãïŒFalseïŒãè©äŸ¡ããŸããéåžžãæ¡ä»¶åå²ãã«ãŒãã®æ¡ä»¶èšå®ã«äœ¿ãããè€æ°ã®æ¡ä»¶ãçµã¿åãããŠå€æããããã«çšããããŸãã - ãããæŒç®åïŒ
&
ã|
ã~
ã^
ãªã©ïŒ
ãããæŒç®åã¯ãæŽæ°ã®ãããããšã®æŒç®ãè¡ããŸãããããæŒç®ã¯ããããã¬ãã«ã§æ°å€ãæäœããããšããããã¹ã¯åŠçãªã©ã®äœã¬ãã«ã®æäœãè¡ããããšãã«äœ¿çšãããŸãã
6.2 è«çç©ïŒANDïŒæŒç®åãšãããANDæŒç®åã®éã
- è«çç©ïŒANDïŒæŒç®å
&&
2ã€ã®æ¡ä»¶ãã©ã¡ãããçãã®å Žåã«ãçããšè©äŸ¡ãããŸããifæãwhileæã®æ¡ä»¶ãšããŠäœ¿çšããå Žåãæ¡ä»¶ã®æç«ãåŠå®ã確èªããããã«äœ¿ãããŸãã - ãããANDæŒç®å
&
2ã€ã®æŽæ°ã®ãããããšã«ANDæŒç®ãè¡ããäž¡æ¹ã®ãããã1ã®ç®æã ãã1ã«ãªããŸãããããæŒç®ã§çšãããããæ¡ä»¶ã®çåœãšã¯ç°ãªãçµæãåŸãããšãã§ããŸãã
䜿çšäŸïŒ
#include <stdio.h>
int main() {
int a = 6; // 6ã¯äºé²æ°ã§ 0110
int b = 3; // 3ã¯äºé²æ°ã§ 0011
if (a && b) {
printf("è«çANDïŒæ¡ä»¶ãçã§ãã
");
}
int result = a & b;
printf("ãããANDã®çµæïŒ%d
", result); // çµæ㯠2ïŒäºé²æ°ã§0010ïŒ
return 0;
}
解説
ãã®äŸã§ã¯ãa && b
ã¯äž¡æ¹ã®å€æ°ãéãŒããªã®ã§ãçããšè©äŸ¡ããããè«çANDïŒæ¡ä»¶ãçã§ãããã衚瀺ãããŸããäžæ¹ãa & b
ã¯ãããããšã®ANDæŒç®ãè¡ããããçµæã¯2
ïŒäºé²æ°ã§0010
ïŒãšãªããŸãããã®ããã«ã&&
ãš&
ã¯åãããã«èŠããŸãããåŠçã®å
容ãç°ãªãç¹ã«æ³šæãå¿
èŠã§ãã
6.3 è«çåïŒORïŒæŒç®åãšãããORæŒç®åã®éã
- è«çåïŒORïŒæŒç®å
||
ããããäžæ¹ã®æ¡ä»¶ããçãã®å Žåã«ãçããšè©äŸ¡ãããŸããéåžžãæ¡ä»¶åå²ã§ã®æ¡ä»¶çµã¿åããã«äœ¿ãããŸãã - ãããORæŒç®å
|
2ã€ã®æŽæ°ã®ãããããšã«ORæŒç®ãè¡ããã©ã¡ããã®ãããã1ã§ããã°1ã«ãªããŸãããããåäœã®æŒç®åŠçã«äœ¿çšãããŸãã
䜿çšäŸïŒ
#include <stdio.h>
int main() {
int a = 6; // 6ã¯äºé²æ°ã§ 0110
int b = 3; // 3ã¯äºé²æ°ã§ 0011
if (a || b) {
printf("è«çORïŒæ¡ä»¶ãçã§ãã
");
}
int result = a | b;
printf("ãããORã®çµæïŒ%d
", result); // çµæ㯠7ïŒäºé²æ°ã§0111ïŒ
return 0;
}
解説
ãã®äŸã§ã¯ãa || b
ã¯å°ãªããšã1ã€ã®å€æ°ãéãŒãã§ãããããçããšè©äŸ¡ããããè«çORïŒæ¡ä»¶ãçã§ãããã衚瀺ãããŸããäžæ¹ãa | b
ã¯ãããããšã®ORæŒç®ãè¡ããããçµæã¯7
ïŒäºé²æ°ã§0111
ïŒãšãªããŸãããã®ããã«ã||
ãš|
ãæå³ãç°ãªãã®ã§ã䜿ãåãã«æ³šæãå¿
èŠã§ãã
6.4 ãããæŒç®åã®æŽ»çšã·ãŒã³
ãããæŒç®åã¯ãäœã¬ãã«ã®ããã°ã©ãã³ã°ãå¹çæ§ãæ±ããããå Žé¢ã§ãã䜿çšãããŸããäŸãã°ãããŒã¿ã®äžéšã ããååŸãããããã©ã°ç®¡çã§è€æ°ã®ç¶æ ã1ã€ã®å€æ°ã§ç®¡çãããããå Žåã«äŸ¿å©ã§ãã
äŸïŒãã¹ã¯åŠç
#include <stdio.h>
int main() {
int flags = 0b1010; // 2é²æ°ã§1010
int mask = 0b0010; // 2é²æ°ã§0010
int result = flags & mask;
if (result) {
printf("ç¹å®ã®ããããç«ã£ãŠããŸãã
");
} else {
printf("ãããã¯ç«ã£ãŠããŸããã
");
}
return 0;
}
ãã®ã³ãŒãã§ã¯ãflags
å€æ°ã®ç¹å®ã®ãããïŒããã§ã¯2ãããç®ïŒãç«ã£ãŠãããã確èªããããã«ãããANDæŒç®åã䜿çšããŠããŸãããã®ãããªãã¹ã¯åŠçã¯ãå¹ççãªããŒã¿ç®¡çããã©ã°ãã§ãã¯ã«éåžžã«äŸ¿å©ã§ãã
6.5 è«çæŒç®åãšãããæŒç®åãæ··åããªãããã®ãã€ã³ã
&&
ã||
ã¯æ¡ä»¶æã§äœ¿ããçåœã確èªããããã«çšããŸããäžæ¹ã&
ã|
ã¯æ°å€ã®ãããããšã®æäœã«äœ¿ããããç°ãªãçšéãšããŠæ確ã«åºå¥ããŸãããã- æ¡ä»¶åå²ã§ãããæŒç®åã䜿çšãããšãæå³ããªãçµæãåŸãããå¯èœæ§ããããŸããåžžã«è«çæŒç®åãšãããæŒç®åã®éããæèããŠäœ¿ãåããŸãããã
7. ãããã誀ããšæ³šæç¹
Cèšèªã®è«çæŒç®åã¯æ¡ä»¶å€æã®ããã«äŸ¿å©ãªããŒã«ã§ããã誀çšãç解äžè¶³ã«ããæå³ããªãåäœãåŒãèµ·ããããšããããŸããããã§ã¯ãè«çæŒç®åã®äœ¿çšã«ããããããã誀ããšããããé¿ããããã®æ³šæç¹ã解説ããŸãã
7.1 è«çæŒç®åãšãããæŒç®åã®æ··å
æãäžè¬çãªèª€ãã®äžã€ã¯ãè«çæŒç®åãšãããæŒç®åãæ··åããŠããŸãããšã§ããäŸãã°ã&&
ïŒè«çç©ïŒãš&
ïŒãããANDïŒã||
ïŒè«çåïŒãš|
ïŒãããORïŒãééã£ãŠäœ¿ããšãæ¡ä»¶è©äŸ¡ãæåŸ
éãã«åäœããŸããã
äŸïŒ
#include <stdio.h>
int main() {
int a = 1; // ç
int b = 0; // åœ
// 誀çšäŸïŒ& ã && ãšããŠäœ¿ãã¹ã
if (a & b) {
printf("æ¡ä»¶ãçã§ãã
");
} else {
printf("æ¡ä»¶ãåœã§ãã
");
}
return 0;
}
解説
ãã®äŸã§ã¯ãa & b
ããããANDæŒç®åãšããŠè©äŸ¡ããããããæå³ããçµæãåŸãããŸããããã®å Žåã¯&&
ã䜿ãã¹ãã§ãããif (a && b)
ãšèšè¿°ããããšã§ãæ¡ä»¶ãæ£ããè©äŸ¡ãããŸããæ¡ä»¶æã§ã¯è«çæŒç®åãããããåäœã®åŠçã«ã¯ãããæŒç®åã䜿ãããšãæèããŸãããã
7.2 æ¡ä»¶æã§ã®ä»£å ¥æŒç®åïŒ=ïŒã®èª€çš
æ¡ä»¶åŒã®äžã§ãæ¯èŒæŒç®å==
ãšä»£å
¥æŒç®å=
ã誀ã£ãŠäœ¿çšããããšãäžè¬çãªãã¹ã§ãããã®å Žåãæå³ããå€æ°ã«å€ã代å
¥ããŠããŸããæ¡ä»¶ã®è©äŸ¡ãåžžã«ãçãã«ãªã£ãŠããŸãããšããããŸãã
äŸïŒ
#include <stdio.h>
int main() {
int a = 5;
// 誀çšäŸïŒ== ãšãã¹ããšãã㧠= ã䜿çš
if (a = 0) {
printf("a 㯠0 ã§ãã
");
} else {
printf("a 㯠0 ã§ã¯ãããŸããã
");
}
return 0;
}
解説
ãã®ã³ãŒãã§ã¯ãa = 0
ã«ããå€æ°a
ã«0ã代å
¥ããããã®çµæãè©äŸ¡ããããããæ¡ä»¶ããåœããšãªããa 㯠0 ã§ã¯ãããŸããããã衚瀺ãããŸããæå³éãã«æ¯èŒãè¡ãããå Žåã¯ãif (a == 0)
ãšèšè¿°ããŠæ¯èŒæŒç®åã䜿ããŸãããã
7.3 æ¡ä»¶åŒã®åªå é äœãèæ ®ããªãèšè¿°
è«çæŒç®åãå«ãè€éãªæ¡ä»¶åŒã§ã¯ãæŒç®åã®åªå é äœã«æ³šæãå¿ èŠã§ããæŒç®åã®åªå é äœãèæ ®ããã«æ¡ä»¶åŒãæžããšãè©äŸ¡ãæå³ãšç°ãªãçµæã«ãªãããšããããŸãã
äŸïŒ
#include <stdio.h>
int main() {
int x = 5;
int y = 0;
int z = 10;
// åªå
é äœã«æ³šæãå¿
èŠ
if (x > 3 || y && z > 5) {
printf("æ¡ä»¶ãçã§ãã
");
} else {
printf("æ¡ä»¶ãåœã§ãã
");
}
return 0;
}
解説
ãã®ã³ãŒãã§ã¯ã||
ãš&&
ã®åªå
é äœã«ãããy && z > 5
ãå
ã«è©äŸ¡ãããŸããæå³ããçµæãåŸãããã«ã¯ãæ¡ä»¶åŒãæ¬åŒ§()
ã§æ瀺çã«æ¬ããif ((x > 3 || y) && z > 5)
ã®ããã«ããããšã§ãåªå
é äœãæ確ã«ã§ããŸããè€éãªæ¡ä»¶åŒã§ã¯æ¬åŒ§ã䜿çšããæå³ããè©äŸ¡é ãæå®ããããšãå¿ãããŸãããã
7.4 ç絡è©äŸ¡ïŒã·ã§ãŒããµãŒãããè©äŸ¡ïŒã®ç解äžè¶³
è«çæŒç®å&&
ã||
ã¯ãç絡è©äŸ¡ïŒã·ã§ãŒããµãŒãããè©äŸ¡ïŒããšåŒã°ããç¹æ§ãæã£ãŠããŸããããã¯ãæ¡ä»¶åŒã®è©äŸ¡ãæ©æã«çµäºãããšããç¹æ§ã§ããç絡è©äŸ¡ãç解ããŠããªããšãç¹ã«å¯äœçšã䌎ãåŒã䜿ãå Žåã«æå³ããªãåäœãåŒãèµ·ããå¯èœæ§ããããŸãã
&&
ïŒæåã®æ¡ä»¶ããåœãã®å ŽåãåŸç¶ã®æ¡ä»¶ã¯è©äŸ¡ãããŸããã||
ïŒæåã®æ¡ä»¶ããçãã®å ŽåãåŸç¶ã®æ¡ä»¶ã¯è©äŸ¡ãããŸããã
äŸïŒ
#include <stdio.h>
int main() {
int a = 0;
int b = 5;
if (a && (b++ > 0)) {
printf("æ¡ä»¶ãçã§ãã
");
} else {
printf("æ¡ä»¶ãåœã§ãã
");
}
printf("b ã®å€: %d
", b);
return 0;
}
解説
ãã®äŸã§ã¯ãa
ã0ïŒåœïŒã§ãããããç絡è©äŸ¡ã«ããb++ > 0
ã¯è©äŸ¡ãããŸããããã®ãããb
ã®å€ã¯å€åãããæçµçã«ãæ¡ä»¶ãåœã§ããããšè¡šç€ºãããb ã®å€
ã¯5ã®ãŸãŸãšãªããŸããç絡è©äŸ¡ãçºçããããšãç解ããŠãæ¡ä»¶åŒã«å¯äœçšã®ããåŠçãçµã¿èŸŒãå Žåã¯æ³šæããŸãããã
7.5 ãããã誀ããšæ³šæç¹ã®ãŸãšã
- è«çæŒç®åãšãããæŒç®åãæ··åããªã
&&
ãš&
ã||
ãš|
ã®éããç解ããæå³éãã«äœ¿ãåããããšãéèŠã§ãã - 代å
¥æŒç®åãšæ¯èŒæŒç®åãæ··åããªã
=
ãš==
ã¯ãŸã£ããç°ãªãæå³ãæã€ãããæ¡ä»¶åŒã§ã®èšè¿°ã«æ³šæããŸãããã - åªå
é äœãšæ¬åŒ§ã®å©çš
è€éãªæ¡ä»¶åŒã§ã¯ãæ¬åŒ§ã䜿çšããŠæå³ããè©äŸ¡é åºãæ瀺ããŸãããã - ç絡è©äŸ¡ã®ç解
ç絡è©äŸ¡ãçºçããæ¡ä»¶åŒã§ã¯ãè©äŸ¡ãããªãåŒãããããšãèæ ®ããŠèšè¿°ããããšãéèŠã§ãã
8. FAQïŒè«çæŒç®åã«é¢ãããããã質å
è«çæŒç®åã«ã€ããŠã¯ãåå¿è ã®æ¹ãããã質åãå¯ããããŸããããã§ã¯ãCèšèªã«ãããè«çæŒç®åã«é¢ããããããçåã«ãçããããããªãç解ãæ·±ããããã®ãã€ã³ãã解説ããŸãã
Q1. Cèšèªã§è«çæŒç®åã䜿ã£ãŠè€æ°ã®æ¡ä»¶ãçµã¿åãããæ¹æ³ã¯ïŒ
A: Cèšèªã§ã¯ãè«çæŒç®å&&
ïŒANDïŒã||
ïŒORïŒã䜿ã£ãŠè€æ°ã®æ¡ä»¶ãçµã¿åãããããšãå¯èœã§ããäŸãã°ã幎霢ãšèº«åãç¹å®ã®æ¡ä»¶ãæºããå Žåã«ã ãåŠçãå®è¡ããå Žåã«äœ¿çšããŸãã
äŸïŒ
#include <stdio.h>
int main() {
int age = 20;
int is_student = 1;
if (age >= 18 && is_student == 1) {
printf("æ¡ä»¶ãæºãããŠããŸãã
");
} else {
printf("æ¡ä»¶ãæºãããŠããŸããã
");
}
return 0;
}
ãã®ã³ãŒãã§ã¯ã幎霢ã18æ³ä»¥äžãã€åŠçã§ããå Žåã«æ¡ä»¶ãæç«ãããæ¡ä»¶ãæºãããŠããŸããããšè¡šç€ºãããŸããè€æ°ã®æ¡ä»¶ãèšå®ããéã«ã¯ãANDæŒç®åãORæŒç®åã䜿ã£ãŠå¿ èŠãªæ¡ä»¶ãçµã¿åããããšå¹æçã§ãã
Q2. è«çæŒç®åãšãããæŒç®åã®éããç°¡åã«èª¬æããŠãã ããã
A: è«çæŒç®åãšãããæŒç®åã¯èŠãç®ã䌌ãŠããŸãããçšéãç°ãªããŸãã
- è«çæŒç®åïŒ
&&
ã||
ã!
ïŒã¯ãæ¡ä»¶åŒã®çåœãè©äŸ¡ããããã«äœ¿çšãããŸããæ¡ä»¶ããçãããåœãããå€æããã®ãç®çã§ãã - ãããæŒç®åïŒ
&
ã|
ã~
ã^
ïŒã¯ãæŽæ°å€ã®ãããåäœã§ã®æäœãè¡ããŸããç¹å®ã®ãããã ããæäœãããããã©ã°ç®¡çã«äœ¿ãããŸãã
è«çæŒç®åãšãããæŒç®åã¯ç®çãç°ãªããããæ¡ä»¶è©äŸ¡ã«ã¯è«çæŒç®åãããããåäœã®æäœã«ã¯ãããæŒç®åã䜿ããšèŠããŠãããŸãããã
Q3. Cèšèªã®è«çæŒç®åã§åªå é äœãèŠããã³ãã¯ïŒ
A: è«çæŒç®åã®åªå
é äœã¯ä»¥äžã®é ã§ãïŒ!
ïŒNOTïŒ > &&
ïŒANDïŒ > ||
ïŒORïŒããããèŠããããã«ã¯ã次ã®ãããªç°¡åãªã«ãŒã«ã圹ç«ã¡ãŸãã
- NOTãæã匷ãïŒ
!
ã¯åç¬ã§æ¡ä»¶ãå転ãããã®ã§åªå é äœãé«ããšèŠããŸãããã - ANDã¯ORããåªå
ïŒ
&&
ã||
ãããåªå ãããŸããã€ãŸããANDããã匷ãçµã³ã€ããæã£ãŠãããšèŠãããšè¯ãã§ãããã
ãŸããè€éãªæ¡ä»¶åŒã§ã¯åªå
é äœãææ§ã«ãªãå Žåããããããæ¬åŒ§()
ã䜿ã£ãŠæå³ããè©äŸ¡é ãæ確ã«ããããšããå§ãããŸãã
Q4. è«çæŒç®åã®ç絡è©äŸ¡ïŒã·ã§ãŒããµãŒãããè©äŸ¡ïŒãšã¯äœã§ããïŒ
A: ç絡è©äŸ¡ïŒã·ã§ãŒããµãŒãããè©äŸ¡ïŒãšã¯ãè«çæŒç®åã®è©äŸ¡ãæ©æã«çµäºããä»çµã¿ã®ããšã§ãã
- ANDæŒç®åïŒ
&&
ïŒïŒæåã®æ¡ä»¶ããåœãã§ããã°ãåŸç¶ã®æ¡ä»¶ã¯è©äŸ¡ãããŸããã - ORæŒç®åïŒ
||
ïŒïŒæåã®æ¡ä»¶ããçãã§ããã°ãåŸç¶ã®æ¡ä»¶ã¯è©äŸ¡ãããŸããã
äŸãã°ã以äžã®ã³ãŒãã§ã¯ãa
ã0ã§ããããb++
ã¯å®è¡ããããb
ã®å€ã¯å€ãããŸããã
#include <stdio.h>
int main() {
int a = 0;
int b = 5;
if (a && (b++ > 0)) {
printf("æ¡ä»¶ãçã§ãã
");
} else {
printf("æ¡ä»¶ãåœã§ãã
");
}
printf("b ã®å€: %d
", b); // b ã®å€ã¯ 5 ã®ãŸãŸ
return 0;
}
ç絡è©äŸ¡ãçºçããããšãç解ããŠãæ¡ä»¶åŒã«å¯äœçšãæã€ã³ãŒããçµã¿èŸŒãéã¯æ³šæãå¿ èŠã§ãã
Q5. ifæå
ã§==
ã®ä»£ããã«=
ã䜿ããšäœãèµ·ããŸããïŒ
A: æ¡ä»¶åŒã®äžã§=
ïŒä»£å
¥æŒç®åïŒã䜿ã£ãŠããŸããšãå€æ°ã«å€ã代å
¥ããŠããŸããæ¡ä»¶ã®è©äŸ¡çµæã代å
¥ãããå€ã«äŸåããããšã«ãªããŸããéåžžãifæã§ã¯æ¯èŒæŒç®å==
ã䜿çšãããããæå³ãã代å
¥ããŠããŸããªããã泚æãå¿
èŠã§ãã
äŸïŒ
#include <stdio.h>
int main() {
int x = 5;
if (x = 0) { // 誀ã£ãŠä»£å
¥æŒç®åã䜿çš
printf("x 㯠0 ã§ãã
");
} else {
printf("x 㯠0 ã§ã¯ãããŸããã
");
}
return 0;
}
ãã®ã³ãŒãã§ã¯ãx = 0
ã«ããx
ã«0ã代å
¥ãããæ¡ä»¶ããåœããšè©äŸ¡ãããŠããŸããŸããæ¯èŒã®éã«ã¯å¿
ã==
ã䜿ãããšãå¿ãããŸãããã
FAQãŸãšã
ãããŸã§ãCèšèªã®è«çæŒç®åã«é¢ãããããã質åã«ãçãããŸãããè«çæŒç®åã®äœ¿çšã«ããã£ãŠã¯ã䜿ãæ¹ãç¹æ§ããããæŒç®åãšã®éããç解ããããšã§ãããã°ã©ã ã®åäœãæ£ããå¶åŸ¡ã§ããããã«ãªããŸããè«çæŒç®åã¯ãæ¡ä»¶åå²ãã«ãŒãã§ã®æè»ãªå¶åŸ¡ã«æ¬ ãããªãéèŠãªèŠçŽ ã§ãã®ã§ãããã§åŸãç¥èãå®éã®ã³ãŒãã«åœ¹ç«ãŠãŠãã ããã
9. ãŸãšã
ãã®èšäºã§ã¯ãCèšèªã«ãããè«çæŒç®åã«ã€ããŠããã®åºæ¬çãªåœ¹å²ããå ·äœçãªäœ¿ãæ¹ããããã誀ããšæ³šæç¹ãŸã§è©³ãã解説ããŸããã以äžã«ãåŠãã ãã€ã³ããæ¯ãè¿ããŸãã
9.1 è«çæŒç®åã®åºç€ãšçš®é¡
è«çæŒç®åã¯ãæ¡ä»¶ã®ãçãããåœããè©äŸ¡ããããã°ã©ã ã®åå²ãã«ãŒããå¶åŸ¡ããããã®éèŠãªããŒã«ã§ããCèšèªã«ã¯äž»ã«ä»¥äžã®3ã€ã®è«çæŒç®åããããããããã®äœ¿ãæ¹ãç解ããããšã倧åã§ãã
- è«çç©ïŒANDïŒæŒç®åïŒ
&&
2ã€ã®æ¡ä»¶ãã©ã¡ããçã§ããå Žåã«çãè¿ããŸãã - è«çåïŒORïŒæŒç®åïŒ
||
ããããäžæ¹ã®æ¡ä»¶ãçã§ããã°çãè¿ããŸãã - è«çåŠå®ïŒNOTïŒæŒç®åïŒ
!
æ¡ä»¶ã®çåœãå転ããã圹å²ãæã¡ãŸãã
9.2 è«çæŒç®åã®åªå é äœãšçµåèŠå
è«çæŒç®åã«ã¯è©äŸ¡ã®é åºãããã!
ãæãåªå
ããããã®æ¬¡ã«&&
ãæåŸã«||
ãè©äŸ¡ãããŸãããŸããåªå
é äœãæ··ä¹±ããã¡ãªå Žåã¯ãæ¬åŒ§ã䜿ã£ãŠæ瀺çã«è©äŸ¡é ãæå®ããããšã§ã誀解ãé²ãããããªããŸãã
9.3 æ¡ä»¶åå²ãã«ãŒãã§ã®æŽ»çš
è«çæŒç®åã¯ãifæãwhileã«ãŒãã®äžã§è€æ°ã®æ¡ä»¶ãçµã¿åãããŠäœ¿çšããããšã§ãããã°ã©ã ã«æè»ãªåå²ãè¿œå ã§ããŸããè€æ°ã®æ¡ä»¶ã掻çšããããšã§ããŠãŒã¶ãŒã®æ¡ä»¶ã«å¿ãã现ãããªå¶åŸ¡ãå¯èœãšãªããŸãã
9.4 è«çæŒç®åãšãããæŒç®åã®éã
è«çæŒç®åãšãããæŒç®åã¯ç°ãªãç®çãæã£ãŠããŸããæ¡ä»¶ã®çåœãå€æããè«çæŒç®åã«å¯ŸãããããæŒç®åã¯ãããåäœã§ã®æ°å€ã®æäœã«äœ¿çšãããŸãã䌌ãèšå·ã§ã圹å²ãéããããæ··åããªããã泚æãå¿ èŠã§ãã
9.5 ãããã誀ããšæ³šæç¹
è«çæŒç®åã䜿çšããéã«ã¯ãããã€ãã®ãããã誀ãããããŸãã&&
ãš&
ã||
ãš|
ã®æ··åã=
ãš==
ã®ééããç絡è©äŸ¡ã®ç解äžè¶³ãªã©ãåºæ¬çãªèª€ããé¿ããããšã§ãããã°ã©ã ã®æå³ããªãåäœãé²ãããšãã§ããŸãã
9.6 FAQããåŸãããå®è·µçãªç¥è
è«çæŒç®åã®äœ¿ãæ¹ã«ã€ããŠã®ããããçåã解æ¶ããŸãããå ·äœçãªã³ãŒãäŸãéããŠå®éã®äœ¿çšå Žé¢ãåŠã³ãFAQãéããŠã®ç絡è©äŸ¡ãåªå é äœããããæŒç®åãšã®éããç解ããŸããã
æåŸã«
è«çæŒç®åã®æ£ããç解ã¯ãCèšèªããã°ã©ãã³ã°ã«ãããæ¡ä»¶å¶åŸ¡ãã¹ã ãŒãºã«è¡ãããã«æ¬ ãããŸãããè€æ°ã®æ¡ä»¶ãçµã¿åãããæè»ãªããã°ã©ã ãäœæããåã身ã«ã€ããããšã§ãå®è·µçãªã³ãŒããæžããããã«ãªããŸããä»åã®èšäºããCèšèªã«ãããè«çæŒç®åã®ç解ã«åœ¹ç«ã¡ãä»åŸã®ããã°ã©ãã³ã°ã«åœ¹ç«ã€ç¥èã®äžå©ãšãªãããšãé¡ã£ãŠããŸãã