SlideShare a Scribd company logo
1 of 30
1.
     13
2.
     14
3.
     19
4.
     21
5.
     22
6.
     23
6/1




    30212

1       2555
1


1-2


2
2

-
     2-4
-
     5
-
     6-7
-
     7
-
     8-9
-
     9-10
-
     10-12


13

-
     13-15
-
     15-16
-
     16-17
18


19-20


20
        mind map




                   Function)
type                                         int , float ,
char , double , void
                                             void
                                       int

     function_name




     type parameter                  parameter           ,
N
parameter              void

     {

     location variable declaration
statement_ ; statement_ ; ... statement_N


       return(value);




                                                     void)
                    return

       }




1.                                              User-defined
Function)



2.                           Standard Function)

                                include directives           header
file
     1)
type function_name(type1
                       arg1, type2 arg2,.., typeN argN)
                       {
                       local variable declaration;
                       statement(s);
                       return( varlue);
                       }
1.1




type
                            type             int, float, char
double                                 int
                                                    type        void
function_name



type1 arg1, type2 arg2,…, typeN argN
argument         1, 2,
3,…, N
                                                               void


{
}
local variable declaration


                                        local
statement(s)                                             1
                                         ; (semicolon)
return(value)
value            ()




#include<stdio.h>
#include<conio.h>
void one(void); /* function Prototype
void two(void); /* function Prototype

void main(void)
{
clrscr();
one(); /* call one() */
two(); /* call two() */
printf("nPress any key back to program ...");
getch();
}
/* one function */
void one()

       {
       int a=5, b=7;
       printf("A = %d, B = %dn",a,b);
       }
       /* two function */
       void two()
       {
       float p=4.5, q=3.5;
       p+=q;
       printf("P = %6.3f, Q = %6.3fn",p,q);
       }



  •
  •
  •
  •
            –
            –
            –

 1.2
                         2

       1.
       2.


            #include <stdio.h>
Main ()
      {
          Function-name2 ();
          …………………...
          Function-name1 ();
      }



      #include <stdio.h>
      Main ()
      {
           Function-name1 ();
           Function-name2 ();
           …………………..
      }




 1.
                                #include

 2.




1.3
()

                    void
       function_name(void )




#include<stdio.h>
#include<conio.h>


void asterisk_line(void);
void main(void)
{
clrscr( );
asterisk_line( );
printf("****** C and C++ PROGRAMMING ******n");
asterisk_line();
printf("nPress any key back to program ...");
getch();
}
/* asterisk_line function */
void asterisk_line( )
{
int j, n=40;
for(j=1; j<=n; j++)
printf("*");
printf("n");
}

    1.4




                                                  void
          function_name (type_parameter parameter_name [,..] ) ;

                      function_ name

                      type_parameter


                      parameter_name
                        1        ,




                 #include <stdio.h>
Void addition (int , int ) ;
        Void main ()
        {
        Int a,b ;
        ……....
        Addition (a,b) ;
        }
        Void addition (int m , int n)
        {
        …............
        }

1.5




              Type_variable function_name parameter_name,… ;




      Type_variable


      function_name
parameter_name




#include<stdio.h>
#include<conio.h>
int calculate(int, int);
void main(void)
{


int p=3, q=4, r;
clrscr( );
r = calculate(p,q);
printf("P = %d, Q = %d, R = %dn",p,q,r);
printf("nPress any key back to program ...");
getch();
} /* end main() */
int calculate(int p, int q)
{
return (p+q);
}


    1.6

                      variable_name = function_name();

          variable_name




                          return (value)
7




            (Local Variable)




              (Global Variable)



(
              )


        /* 7th Sample Program: Local vs Global Variable */
        #include<stdio.h>
        int ans = 0;
        int inc_one(int);            /* function prototype */

        void main()
        {
         int a = 3;
         ans = inc_one(a);
         printf(“Answer is %dn”, ans);
        }
        /* function definition: return x+1 */
        int inc_one(int x)
        {
         int ans;
         ans = x + 1;
         return ans;
        }
ans


                                               (main)
                                    ans


                                                        a


              inc_one               x         ans
                    ans                                       ans



                    inc_one                             ans
                                                inc_one
                          ans
inc_one                       ans
                          ans




                                                    C




               Header                         #include

#include<stdio.h>
                                Square root 4 = 2.000000
                                5 power 3 = 125.000000
#include<math.h>
void main()
{
        printf(“square root 4 =”);
        printf(“%fn”, sqrt(4));
    printf(“5 power 3 =”);
        printf(“%f”, pow(5,3));
}



                   include              .h
    •                          printf   scanf     include
        stdio.h
    •                                              sqrt     pow
            include           math.h




                               math.h
                                         double
                                         double
sin(), cos()     tan()




    sin(x)                                            sine   x


    cos(x)               cosine         x
              (radian)
    tan(x)               tangent        x
              (radian)
    sqrt(x)                                 x     x


    exp(x)                ex        e
    pow(x,y)                   xy
    log(x)               log        e           natural logarithm
x
log10(x)   log   x


ceil(x)          x       x


floor(x)             x       x


fabs(x)
string.h)•                       string.h


   –strcat(     1,        2)
   –strcpy(                ,
   –strlen(
   –strcmp(      1,        2)
   -strcmpi (        1,        2)

 2.3

                                               #include <ctype.h>

        TOLOWER


LOWER




                TOLOWER(text)
text



      TOUPPER
            UPPER            LOWER
TOUPPER




             TOUPPER(text)

     text
4




     -

4.




             –
printf



                                                      #include




1.        char s3[5] = {‘G’, ‘O’, ‘O’, ‘D’, ‘0’};   s3

     ก.
     ข.
     ค.        .          .
     ง.
2.
     ก.
     ข.
     ค.                   .
     ง.
3.
ก. int function_name(type arg, …)
     ข. void function_name(type arg, …)
     ค. function_name(type arg, ….)
     ง. void function_name()

4.
     ก.
     ข.
     ค.
     ง.
5.

     ก.
     ข. {}
     ค. []
     ง.




     6.       char s1[9] = “LANGUAGE”;             s1

     ก.
     ข.
     ค.          .          .
     ง.
     7.       char s2[4] = {‘G’, ‘O’, ‘O’, ‘D’};    s2
ก.
ข.
ค.               .     .
ง.
8.
ก. function_name();
ข. function_name()
ค. function_name(arg1,arg2)
      Function_name(arg1; arg2);
9.


ก. int function_name(type arg, …)
ข. void function_name(type arg, …)
ค. function_name(type arg, ….)
  void function_name()

10.

ก. getchar()
ข. gets()
ค. fgets()
ง. get (


            1.               6.
            2.               7.
            3.               8.
            4.               9.
            5.               10.
.         7                  C
                                   http://e-
learning.snru.ac.th/els/program lesson page _ html
21                    2555.

      .                        .
                                http://charinya-
lru.com/charinyadocuments/subjects/                          _ch _ppt.pdf
          17                2555


                                             http://                        ~boo
nchoo/images/stories/ _function_I.pdf                       19            2555

                   30201
                                http://www.gliffy.com            29
2555

                                                                  http://uhost.rmutp

.ac.th/kriengkri.l/w3.pdf     18               2555




http://www.mk-job.com/bbs/thread-3897-1-1.html.        26        2555
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1

More Related Content

What's hot

9 character string &amp; string library
9  character string &amp; string library9  character string &amp; string library
9 character string &amp; string libraryMomenMostafa
 
An imperative study of c
An imperative study of cAn imperative study of c
An imperative study of cTushar B Kute
 
6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumping6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumpingMomenMostafa
 
C tech questions
C tech questionsC tech questions
C tech questionsvijay00791
 
1 introducing c language
1  introducing c language1  introducing c language
1 introducing c languageMomenMostafa
 
GoLightly: Building VM-Based Language Runtimes with Google Go
GoLightly: Building VM-Based Language Runtimes with Google GoGoLightly: Building VM-Based Language Runtimes with Google Go
GoLightly: Building VM-Based Language Runtimes with Google GoEleanor McHugh
 
C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)Olve Maudal
 
Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Saket Pathak
 
Core c sharp and .net quick reference
Core c sharp and .net quick referenceCore c sharp and .net quick reference
Core c sharp and .net quick referenceArduino Aficionado
 
FP 201 - Unit 6
FP 201 - Unit 6FP 201 - Unit 6
FP 201 - Unit 6rohassanie
 
Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APILet's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APIMario Fusco
 
Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?Andrey Akinshin
 
Basic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersBasic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersAppier
 

What's hot (20)

9 character string &amp; string library
9  character string &amp; string library9  character string &amp; string library
9 character string &amp; string library
 
6. functions
6. functions6. functions
6. functions
 
An imperative study of c
An imperative study of cAn imperative study of c
An imperative study of c
 
6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumping6 c control statements branching &amp; jumping
6 c control statements branching &amp; jumping
 
C tech questions
C tech questionsC tech questions
C tech questions
 
1 introducing c language
1  introducing c language1  introducing c language
1 introducing c language
 
GoLightly: Building VM-Based Language Runtimes with Google Go
GoLightly: Building VM-Based Language Runtimes with Google GoGoLightly: Building VM-Based Language Runtimes with Google Go
GoLightly: Building VM-Based Language Runtimes with Google Go
 
Fp201 unit5 1
Fp201 unit5 1Fp201 unit5 1
Fp201 unit5 1
 
C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)
 
Computer Programming- Lecture 5
Computer Programming- Lecture 5 Computer Programming- Lecture 5
Computer Programming- Lecture 5
 
Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)
 
Core c sharp and .net quick reference
Core c sharp and .net quick referenceCore c sharp and .net quick reference
Core c sharp and .net quick reference
 
FP 201 - Unit 6
FP 201 - Unit 6FP 201 - Unit 6
FP 201 - Unit 6
 
Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java APILet's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java API
 
Functions
FunctionsFunctions
Functions
 
Computer Programming- Lecture 6
Computer Programming- Lecture 6Computer Programming- Lecture 6
Computer Programming- Lecture 6
 
Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?
 
Basic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersBasic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python Programmers
 
Computer Programming- Lecture 10
Computer Programming- Lecture 10Computer Programming- Lecture 10
Computer Programming- Lecture 10
 
MP in Clojure
MP in ClojureMP in Clojure
MP in Clojure
 

Similar to โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1

ภาษาซี
ภาษาซีภาษาซี
ภาษาซีkramsri
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซีkramsri
 
Function recap
Function recapFunction recap
Function recapalish sha
 
Function recap
Function recapFunction recap
Function recapalish sha
 
Unit2 jwfiles
Unit2 jwfilesUnit2 jwfiles
Unit2 jwfilesmrecedu
 
โปรแกรมย่อยและฟังชันก์มาตรฐาน
โปรแกรมย่อยและฟังชันก์มาตรฐานโปรแกรมย่อยและฟังชันก์มาตรฐาน
โปรแกรมย่อยและฟังชันก์มาตรฐานknang
 
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)Python 2.5 reference card (2009)
Python 2.5 reference card (2009)gekiaruj
 
Functions in c
Functions in cFunctions in c
Functions in cInnovative
 
Python-GTK
Python-GTKPython-GTK
Python-GTKYuren Ju
 
Intro to c chapter cover 1 4
Intro to c chapter cover 1 4Intro to c chapter cover 1 4
Intro to c chapter cover 1 4Hazwan Arif
 
ANSI C REFERENCE CARD
ANSI C REFERENCE CARDANSI C REFERENCE CARD
ANSI C REFERENCE CARDTia Ricci
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Yuren Ju
 
Lex (lexical analyzer)
Lex (lexical analyzer)Lex (lexical analyzer)
Lex (lexical analyzer)Sami Said
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptxGuy Komari
 

Similar to โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1 (20)

Functions
FunctionsFunctions
Functions
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซี
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซี
 
Function recap
Function recapFunction recap
Function recap
 
Function recap
Function recapFunction recap
Function recap
 
Unit2 jwfiles
Unit2 jwfilesUnit2 jwfiles
Unit2 jwfiles
 
โปรแกรมย่อยและฟังชันก์มาตรฐาน
โปรแกรมย่อยและฟังชันก์มาตรฐานโปรแกรมย่อยและฟังชันก์มาตรฐาน
โปรแกรมย่อยและฟังชันก์มาตรฐาน
 
C-Language Unit-2
C-Language Unit-2C-Language Unit-2
C-Language Unit-2
 
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)Python 2.5 reference card (2009)
Python 2.5 reference card (2009)
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Python-GTK
Python-GTKPython-GTK
Python-GTK
 
Intro to c chapter cover 1 4
Intro to c chapter cover 1 4Intro to c chapter cover 1 4
Intro to c chapter cover 1 4
 
Functions struct&union
Functions struct&unionFunctions struct&union
Functions struct&union
 
ANSI C REFERENCE CARD
ANSI C REFERENCE CARDANSI C REFERENCE CARD
ANSI C REFERENCE CARD
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)
 
functions
functionsfunctions
functions
 
6. function
6. function6. function
6. function
 
Lex (lexical analyzer)
Lex (lexical analyzer)Lex (lexical analyzer)
Lex (lexical analyzer)
 
Functions
FunctionsFunctions
Functions
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 

More from Little Tukta Lita

งานนำเสนอ1
งานนำเสนอ1งานนำเสนอ1
งานนำเสนอ1Little Tukta Lita
 
บทที่ 5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1
บทที่  5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1บทที่  5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1
บทที่ 5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1Little Tukta Lita
 
สรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบสรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบLittle Tukta Lita
 
สรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบสรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบLittle Tukta Lita
 
สรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบสรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบLittle Tukta Lita
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม.6.1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม.6.1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม.6.1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม.6.1Little Tukta Lita
 

More from Little Tukta Lita (8)

งานนำเสนอ1
งานนำเสนอ1งานนำเสนอ1
งานนำเสนอ1
 
มายแม็บ
มายแม็บมายแม็บ
มายแม็บ
 
บทที่ 5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1
บทที่  5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1บทที่  5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1
บทที่ 5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1
 
It news
It newsIt news
It news
 
สรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบสรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบ
 
สรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบสรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบ
 
สรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบสรุปงานผู้ทดสอบ
สรุปงานผู้ทดสอบ
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม.6.1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม.6.1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม.6.1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม.6.1
 

Recently uploaded

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 

Recently uploaded (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1

  • 1. 1. 13 2. 14 3. 19 4. 21 5. 22 6. 23
  • 2. 6/1 30212 1 2555
  • 4. 2 - 2-4 - 5 - 6-7 - 7 - 8-9 - 9-10 - 10-12 13 - 13-15 - 15-16 - 16-17
  • 5. 18 19-20 20 mind map Function)
  • 6. type int , float , char , double , void void int function_name type parameter parameter , N parameter void { location variable declaration
  • 7. statement_ ; statement_ ; ... statement_N return(value); void) return } 1. User-defined Function) 2. Standard Function) include directives header file 1)
  • 8. type function_name(type1 arg1, type2 arg2,.., typeN argN) { local variable declaration; statement(s); return( varlue); } 1.1 type type int, float, char double int type void function_name type1 arg1, type2 arg2,…, typeN argN
  • 9. argument 1, 2, 3,…, N void { } local variable declaration local statement(s) 1 ; (semicolon) return(value) value () #include<stdio.h> #include<conio.h> void one(void); /* function Prototype void two(void); /* function Prototype void main(void) { clrscr(); one(); /* call one() */ two(); /* call two() */ printf("nPress any key back to program ..."); getch(); }
  • 10. /* one function */ void one() { int a=5, b=7; printf("A = %d, B = %dn",a,b); } /* two function */ void two() { float p=4.5, q=3.5; p+=q; printf("P = %6.3f, Q = %6.3fn",p,q); } • • • • – – – 1.2 2 1. 2. #include <stdio.h>
  • 11. Main () { Function-name2 (); …………………... Function-name1 (); } #include <stdio.h> Main () { Function-name1 (); Function-name2 (); ………………….. } 1. #include 2. 1.3
  • 12. () void function_name(void ) #include<stdio.h> #include<conio.h> void asterisk_line(void); void main(void) { clrscr( ); asterisk_line( ); printf("****** C and C++ PROGRAMMING ******n"); asterisk_line(); printf("nPress any key back to program ..."); getch(); } /* asterisk_line function */
  • 13. void asterisk_line( ) { int j, n=40; for(j=1; j<=n; j++) printf("*"); printf("n"); } 1.4 void function_name (type_parameter parameter_name [,..] ) ; function_ name type_parameter parameter_name 1 , #include <stdio.h>
  • 14. Void addition (int , int ) ; Void main () { Int a,b ; …….... Addition (a,b) ; } Void addition (int m , int n) { …............ } 1.5 Type_variable function_name parameter_name,… ; Type_variable function_name
  • 15. parameter_name #include<stdio.h> #include<conio.h> int calculate(int, int); void main(void) { int p=3, q=4, r; clrscr( ); r = calculate(p,q); printf("P = %d, Q = %d, R = %dn",p,q,r); printf("nPress any key back to program ..."); getch(); } /* end main() */ int calculate(int p, int q) {
  • 16. return (p+q); } 1.6 variable_name = function_name(); variable_name return (value)
  • 17. 7 (Local Variable) (Global Variable) ( ) /* 7th Sample Program: Local vs Global Variable */ #include<stdio.h> int ans = 0; int inc_one(int); /* function prototype */ void main() { int a = 3; ans = inc_one(a); printf(“Answer is %dn”, ans); } /* function definition: return x+1 */ int inc_one(int x) { int ans; ans = x + 1; return ans; }
  • 18. ans (main) ans a inc_one x ans ans ans inc_one ans inc_one ans inc_one ans ans C Header #include #include<stdio.h> Square root 4 = 2.000000 5 power 3 = 125.000000
  • 19. #include<math.h> void main() { printf(“square root 4 =”); printf(“%fn”, sqrt(4)); printf(“5 power 3 =”); printf(“%f”, pow(5,3)); } include .h • printf scanf include stdio.h • sqrt pow include math.h math.h double double
  • 20. sin(), cos() tan() sin(x) sine x cos(x) cosine x (radian) tan(x) tangent x (radian) sqrt(x) x x exp(x) ex e pow(x,y) xy log(x) log e natural logarithm x
  • 21. log10(x) log x ceil(x) x x floor(x) x x fabs(x)
  • 22. string.h)• string.h –strcat( 1, 2) –strcpy( , –strlen( –strcmp( 1, 2) -strcmpi ( 1, 2) 2.3 #include <ctype.h> TOLOWER LOWER TOLOWER(text)
  • 23. text TOUPPER UPPER LOWER TOUPPER TOUPPER(text) text
  • 24.
  • 25. 4 - 4. –
  • 26. printf #include 1. char s3[5] = {‘G’, ‘O’, ‘O’, ‘D’, ‘0’}; s3 ก. ข. ค. . . ง. 2. ก. ข. ค. . ง. 3.
  • 27. ก. int function_name(type arg, …) ข. void function_name(type arg, …) ค. function_name(type arg, ….) ง. void function_name() 4. ก. ข. ค. ง. 5. ก. ข. {} ค. [] ง. 6. char s1[9] = “LANGUAGE”; s1 ก. ข. ค. . . ง. 7. char s2[4] = {‘G’, ‘O’, ‘O’, ‘D’}; s2
  • 28. ก. ข. ค. . . ง. 8. ก. function_name(); ข. function_name() ค. function_name(arg1,arg2) Function_name(arg1; arg2); 9. ก. int function_name(type arg, …) ข. void function_name(type arg, …) ค. function_name(type arg, ….) void function_name() 10. ก. getchar() ข. gets() ค. fgets() ง. get ( 1. 6. 2. 7. 3. 8. 4. 9. 5. 10.
  • 29. . 7 C http://e- learning.snru.ac.th/els/program lesson page _ html 21 2555. . . http://charinya- lru.com/charinyadocuments/subjects/ _ch _ppt.pdf 17 2555 http:// ~boo nchoo/images/stories/ _function_I.pdf 19 2555 30201 http://www.gliffy.com 29 2555 http://uhost.rmutp .ac.th/kriengkri.l/w3.pdf 18 2555 http://www.mk-job.com/bbs/thread-3897-1-1.html. 26 2555