7 Http netwk hnu kr HANNAM UNIVERSITY 1
- Slides: 80
제 7장 함수 Http: //netwk. hnu. kr HANNAM UNIVERSITY 1
함수의 종류 Http: //netwk. hnu. kr HANNAM UNIVERSITY 8
함수의 정의 r 반환형(return type) r 함수 헤더(function header) r 함수 몸체(function body) Http: //netwk. hnu. kr HANNAM UNIVERSITY 11
함수의 구조 Http: //netwk. hnu. kr HANNAM UNIVERSITY 12
함수 이름 r 일반적으로 동사+명사 r (예) Ü compute_average(), Ü get_integer() Ü set_speed() Http: //netwk. hnu. kr HANNAM UNIVERSITY 14
지역 변수 r 지역 변수(local variable): 함수 안에서 정의되는 변수 Http: //netwk. hnu. kr HANNAM UNIVERSITY 16
예제 #1 r 정수의 제곱값을 계산하는 함수 반환값: int 함수 이름: square 매개 변수: int n int square(int n) { return(n*n); } Http: //netwk. hnu. kr HANNAM UNIVERSITY 18
값을 반환하는 문장 r return 문장을 사용하여서 값을 반환한다. r return 문장의 사용 예 return 0; return (x); return x+y; Http: //netwk. hnu. kr HANNAM UNIVERSITY 25
예제 0 1 4 9 16 Http: //netwk. hnu. kr HANNAM UNIVERSITY 27
조합(combination) 계산 함수 r 팩토리얼 계산 함수와 get_integer() 함수를 호출하여 조합 을 계산한다 Http: //netwk. hnu. kr HANNAM UNIVERSITY 29
예제 Http: //netwk. hnu. kr HANNAM UNIVERSITY 30
예제 정수를 입력하시오: 10 정수를 입력하시오: 3 C(10, 3) = 120 Http: //netwk. hnu. kr HANNAM UNIVERSITY 31
함수 호출 계층 구조 Http: //netwk. hnu. kr HANNAM UNIVERSITY 32
지역 변수 r 지역 변수(local variable): 함수나 블록 안에 선언되는 변수 Http: //netwk. hnu. kr HANNAM UNIVERSITY 42
지역 변수의 사용 범위 Http: //netwk. hnu. kr HANNAM UNIVERSITY 43
블록 안에서의 지역 변수 Http: //netwk. hnu. kr HANNAM UNIVERSITY 44
지역 변수의 초기값 Http: //netwk. hnu. kr HANNAM UNIVERSITY 46
같은 이름의 지역 변수 Http: //netwk. hnu. kr HANNAM UNIVERSITY 49
저장 유형 지정자 static auto_count=1 static_count=1 auto_count=1 static_count=2 auto_count=1 static_count=3 자동 지역 변수 Http: //netwk. hnu. kr 정적 지역 변수로서 static을 붙이면 지역 변수가 정적 변수로 된다. HANNAM UNIVERSITY 58
extern 예제 linkage 1. c 연결 linkage 2. c 10 Http: //netwk. hnu. kr HANNAM UNIVERSITY 61
팩토리얼 구하기 #2 r 팩토리얼의 호출 순서 factorial(3) = 3 * factorial(2) = 3 * 2 * factorial(1) =3*2*1 =3*2 =6 ④ ① ③ Http: //netwk. hnu. kr ② HANNAM UNIVERSITY 66
팩토리얼 예제 Http: //netwk. hnu. kr HANNAM UNIVERSITY 67
팩토리얼 예제 순환호출 정수를 입력하시오: 5 factorial(5) factorial(4) factorial(3) factorial(2) factorial(1) 5!은 120입니다. Http: //netwk. hnu. kr HANNAM UNIVERSITY 68
팩토리얼의 반복적 구현 Http: //netwk. hnu. kr HANNAM UNIVERSITY 71
라이브러리 사용 Http: //netwk. hnu. kr HANNAM UNIVERSITY 74
수학 라이브러리 함수 Http: //netwk. hnu. kr HANNAM UNIVERSITY 75
예제 sin()= 1. 000000 cos()= 0. 000000 tan()= 0. 546302 log()= 2. 302585 log 10()= 2. 000000 exp()= 22026. 465795 계속하려면 아무 키나 누르십시오. . . Http: //netwk. hnu. kr HANNAM UNIVERSITY 76
난수 생성 라이브러리 함수 16154 18011 20719 15002 25104 31802 587 8161 28527 8385 Http: //netwk. hnu. kr HANNAM UNIVERSITY 78
Q&A Http: //netwk. hnu. kr HANNAM UNIVERSITY 80
- R프로그램
- Snr 공식
- Piggybacking arq
- Hannam mobile
- Hannam.ac.kr
- Netwk
- Http //mbs.meb.gov.tr/ http //www.alantercihleri.com
- Siat.ung.ac.id
- "university of maryland university college"
- Http://mbgnet.mobot.org/
- Primaryhomeworkhelp.co.uk
- Http://oh.portal.airast.org
- Http://zapatopi.net/treeoctopus/
- Http://getkahoot.com
- Msdn visual basic
- Ets.criterion
- Icas score levels
- Http://apps.tujuhbukit.com/covid19/
- Http:fsi-st univ-boumerdes-dz
- Universal xss
- Http://hdr.undp.org/en/data
- Pull force definition
- Us dot hazmat training
- Https://www.google.com.tw
- Http://earthobservatory.nasa.gov/experiments/biome/
- Http://space-facts.com/the-moon/
- Http://zapatopi.net/treeoctopus
- Http://www.pbs.org/ktca/liberty/
- How many spacecrafts have visited mercury
- Http://belarustoday.info/?sid=4
- Http //www.meb.gov.tr tercih
- Http://geosevillano.blogspot.com/p/blog-page_6.html
- Http:scratch.mit.edu
- Http://mbgnet.mobot.org/
- Http //sciencespot.net/
- Http //sciencespot.net
- T. trimpe 2006 http //sciencespot.net/
- T. trimpe 2006 http://sciencespot.net/
- T. trimpe 2004 http //sciencespot.net/
- Http://www.safesearchkids.com/
- E attestation portal
- What are the benefits of space exploration
- Http //tubel.bppsdmk.kemkes.go.id
- Http://www.caaspp.org
- Http://dgest.dyndns.ws
- Sikda.lombokbaratkab
- Teachertech.rice.edu
- Siap jabarprov.go.id
- Htpp://scratch.mit.edu
- Http // scratch.mit.edu/
- Httpsscratch
- Http://scratch.mit.edu
- Http://www.explorelearning.com
- Httpwordle
- Http://pisa.ets.org/school
- Rest security
- Http://numericalmethods.eng.usf.edu
- Http //www.python.org/
- Sistema integral de servicio social
- Solid to liquid is called
- Sisrute.kemkes.go
- Ozoblockly lessons
- Http://sdmx.store:8080
- Http://pds.jpl.nasa.gov/planets/
- Http://fac book
- Etwinningonline
- Http://login.microsoftonline.com
- Food group
- Http www.meb.gov.tr
- Davidmlane t table
- Node red http
- Http://phaen-alv.com/
- Http://learn.genetics.utah.edu/content/addiction/
- Epinephrine in the brain
- Www biography com search
- Administration.assessform
- Http://teachertech.rice.edu/participants/louviere/newton/
- Http://www.finaid.org/calculators/loanpayments.phtml
- Metrocosm global migration map
- Http 601
- Icebreaker bingo generator