본문 바로가기

728x90

조건문

(8)
C언어 && || 연산법 #include int main(void) { //&& || 연산법 int a = 10; int b = 10; int c = 12; int d = 12; if (a == b && c == d) { printf("a와 b는 같고 c와 d도 같습니다\n"); } else { printf(" 값이 서로 다릅니다.\n"); } } ​ ​
C언어 for - if문 #include int main(void) { // 1번부터 30번까지 있는 반에서 7번 학생은 아파서 결석 // 7번을 제외하고 6번부터 10번까지 조별 발표를 하세요 for (int i = 1; i = 6 && i
C언어 for - if - break 문 #include int main(void) { // break / continue for (int i = 1; i = 6) { printf("나머지 학생은 집에 가세요\n"); break; } printf("%d번 학생은 조별 발표 준비를 하세요 \n", i); } return 0; } 과 ​
C언어 if - else if - else #include int main(void) { int age = 15; if (age >= 8 && age = 14 && age = 17 && age
C언어 조건문 #include int main(void) { int age = 15; if (age > = 20) printf("일반인 입니다."); else printf("학생입니다."); return 0; } ​ 결과
C언어 while 조건문 #include int main(void) { // while 조건 int i = 1; while (i < 10) { printf("Hello world %d\n", i++); } return 0; } 결과 ​ ​
파이썬(python) 조건문 if, in, not in # chapter 04_01 # 파이썬 제어문 # if 실습 # 기본형식 print(type(True)) # 0이 아닌 수 , "abc" , [1,2,3], {1,2,3}.... print(type(False)) # 0, "", {},() ... # 예제 1 if True: print('Good') if False: print('Bad') # 에제 2 if False: print('Bad') else: print('Good') # 관계 연산자 # >, >=, = y) # 오른쪽이 클때 print(x c ) # a > b > c print(a > b or b > c) print(not a > b) print(not b > c) print(not True) print(not False) print() # 산..
파이썬 yml / SingleChoiceDialog / 조건문 #-*- coding: utf-8 -*- import yaml import wx import os import sys #sys.setdefaultencoding('utf-8') doc = yaml.load(open('test2.yaml', 'r',encoding='utf-8')) strs = doc['strs'] for s in strs: print(s) # 철수, 영희, 명수 if __name__ == '__main__': app = wx.PySimpleApp() dlg = wx.SingleChoiceDialog(None, 'What version of Python are you using?', 'Single Choice', strs, wx.CHOICEDLG_STYLE) if dlg.ShowModal(..

728x90