presentation friday 20 dec 2013 made by haseeb malik

43

Transcript of presentation friday 20 dec 2013 made by haseeb malik

  1. 1. COMPUTER PROGRAMING PRESENTATION # 01 INSTRUCTOR: MR.NADEEM GROUP LEADER: HASEEB TARIQ (UW-13-ME-BSc-14) GROUP MEMBERS: INZAMAM SHOUKAT (UW-13-ME-BSc- RAMSHA HUMAYUN (UW-13-ME-BSc-6) MARYAM ARSHAD (UW-13-ME-BSc-18)
  2. 2. TOPIC OF PRESENTATION: LOOPS
  3. 3. Introduction of loops Types of loops Data type Increment Decrement Conditional statement For loop While loop Counter-Controlled Repetition Do-While loop
  4. 4. LOOPS: Loop cause a section of your program to be repeated certain number of times. The repetition continues while a condition is true. When condition becomes false, the loops ends and control passes to the statements following the loop.
  5. 5. TYPES OF LOOPS: for loop while loop do while loop
  6. 6. Data Types A computer program operates on data and produces an output. In C++, each data must be of specific data type. The data type determines how the data is represented in the computer and kind of processing the computer can perform on it. Types of data integer (int) Float (float) Boolean Characters (char) 7
  7. 7. Integers (int) integers are whole numbers with a range of values. used to store numbers Example: 5, 6, 100, 2500 8
  8. 8. Float used to represent floating point numbers. Examples: 9.1314, 3.1254 9
  9. 9. Character character types can hold a single character. 10
  10. 10. boolean Boolean or Flag type is a type which can represent only two values: 0 and 1, usually identified with false and true respectively. This type can be stored in memory using a single bit. e.g. main() { bool x=true; //or x=false } 11
  11. 11. 12 Variables A storage box, its type defines the kind of stuff you store in it
  12. 12. 13 Variable Variable is a box In computer, a storage box is a memory location on RAM
  13. 13. 14 Memory in Computer First you ask computer to give you a box and you also have to specify what type of box you want Occupied Memory Spaces Free Memory Spaces Each little box is a memory location
  14. 14. Rules for Variable Naming The first character must be letter or underscore ( _ ). You can use upper and lowercase letters and digits from 0 to 9. Identifier can be as long as you like but only the first 250 character are recognizable in C++ Compiler.
  15. 15. Integer Variables Example#include using namespace std; void main ( ) { int var1; //define var1 int var2, var3; //define var2, var3 var1 = 20; //assign value to var1 var2 = var1 + 10; //assign value to var2 cout