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

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
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
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Recently uploaded (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.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 ...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.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