Your SlideShare is downloading. ×
0
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Fundamentals of programming
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Fundamentals of programming

265

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
265
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. FUNDAMENTALS OF PROGRAMMINGSubmitted By: Kristine Concepcion G. ParconSubmitted To: Prof. Erwin Globiohttp://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 CASESTATEMENT http://emglobio.mdl2.com/
  • 8. 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 STATEMENTSEXAMPLE http://emglobio.mdl2.com/
  • 14. 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 loop2. while loop3. 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.

×