SlideShare una empresa de Scribd logo
1 de 17
FUNDAMENTALS OF
 PROGRAMMING



Submitted By: Kristine Concepcion G. Parcon
Submitted To: Prof. Erwin Globio
http://emglobio.mdl2.com/
C Language
   A high-level programming language developed by Dennis
    Ritchie at Bell Labs in the mid 1970s. Although originally
    designed as a systems programming language, C has proved
    to be a powerful and flexible language that can be used for a
    variety of apllications, from business programs to
    engineering. C is a particularly popular language for personal
    computer programmers because it is relatively small -- it
    requires less memory than other languages.
   The first major program written in C was the UNIX operating
    system, and for many years C was considered to be
    inextricably linked with UNIX. Now, however, C is an
    important language independent of UNIX.
   Although it is a high-level language, C is much closer
    to assembly language than are most other high-level
    languages. This closeness to the underlying machine
    language allows C programmers to write very efficient code.
    The low-level nature of C, however, can make the language
    difficult to use for some types of applications.
                          http://emglobio.mdl2.com/
   C language is a computer programming language
    that was developed in 1972. It is used to develop
    application and system software, and has lead to
    the development of other languages, including
    C++.
   C is a high-level programming language that was
    developed in the mid-1970s. It was originally used
    for writing Unix programs, but is now used to write
    applications for nearly every available platform.
    Compared to most previous languages, C is
    easier to read, more flexible (can be used for a
    wide variety of purposes), and more efficient at
    using memory. http://emglobio.mdl2.com/
   C++, pronounced "C plus plus," is a
    programming language that was built off the C
    language. The syntax of C++ is nearly identical
    to C, but it has object-oriented features, which
    allow the programmer to create objects within
    the code. This makes programming easier,
    more efficient, and some would even say,
    more fun. Because of the power and flexibility
    of the language, most software programs
    today are written in C++.
                   http://emglobio.mdl2.com/
SWITCH CASE STATEMENTS
      In                                         programming,
    a switch, case, select or inspect statement is a type of
    selection     control    mechanism       that    exists   in
    most imperative programming languages. 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 reasons for
    using a switch include improving clarity, by reducing
    otherwise repetitive coding, and (if the heuristics permit)
    also offering the potential for faster execution through
    easier complier optimization in many cases.
                       http://emglobio.mdl2.com/
      Unlike if-then and if-then-else statements,
    the switch statement can have a number of
    possible execution paths. A switch works with
    the byte, short, char, andint primitive data
    types. It also works with enumerated types.
   (programming)switch statement - (Or case
    statement, multi-way branch) A construct found
    in most high-level languages for selecting one
    of several possible blocks of code or branch
    destinations depending on the value of an
    expression.
                   http://emglobio.mdl2.com/
SAMPLE SWITCH CASE
STATEMENT




        http://emglobio.mdl2.com/
http://emglobio.mdl2.com/
   C/C++ has a built-in multiple-branch selection
    statement, called switch, which successively tests the
    value of an expression against a list of integer
    or character constants. When a match is found, the
    statements associated with that constant are executed.
   The expression must evaluate to a character or integer
    value. Floating-point expressions, for example, are not
    allowed. The value of expression is tested, in order,
    against the values of the constants specified in the
    case statements. When a match is found, the statement
    sequence associated with that case is executed until
    the break statement or the end of the switch statement
    is reached. The default statement is executed if no
    matches are found. The default is optional and, if it is
    not present, no action takes place if all matches fail.
                      http://emglobio.mdl2.com/
LOOPING STATEMENTS
   In computer science a for loop is a programming language
    statement which allows code to be repeatedly executed. A for
    loop is classified as an iteration statement.
   Unlike many other kinds of loops, such as the while loop, the
    for loop is often distinguished by an explicit loop counter or
    loop variable. This allows the body of the for loop (the code
    that is being repeatedly executed) to know about the
    sequencing of each iteration. For loops are also typically used
    when the number of iterations is known before entering the
    loop. For loops are the shorthand way to make loops when
    the number of iterations is known, as a for loop can be written
    as a while loop.
   The name for loop comes from the English word for, which is
    used as the keyword in most programming languages to
    introduce a for loop. The loop body is executed "for" the given
    values of the loop variable, though this is more explicit in
    the ALGOL version of the statement, in which a list of possible
                          http://emglobio.mdl2.com/
    values and/or increments can be specified.
   Very often when you write code, you want the
    same block of code to run a number of times.
    You can use looping statements in your code
    to do this.
   In JavaScript we have the following looping
    statements:
   while - loops through a block of code while a
    condition is true
   do...while - loops through a block of code
    once, and then repeats the loop while a
    condition is true
   for - run statements a specified number of
                    http://emglobio.mdl2.com/
   A loop is a way of repeating a statement a number
    of times until some way of ending the loop occurs.
    It might be run for a preset number of times,
    typically in a for loop, repeated as long as
    an expression is true (a while loop) or repeated
    until an expression becomes false in a do
    while loop.
   Using a label, a Goto Statement can also create a
    loop by jumping backwards to a label though this
    is generally discouraged as a bad programming
    practice. For some complex code it allows a jump
    to a common exit point that simplifies the code.
                   http://emglobio.mdl2.com/
LOOPING STATEMENTS
EXAMPLE




       http://emglobio.mdl2.com/
http://emglobio.mdl2.com/
 By using special loop keywords,you can loop
  (jumping for those assembly junkies) through
  your code. These include following categories:
1. for loop
2. while loop
3. do while.




                http://emglobio.mdl2.com/
   The for statement allows for the controlled
    loop. The syntax for for loop is as follows: for
    (start condition; continue condition; re-
    evaluation)
    program statement.
   For repeating C statements whiles a condition
    is true,the while provides a the necessary
    mechanism. The syntax for while loop is as
    follows: while (condition)
    program statement.
   The do {} while statement allows a loop to
    continue whilst a condition evaluates as TRUE
    (non-zero value). The loop will exacute at least
    once The syntax is as follows: do {
    /* do stuff */
    } while (statement)
   The do statement is similar to the while statement
    except that its termination condition is at the end
    of the body of the loop only. Thus, you want to use
    a do statement,if you want to perform the body of
    the loop at least once, regardless of the condition.

Más contenido relacionado

La actualidad más candente

An introduction on language processing
An introduction on language processingAn introduction on language processing
An introduction on language processing
Ralf Laemmel
 
Migrating From Cpp To C Sharp
Migrating From Cpp To C SharpMigrating From Cpp To C Sharp
Migrating From Cpp To C Sharp
Ganesh Samarthyam
 

La actualidad más candente (20)

difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothWeb programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh Maloth
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
An introduction on language processing
An introduction on language processingAn introduction on language processing
An introduction on language processing
 
single pass compiler and its architecture
single pass compiler and its architecturesingle pass compiler and its architecture
single pass compiler and its architecture
 
Web Programming UNIT VIII notes
Web Programming UNIT VIII notesWeb Programming UNIT VIII notes
Web Programming UNIT VIII notes
 
Apa style-1 (1)
Apa style-1 (1)Apa style-1 (1)
Apa style-1 (1)
 
Source vs object code
Source vs object codeSource vs object code
Source vs object code
 
C programming
C programming C programming
C programming
 
Lecture 1 progrmming with C
Lecture 1 progrmming with C Lecture 1 progrmming with C
Lecture 1 progrmming with C
 
Migrating From Cpp To C Sharp
Migrating From Cpp To C SharpMigrating From Cpp To C Sharp
Migrating From Cpp To C Sharp
 
Unit 2 l1
Unit 2 l1Unit 2 l1
Unit 2 l1
 
What is turbo c and how it works
What is turbo c and how it worksWhat is turbo c and how it works
What is turbo c and how it works
 
Computer programming - turbo c environment
Computer programming - turbo c environmentComputer programming - turbo c environment
Computer programming - turbo c environment
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
 
File handling With Solve Programs
File handling With Solve ProgramsFile handling With Solve Programs
File handling With Solve Programs
 
Go Language presentation
Go Language presentationGo Language presentation
Go Language presentation
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notes
 

Similar a Fundamentals of programming

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
 
Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02
thinesonsing
 
Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch cases
MeoRamos
 
Mark asoi ppt
Mark asoi pptMark asoi ppt
Mark asoi ppt
mark-asoi
 
Fundamentals of programming finals.ajang
Fundamentals of programming finals.ajangFundamentals of programming finals.ajang
Fundamentals of programming finals.ajang
Jaricka Angelyd Marquez
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.
gerrell
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kim
kimberly_Bm10203
 

Similar a Fundamentals of programming (20)

Switch case looping
Switch case loopingSwitch case looping
Switch case looping
 
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
 
Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02
 
Deguzmanpresentationprogramming
DeguzmanpresentationprogrammingDeguzmanpresentationprogramming
Deguzmanpresentationprogramming
 
Survelaine murillo ppt
Survelaine murillo pptSurvelaine murillo ppt
Survelaine murillo ppt
 
Fundamentals of programming final
Fundamentals of programming finalFundamentals of programming final
Fundamentals of programming final
 
Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch cases
 
Final requirement
Final requirementFinal requirement
Final requirement
 
Mark asoi ppt
Mark asoi pptMark asoi ppt
Mark asoi ppt
 
Fundamentals of programming finals.ajang
Fundamentals of programming finals.ajangFundamentals of programming finals.ajang
Fundamentals of programming finals.ajang
 
Switch case and looping jam
Switch case and looping jamSwitch case and looping jam
Switch case and looping jam
 
C Language Presentation.pptx
C Language Presentation.pptxC Language Presentation.pptx
C Language Presentation.pptx
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping new
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kim
 
Loops
LoopsLoops
Loops
 
The Loops
The LoopsThe Loops
The Loops
 
Project
ProjectProject
Project
 

Fundamentals of programming

  • 1. FUNDAMENTALS OF PROGRAMMING Submitted By: Kristine Concepcion G. Parcon Submitted To: Prof. Erwin Globio http://emglobio.mdl2.com/
  • 2. C Language  A high-level programming language developed by Dennis Ritchie at Bell Labs in the mid 1970s. Although originally designed as a systems programming language, C has proved to be a powerful and flexible language that can be used for a variety of apllications, from business programs to engineering. C is a particularly popular language for personal computer programmers because it is relatively small -- it requires less memory than other languages.  The first major program written in C was the UNIX operating system, and for many years C was considered to be inextricably linked with UNIX. Now, however, C is an important language independent of UNIX.  Although it is a high-level language, C is much closer to assembly language than are most other high-level languages. This closeness to the underlying machine language allows C programmers to write very efficient code. The low-level nature of C, however, can make the language difficult to use for some types of applications. http://emglobio.mdl2.com/
  • 3. C language is a computer programming language that was developed in 1972. It is used to develop application and system software, and has lead to the development of other languages, including C++.  C is a high-level programming language that was developed in the mid-1970s. It was originally used for writing Unix programs, but is now used to write applications for nearly every available platform. Compared to most previous languages, C is easier to read, more flexible (can be used for a wide variety of purposes), and more efficient at using memory. http://emglobio.mdl2.com/
  • 4. C++, pronounced "C plus plus," is a programming language that was built off the C language. The syntax of C++ is nearly identical to C, but it has object-oriented features, which allow the programmer to create objects within the code. This makes programming easier, more efficient, and some would even say, more fun. Because of the power and flexibility of the language, most software programs today are written in C++. http://emglobio.mdl2.com/
  • 5. SWITCH CASE STATEMENTS  In programming, a switch, case, select or inspect statement is a type of selection control mechanism that exists in most imperative programming languages. 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 reasons for using a switch include improving clarity, by reducing otherwise repetitive coding, and (if the heuristics permit) also offering the potential for faster execution through easier complier optimization in many cases. http://emglobio.mdl2.com/
  • 6. Unlike if-then and if-then-else statements, the switch statement can have a number of possible execution paths. A switch works with the byte, short, char, andint primitive data types. It also works with enumerated types.  (programming)switch statement - (Or case statement, multi-way branch) A construct found in most high-level languages for selecting one of several possible blocks of code or branch destinations depending on the value of an expression. http://emglobio.mdl2.com/
  • 7. SAMPLE SWITCH CASE STATEMENT http://emglobio.mdl2.com/
  • 9. C/C++ has a built-in multiple-branch selection statement, called switch, which successively tests the value of an expression against a list of integer or character constants. When a match is found, the statements associated with that constant are executed.  The expression must evaluate to a character or integer value. Floating-point expressions, for example, are not allowed. The value of expression is tested, in order, against the values of the constants specified in the case statements. When a match is found, the statement sequence associated with that case is executed until the break statement or the end of the switch statement is reached. The default statement is executed if no matches are found. The default is optional and, if it is not present, no action takes place if all matches fail. http://emglobio.mdl2.com/
  • 10. LOOPING STATEMENTS  In computer science a for loop is a programming language statement which allows code to be repeatedly executed. A for loop is classified as an iteration statement.  Unlike many other kinds of loops, such as the while loop, the for loop is often distinguished by an explicit loop counter or loop variable. This allows the body of the for loop (the code that is being repeatedly executed) to know about the sequencing of each iteration. For loops are also typically used when the number of iterations is known before entering the loop. For loops are the shorthand way to make loops when the number of iterations is known, as a for loop can be written as a while loop.  The name for loop comes from the English word for, which is used as the keyword in most programming languages to introduce a for loop. The loop body is executed "for" the given values of the loop variable, though this is more explicit in the ALGOL version of the statement, in which a list of possible http://emglobio.mdl2.com/ values and/or increments can be specified.
  • 11. Very often when you write code, you want the same block of code to run a number of times. You can use looping statements in your code to do this.  In JavaScript we have the following looping statements:  while - loops through a block of code while a condition is true  do...while - loops through a block of code once, and then repeats the loop while a condition is true  for - run statements a specified number of http://emglobio.mdl2.com/
  • 12. A loop is a way of repeating a statement a number of times until some way of ending the loop occurs. It might be run for a preset number of times, typically in a for loop, repeated as long as an expression is true (a while loop) or repeated until an expression becomes false in a do while loop.  Using a label, a Goto Statement can also create a loop by jumping backwards to a label though this is generally discouraged as a bad programming practice. For some complex code it allows a jump to a common exit point that simplifies the code. http://emglobio.mdl2.com/
  • 13. LOOPING STATEMENTS EXAMPLE http://emglobio.mdl2.com/
  • 15.  By using special loop keywords,you can loop (jumping for those assembly junkies) through your code. These include following categories: 1. for loop 2. while loop 3. do while. http://emglobio.mdl2.com/
  • 16. The for statement allows for the controlled loop. The syntax for for loop is as follows: for (start condition; continue condition; re- evaluation) program statement.  For repeating C statements whiles a condition is true,the while provides a the necessary mechanism. The syntax for while loop is as follows: while (condition) program statement.
  • 17. The do {} while statement allows a loop to continue whilst a condition evaluates as TRUE (non-zero value). The loop will exacute at least once The syntax is as follows: do { /* do stuff */ } while (statement)  The do statement is similar to the while statement except that its termination condition is at the end of the body of the loop only. Thus, you want to use a do statement,if you want to perform the body of the loop at least once, regardless of the condition.