SlideShare une entreprise Scribd logo
1  sur  47
Fundamentals of Programming
   ►Switch Case and Looping System
  Prepared by: Romeo Miguel F. Ramos
Programming

         programming is instructing a computer to do something for
you with the help of a programming language. The role of a
programming language can be described in two ways:
• Technical: It is a means for instructing a Computer to perform
   Tasks
• Conceptual: It is a framework within which we organize our ideas
   about things and processes.

 The word “programming”, it is a computer language programmers use
to develop applications, scripts, or other set of instructions for a
computer to execute.
•   The distinction between data and procedures is not that clear cut.
    In many programming languages, procedures can be passed as
    data (to be applied to ``real'' data) and sometimes processed like
    ``ordinary'' data. Conversely ``ordinary'' data can be turned into
    procedures by an evaluation mechanism.

•   At first, programming is confusing because you have so much to
    understand about codes that will enable to run a program.
    Programming has applications and program development, the best
    example for this is the Internet browser…
• Programming is a creative process
  done by programmers to instruct a
  computer on how to do a task.
  Programming languages let you use
  them in different ways, e.g adding
  numbers, etc… or storing data on disk
  for later retrieval.
Switch Case
   • - A switch, case, select or inspect statement is a
     type of selection control mechanism that exists in
     most imperative programming languages such
     as Pascal, Ada, C/C++, C#, Java, and so on. It is
     also included in several other types of languages.
     Its purpose is to allow the value of a variable or
     expression to control the flow of program
     execution via a multiway branch (or "go to", one of
     several labels).
The Main Reason why we use the Switch Case

    • - To improve clarity, by reducing
      otherwise repetitive coding, and (if
      the heuristics permit) also offering the
      potential for faster execution through
      easier compiler optimization in many
      cases.
Programs that is related to switch case

     • The If – Else Statement
     - The if statement allows the programmer to make
      decisions within a program.
     - The if statement allows the programmer to make
      decisions within a program.
     • If (expression)
         statement
     - Where expression represents a relational,
        equality, or logical expression ( conditional
        expression) .
If statement (two alternatives)
If (condition)
statement;
else
    statement;
        •   Note: if condition evaluates to true, then statement is
        •   executed and statement is skipped; otherwise, statement is
        •   skipped and statement is executed



If statement (One-Alternatives)

 If (condition)         Note: if condition evaluates to true, then statement is
     statement;         executed and statement is skipped
Format of the if statement

    • - All if statement examples in this text indent
      statements. The word else
    • Is typed without indention on a separate line. The
      format of the if statement
    • makes its meaning apparent and is used solely to
      improve program readability;
    • The format makes no difference to the computer
• If we know how to write a C expression that is
  equivalent of a question such as “Is resting the
  value of expression to select a course of action. In
  C, the statement is the primary selection control
  structure
• A programming language is an artificial language
  designed to communicate instructions to
  a machine, particularly a computer. Programming
  languages can be used to create programs that
  control the behavior of a machine and/or to
  express algorithms precisely.
5 Switch
 Cases
http://gd.tuwien.ac.at/languages/c
                        /programming-bbrown/c_028.htm



                        The above program uses
                        a switch statement to
                        validate and select upon
                        the users input choice,
                        simulating a simple
                        menu of choices.


http://eglobiotraining.com/
When it compiles and run, this will be it look .
The C expression that was type it on Dev C++
 The words are “enter in two number  24”
Example of Switch
  Case Statement , you
  Will see the statement
 on the link that you see
        in this slide.

LINK:
http://www.morrowland.co
m/apron/tutorials/cpp/cpp_
  switch_case/index.php
After I compile it
                                 and run it, the
                              statement is now
                               like this. As you
                              Can see after you
                                answer the 1st
                              question the next
                              question appear
                                 And after you
                                  finish all the
                              question the box
                               will disappear. It
                                 means finish.

http://eglobiotraining.com/
Function and target of Programming
language : A computer programming
language is a language. used to
write computer programs, which involve
a computer performing some kind of
computation or algorithm and possibly
control external devices such as printers
, disk drives , robots, and so on.

 LINK:

   http://www.morrowland.com/a
   pron/tutorials/cpp/cpp_if_else
             /index.php
When the
   statement was
 done this will it be
      look like.
 I got this from the
URL . The URL was
    posted on the
   previous slide


                    http://eglobiotraining.com/
Did You Know?
                                    The first programming
                                    languages predate the
                                   modern computer. The
                                     19th century saw the
                                         invention of
                                   "programmable" looms
                                          and player
                                     piano scrolls, both of
                                      which implemented
                                     examples ofdomain-
                                      specific languages.


http://msdn.microsoft.com/en-us/library/66k51h7a(v=vs.80).aspx
Did You Know ?
All programming languages have some primitive building blocks for the description of
data and the processes or transformations applied to them(like the addition of two
numbers or the selection of an item from a collection). These primitives are defined by
syntactic and semantic rules which describe their structure and meaning respectively.
LINK:   http://www.cfanatic.com/topic4267/
http://eglobiotraining.com/
Looping Statements
   Loops execute a block of code a specified number of
      times, or while a specified condition is true.
   - in PHP, the following looping statements are used:

       *The while Loop
       * The Do… While Loop
       * The For Loop
       *The Foreach Loop
       *Break and continue statement
The While loop
   • While structure is another type of loop statements,
   • where the condition is checked at first, the
     iteration
   • will not stop even if the value changes while
     executing
   • statements.
   Form:
   While(condition)
   {
    code to be executed;
   }
The Do While Loop
   • Do while statement is same as the
     while statement , the only difference is
     that it evaluates the expression at the
     end.
                  Form:
                  do
                     {
                       code to be
                  executed;
                      }
                      while (condition):
The For Loop
   •   The for loop is used when you know in advance how many times
       the script should run.
   •   Be for statement takes three expressions inside its parentheses
       separated by semi-colons. When the for loop executes, the
       following occurs:
   •   The initializing expression is executed. This expression usually
       initializes one or more loop counter, but the syntax allow
       expression any degree of complexity.
   •   The condition expression is evaluated. Of the value of condition is
       true, the loop statements execute. If the value of condition is false,
       the for loop terminates.



                    http://eglobiotraining.com/
The For Loop
   • Form:

   •   for {initialization; condition: increment )
   •       {
   •        code to be executed
   •       }




                   http://eglobiotraining.com/
The For Each Loop
  • For Each structure is a loop structure used for arrays

  Form:
  foreach(array as value)
  {
    code to be executed
  }

  Foreach (array as key => value)
  {
    code to be executed
  }
                            http://eglobiotraining.com/
The Break Statement
   • Break ends the execution of the for, for
     each, while, do-while or switch statement.



   • Form:
     * Break ( optional numeric argument)


            http://eglobiotraining.com/
The Continue Statement
   • “Continue” is used to skip the current loop
     iteration and continue with the next
     iteration of the loop. But “Break” is to exit
     from the whole loop.

   Form:
     * Break ( optional numeric argument)


                http://eglobiotraining.com/
The For Loop
                      LINK:

                          http://www.morrowl
                          and.com/apron/tuto
                          rials/cpp/cpp_for_l
                             oop/index.php




          http://eglobiotraining.com/
LINK:

               http://www.morrowla
               nd.com/apron/tutori
               als/cpp/cpp_for_loo
                    p/index.php




http://eglobiotraining.com/
Do While Loop
                         LINK:

                           http://www.morrowland
                           .com/apron/tutorials/cp
                           p/cpp_do_while_loop/i
                                   ndex.php




          http://eglobiotraining.com/
Do While Loop




         http://eglobiotraining.com/
While Loop

                             LINK:

                              http://www.exfors
                              ys.com/tutorials/c
                                     -plus-
                               plus/looping-in-
                                     c.html



             http://eglobiotraining.com/
While Loop




         http://eglobiotraining.com/
Break and Continue
                               LINK:

                                http://cprogrammingl
                                   anguage.net/c-
                                   break-continue-
                                  statements.aspx




          http://eglobiotraining.com/
Break and Continue




         http://eglobiotraining.com/
For Each Loop




 LINK:
         http://www.w3schools.co
         m/php/php_looping_for.a
                    sp

              http://eglobiotraining.com/
For Each Loop




         http://eglobiotraining.com/
You have to consider languages to run or write your
own program, most demanded language in programming is the
DEV C++ (a full-featured Integrated Development Environment
(IDE)).

        C++ is one of the most used programming languages
in the world. Also known as "C with Classes".

New to programming or thinking about it? It might surprise you
to know that there are many programmers who program just for
fun and it can lead to a job.
Looping

          Loops are used to repeat a block of code.
    Being able to have your program repeatedly
    execute a block of code is one of the most basic
    but useful tasks in programming -- many
    programs or websites that produce extremely
    complex output (such as a message board) are
    really only executing a single task many times.
Looping Statement
   • In doing the looping statement, I noticed that
     sometimes if the program does not run, it is
     because some braces are not included and I
     accidentally put braces on the same line and it
     causes the program not to read its contents.
     Programming is sensitive, when there is missing
     variable or braces or some words it does not run.
Looping Statement
   • When I learned that programming is very sensitive and at
     the same time very detailed when it comes to entering
     codes, I make sure that it is clear means that I put
     everything important codes in it so that the program would
     run.
   • So much codes that should be entered that even the spaces
     are needed programming is very specific that whatever you
     have entered in to it you should specify because when the
     statement is false it wouldn’t let you run the program, I have
     experienced it before I arrived at this result.
Switch Cases
   • In programming the switch case missing out
     a break statement causes control to fall through to the next
     case label. Switches can always be replaced by nested if-
     else statements, but in some cases this may be more
     clumsy. Each break statement terminates the
     enclosing switch statement. The Control flow in
     programming continues with the first statement

   • Because of so many experiences I had before this program
     run, I found programming is also interesting for the more you
     are practicing to make a program run, the more questions
     that came up in my mind and try something that will fit to this
     or entering new codes to make matrix etc… that I know is
     possible.
• I thought learning programming is easy
  but now I think it’s not that easy because
  you should always check the codes you
  encoded before you do some
  programs, and if you have an error it will
  run in Dev C++. In programming you will
  learn a lot here especially if you are a
  computer addicts .
• programming is what makes a computer more than just a
  simple pocket calculator. In programming Everything that
  you can do today on a computer someone had to be
  programmed at one point.
• The importance of programming Developing a program
  involves a series of steps. The programmer defines a
  problem, plans a solution, codes the program, tests the
  program and, finally, documents the program. Usually in
  programming , the programmer defines what he knows and
  the objective, selects a program to use, debugs the program
  in stages after completion to ensure no errors are introduced
  and then documents the design, development and testing of
  the program. With the ever-changing face of computer
  technology, programming is an exciting and always
  challenging environment that few programmers ever dream
  of leaving.
Slide Share 

             • ► MeoRamos

   • http://www.slideshare.net/MeoRamos

Contenu connexe

Tendances

10. switch case
10. switch case10. switch case
10. switch caseWay2itech
 
C presentation book
C presentation bookC presentation book
C presentation bookkrunal1210
 
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
[OOP - Lec 16,17] Objects as Function Parameter and ReturnTypeMuhammad Hammad Waseem
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchartSachin Goyani
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowchartsSamuel Igbanogu
 
Microsoft excel
Microsoft excelMicrosoft excel
Microsoft excelwaszia
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowchartsSajib
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptxSKUP1
 
notes on Programming fundamentals
notes on Programming fundamentals notes on Programming fundamentals
notes on Programming fundamentals ArghodeepPaul
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming LanguageAhmad Idrees
 
Fundamentals of Programming Constructs.pptx
Fundamentals of  Programming Constructs.pptxFundamentals of  Programming Constructs.pptx
Fundamentals of Programming Constructs.pptxvijayapraba1
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchartRabin BK
 
PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.Umesh Kumar
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.pptTareq Hasan
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programmingChitrank Dixit
 

Tendances (20)

10. switch case
10. switch case10. switch case
10. switch case
 
Excel lesson01
Excel lesson01Excel lesson01
Excel lesson01
 
C presentation book
C presentation bookC presentation book
C presentation book
 
C functions
C functionsC functions
C functions
 
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
 
What is Compiler?
What is Compiler?What is Compiler?
What is Compiler?
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
c-programming
c-programmingc-programming
c-programming
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
 
Microsoft excel
Microsoft excelMicrosoft excel
Microsoft excel
 
C Language
C LanguageC Language
C Language
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
 
notes on Programming fundamentals
notes on Programming fundamentals notes on Programming fundamentals
notes on Programming fundamentals
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
Fundamentals of Programming Constructs.pptx
Fundamentals of  Programming Constructs.pptxFundamentals of  Programming Constructs.pptx
Fundamentals of Programming Constructs.pptx
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 

Similaire à Looping and switch cases

Fundamentals of programming final
Fundamentals of programming finalFundamentals of programming final
Fundamentals of programming finalRicky Recto
 
Fundamentals of programming final santos
Fundamentals of programming final santosFundamentals of programming final santos
Fundamentals of programming final santosAbie Santos
 
Margareth lota
Margareth lotaMargareth lota
Margareth lotamaggybells
 
Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02thinesonsing
 
Deguzmanpresentationprogramming
DeguzmanpresentationprogrammingDeguzmanpresentationprogramming
Deguzmanpresentationprogrammingdeguzmantrisha
 
Fundamentals of programming finals.ajang
Fundamentals of programming finals.ajangFundamentals of programming finals.ajang
Fundamentals of programming finals.ajangJaricka Angelyd Marquez
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!olracoatalub
 
Switch case and looping statement
Switch case and looping statementSwitch case and looping statement
Switch case and looping statement_jenica
 
Mark asoi ppt
Mark asoi pptMark asoi ppt
Mark asoi pptmark-asoi
 
Fundamentals of programming
Fundamentals of programmingFundamentals of programming
Fundamentals of programmingKaycee Parcon
 
Final requirement for programming-Bonifacio, Mary Clemence
Final requirement for programming-Bonifacio, Mary ClemenceFinal requirement for programming-Bonifacio, Mary Clemence
Final requirement for programming-Bonifacio, Mary Clemenceclemencebonifacio
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping newaprilyyy
 
A brief introduction to C Language
A brief introduction to C LanguageA brief introduction to C Language
A brief introduction to C LanguageMohamed Elsayed
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTESNi
 

Similaire à Looping and switch cases (20)

Fundamentals of programming final
Fundamentals of programming finalFundamentals of programming final
Fundamentals of programming final
 
Fundamentals of programming final santos
Fundamentals of programming final santosFundamentals of programming final santos
Fundamentals of programming final santos
 
Margareth lota
Margareth lotaMargareth lota
Margareth lota
 
Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02
 
Survelaine murillo ppt
Survelaine murillo pptSurvelaine murillo ppt
Survelaine murillo ppt
 
Deguzmanpresentationprogramming
DeguzmanpresentationprogrammingDeguzmanpresentationprogramming
Deguzmanpresentationprogramming
 
Switch case looping
Switch case loopingSwitch case looping
Switch case looping
 
Fundamentals of programming finals.ajang
Fundamentals of programming finals.ajangFundamentals of programming finals.ajang
Fundamentals of programming finals.ajang
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!
 
Switch case and looping statement
Switch case and looping statementSwitch case and looping statement
Switch case and looping statement
 
My final requirement
My final requirementMy final requirement
My final requirement
 
Project
ProjectProject
Project
 
Mark asoi ppt
Mark asoi pptMark asoi ppt
Mark asoi ppt
 
C Language Presentation.pptx
C Language Presentation.pptxC Language Presentation.pptx
C Language Presentation.pptx
 
Fundamentals of programming
Fundamentals of programmingFundamentals of programming
Fundamentals of programming
 
How a Compiler Works ?
How a Compiler Works ?How a Compiler Works ?
How a Compiler Works ?
 
Final requirement for programming-Bonifacio, Mary Clemence
Final requirement for programming-Bonifacio, Mary ClemenceFinal requirement for programming-Bonifacio, Mary Clemence
Final requirement for programming-Bonifacio, Mary Clemence
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping new
 
A brief introduction to C Language
A brief introduction to C LanguageA brief introduction to C Language
A brief introduction to C Language
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTES
 

Looping and switch cases

  • 1. Fundamentals of Programming ►Switch Case and Looping System Prepared by: Romeo Miguel F. Ramos
  • 2. Programming programming is instructing a computer to do something for you with the help of a programming language. The role of a programming language can be described in two ways: • Technical: It is a means for instructing a Computer to perform Tasks • Conceptual: It is a framework within which we organize our ideas about things and processes. The word “programming”, it is a computer language programmers use to develop applications, scripts, or other set of instructions for a computer to execute.
  • 3. The distinction between data and procedures is not that clear cut. In many programming languages, procedures can be passed as data (to be applied to ``real'' data) and sometimes processed like ``ordinary'' data. Conversely ``ordinary'' data can be turned into procedures by an evaluation mechanism. • At first, programming is confusing because you have so much to understand about codes that will enable to run a program. Programming has applications and program development, the best example for this is the Internet browser…
  • 4. • Programming is a creative process done by programmers to instruct a computer on how to do a task. Programming languages let you use them in different ways, e.g adding numbers, etc… or storing data on disk for later retrieval.
  • 5. Switch Case • - A switch, case, select or inspect statement is a type of selection control mechanism that exists in most imperative programming languages such as Pascal, Ada, C/C++, C#, Java, and so on. It is also included in several other types of languages. Its purpose is to allow the value of a variable or expression to control the flow of program execution via a multiway branch (or "go to", one of several labels).
  • 6. The Main Reason why we use the Switch Case • - To improve clarity, by reducing otherwise repetitive coding, and (if the heuristics permit) also offering the potential for faster execution through easier compiler optimization in many cases.
  • 7. Programs that is related to switch case • The If – Else Statement - The if statement allows the programmer to make decisions within a program. - The if statement allows the programmer to make decisions within a program. • If (expression) statement - Where expression represents a relational, equality, or logical expression ( conditional expression) .
  • 8. If statement (two alternatives) If (condition) statement; else statement; • Note: if condition evaluates to true, then statement is • executed and statement is skipped; otherwise, statement is • skipped and statement is executed If statement (One-Alternatives) If (condition) Note: if condition evaluates to true, then statement is statement; executed and statement is skipped
  • 9. Format of the if statement • - All if statement examples in this text indent statements. The word else • Is typed without indention on a separate line. The format of the if statement • makes its meaning apparent and is used solely to improve program readability; • The format makes no difference to the computer
  • 10. • If we know how to write a C expression that is equivalent of a question such as “Is resting the value of expression to select a course of action. In C, the statement is the primary selection control structure • A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely.
  • 12. http://gd.tuwien.ac.at/languages/c /programming-bbrown/c_028.htm The above program uses a switch statement to validate and select upon the users input choice, simulating a simple menu of choices. http://eglobiotraining.com/
  • 13. When it compiles and run, this will be it look . The C expression that was type it on Dev C++ The words are “enter in two number  24”
  • 14. Example of Switch Case Statement , you Will see the statement on the link that you see in this slide. LINK: http://www.morrowland.co m/apron/tutorials/cpp/cpp_ switch_case/index.php
  • 15. After I compile it and run it, the statement is now like this. As you Can see after you answer the 1st question the next question appear And after you finish all the question the box will disappear. It means finish. http://eglobiotraining.com/
  • 16. Function and target of Programming language : A computer programming language is a language. used to write computer programs, which involve a computer performing some kind of computation or algorithm and possibly control external devices such as printers , disk drives , robots, and so on. LINK: http://www.morrowland.com/a pron/tutorials/cpp/cpp_if_else /index.php
  • 17. When the statement was done this will it be look like. I got this from the URL . The URL was posted on the previous slide http://eglobiotraining.com/
  • 18. Did You Know? The first programming languages predate the modern computer. The 19th century saw the invention of "programmable" looms and player piano scrolls, both of which implemented examples ofdomain- specific languages. http://msdn.microsoft.com/en-us/library/66k51h7a(v=vs.80).aspx
  • 19. Did You Know ? All programming languages have some primitive building blocks for the description of data and the processes or transformations applied to them(like the addition of two numbers or the selection of an item from a collection). These primitives are defined by syntactic and semantic rules which describe their structure and meaning respectively.
  • 20. LINK: http://www.cfanatic.com/topic4267/
  • 22. Looping Statements Loops execute a block of code a specified number of times, or while a specified condition is true. - in PHP, the following looping statements are used: *The while Loop * The Do… While Loop * The For Loop *The Foreach Loop *Break and continue statement
  • 23. The While loop • While structure is another type of loop statements, • where the condition is checked at first, the iteration • will not stop even if the value changes while executing • statements. Form: While(condition) { code to be executed; }
  • 24. The Do While Loop • Do while statement is same as the while statement , the only difference is that it evaluates the expression at the end. Form: do { code to be executed; } while (condition):
  • 25. The For Loop • The for loop is used when you know in advance how many times the script should run. • Be for statement takes three expressions inside its parentheses separated by semi-colons. When the for loop executes, the following occurs: • The initializing expression is executed. This expression usually initializes one or more loop counter, but the syntax allow expression any degree of complexity. • The condition expression is evaluated. Of the value of condition is true, the loop statements execute. If the value of condition is false, the for loop terminates. http://eglobiotraining.com/
  • 26. The For Loop • Form: • for {initialization; condition: increment ) • { • code to be executed • } http://eglobiotraining.com/
  • 27. The For Each Loop • For Each structure is a loop structure used for arrays Form: foreach(array as value) { code to be executed } Foreach (array as key => value) { code to be executed } http://eglobiotraining.com/
  • 28. The Break Statement • Break ends the execution of the for, for each, while, do-while or switch statement. • Form: * Break ( optional numeric argument) http://eglobiotraining.com/
  • 29. The Continue Statement • “Continue” is used to skip the current loop iteration and continue with the next iteration of the loop. But “Break” is to exit from the whole loop. Form: * Break ( optional numeric argument) http://eglobiotraining.com/
  • 30. The For Loop LINK: http://www.morrowl and.com/apron/tuto rials/cpp/cpp_for_l oop/index.php http://eglobiotraining.com/
  • 31. LINK: http://www.morrowla nd.com/apron/tutori als/cpp/cpp_for_loo p/index.php http://eglobiotraining.com/
  • 32. Do While Loop LINK: http://www.morrowland .com/apron/tutorials/cp p/cpp_do_while_loop/i ndex.php http://eglobiotraining.com/
  • 33. Do While Loop http://eglobiotraining.com/
  • 34. While Loop LINK: http://www.exfors ys.com/tutorials/c -plus- plus/looping-in- c.html http://eglobiotraining.com/
  • 35. While Loop http://eglobiotraining.com/
  • 36. Break and Continue LINK: http://cprogrammingl anguage.net/c- break-continue- statements.aspx http://eglobiotraining.com/
  • 37. Break and Continue http://eglobiotraining.com/
  • 38. For Each Loop LINK: http://www.w3schools.co m/php/php_looping_for.a sp http://eglobiotraining.com/
  • 39. For Each Loop http://eglobiotraining.com/
  • 40. You have to consider languages to run or write your own program, most demanded language in programming is the DEV C++ (a full-featured Integrated Development Environment (IDE)). C++ is one of the most used programming languages in the world. Also known as "C with Classes". New to programming or thinking about it? It might surprise you to know that there are many programmers who program just for fun and it can lead to a job.
  • 41. Looping Loops are used to repeat a block of code. Being able to have your program repeatedly execute a block of code is one of the most basic but useful tasks in programming -- many programs or websites that produce extremely complex output (such as a message board) are really only executing a single task many times.
  • 42. Looping Statement • In doing the looping statement, I noticed that sometimes if the program does not run, it is because some braces are not included and I accidentally put braces on the same line and it causes the program not to read its contents. Programming is sensitive, when there is missing variable or braces or some words it does not run.
  • 43. Looping Statement • When I learned that programming is very sensitive and at the same time very detailed when it comes to entering codes, I make sure that it is clear means that I put everything important codes in it so that the program would run. • So much codes that should be entered that even the spaces are needed programming is very specific that whatever you have entered in to it you should specify because when the statement is false it wouldn’t let you run the program, I have experienced it before I arrived at this result.
  • 44. Switch Cases • In programming the switch case missing out a break statement causes control to fall through to the next case label. Switches can always be replaced by nested if- else statements, but in some cases this may be more clumsy. Each break statement terminates the enclosing switch statement. The Control flow in programming continues with the first statement • Because of so many experiences I had before this program run, I found programming is also interesting for the more you are practicing to make a program run, the more questions that came up in my mind and try something that will fit to this or entering new codes to make matrix etc… that I know is possible.
  • 45. • I thought learning programming is easy but now I think it’s not that easy because you should always check the codes you encoded before you do some programs, and if you have an error it will run in Dev C++. In programming you will learn a lot here especially if you are a computer addicts .
  • 46. • programming is what makes a computer more than just a simple pocket calculator. In programming Everything that you can do today on a computer someone had to be programmed at one point. • The importance of programming Developing a program involves a series of steps. The programmer defines a problem, plans a solution, codes the program, tests the program and, finally, documents the program. Usually in programming , the programmer defines what he knows and the objective, selects a program to use, debugs the program in stages after completion to ensure no errors are introduced and then documents the design, development and testing of the program. With the ever-changing face of computer technology, programming is an exciting and always challenging environment that few programmers ever dream of leaving.
  • 47. Slide Share  • ► MeoRamos • http://www.slideshare.net/MeoRamos