1 / 45

Introduction to Programming

Introduction to Programming. Lecture 22 Review. Bit wise Manipulation and Assignment Operator. a = a + 1 ; a += 1 ;. Bit Manipulation Operators. &= Bitwise AND Assignment Operator |= Bitwise OR Assignment Operator ^= Bitwise Exclusive OR Assignment Operator.

nicol
Télécharger la présentation

Introduction to Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Programming Lecture 22 Review

  2. Bit wise Manipulation and Assignment Operator

  3. a = a + 1 ; a += 1 ;

  4. Bit Manipulation Operators &= Bitwise AND Assignment Operator |= Bitwise OR Assignment Operator ^= Bitwise Exclusive OR Assignment Operator

  5. Assignment Operator a &= b ; Same as a = a & b ;

  6. Assignment Operator a |= b ; Same as a = a | b ;

  7. Assignment Operator a ^= b ; Same as a = a ^ b ;

  8. Design Recipes • Analyze a problem statement, typically expressed as a word problem • Express its essence, abstractly and with examples • Formulatestatements and comments in a precise language • Evaluate and revise the activities in the light of checks and tests. • PAY ATTENTION TO DETAIL

  9. Variables

  10. Symbolic Names x i BasicPay HouseRent

  11. Data types • Whole numbers: • int, short, long, unsigned • Real Numbers (with decimal points) • float, double • Character data • char

  12. int = 4 bytes char = 1 byte

  13. ASCII Table

  14. ArraysCollection of same data types

  15. Arithmetic Operators Plus + Minus - Multiply * Divide / Modulus %

  16. Modulus Operator a % b ; 7 % 2 = 1 ; 100 % 20 = 0 ;

  17. Compound Arithmetic Operators += -= *= /= %=

  18. Compound Arithmetic Operators a = a + b ; a += b ;

  19. Logical Operators AND && OR ||

  20. Comparison Operators a < b ; a <= b ; a == b ; a >= b ; a > b ;

  21. a = b;

  22. if ( a = b ) //Wrong //Logical Error

  23. a > b ; a >= b ;

  24. Bit wise Operators Bit wise AND & (Binary) Bit wise OR | (Binary) Bit wise Exclusive OR ^ (Binary) NOT ~ (unary)

  25. Sequential Construct • Decision Construct • Loop Construct

  26. If-statement if ( condition ) { statement ( s ) ; }

  27. If-else if ( condition ) { statement ( s ) ; } else { statement ( s ) ; }

  28. if ( a > b && c < d )

  29. Nested if statements

  30. if ( condition ) { statement ( s ) ; if ( condition ) { statement ( s ) ; } statement ( s ) ; }

  31. While Loops while ( a > b ) { statement ( s ) ; }

  32. While Loops While loop executes zero or more times

  33. Do - while do { statement ( s ) ; } while ( condition ) ;

  34. Do - while Do-while loop executes one or more times

  35. For Loops for ( i = 0 ; i < 10 ; i ++ ; ) { statement ( s ) ; }

  36. i = i + 1 ; • i += 1 ; • i ++ ;

  37. Switch Statement

  38. break ; • continue ;

  39. Functions

  40. Call by value • Call by reference

  41. Arrays

  42. Arrays int a [ 10 ] ; a [ 0 ] ; : a [ 9 ] ;

  43. Pointers

  44. Pointers Memory address of a variable is stored inside a pointer

  45. Files and their Input / Output systems

More Related