1 / 10

Introduction to Programming Aideen nasirishargh

Tuesday, 8 st of Aban 2 nd TA Session. Introduction to Programming Aideen nasirishargh. Let’s start real coding!. In last session, we did: Met with Memory and CPU Met with C++ and compared it, somehow, w/ C and Java Met with editors and compilers. Suggested DevCpp .

adonia
Télécharger la présentation

Introduction to Programming Aideen nasirishargh

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. Tuesday, 8stof Aban 2ndTA Session Introduction to Programming Aideen nasirishargh

  2. Let’s start real coding! • In last session, we did: • Met with Memory and CPU • Met with C++ and compared it, somehow, w/ C and Java • Met with editors and compilers. Suggested DevCpp. • Learnt how to run a “Hello World!” program and compile it! • In this session, we’re planned to: • What’s a program and how/who questions about its exec! • Meet with assignments and operators • Meet with if – The decision statement • While, as a repeating structure

  3. The story: This program works!

  4. How a program works • Algorithm! • What’s it? (water boiling sample!) • Computer is a logical machine and can hear only 0s and 1s, and nothing in the middle! • A computer Program • One ordered set of instructions to be executed one after another • They’ll be translated into assembly codes but we an consider them as is (i.e. complicated commands in one line!) • Each instruction: • Gives an info to machine (e.g. defining new variable) • Changes the status of the Machine (its memory, its running line) • Program Counter, a built-in variable for the program, • It’s auto-incremental

  5. Sequential statements • Samples: • Calculation of a math formula! • Swap! • How to improve it?! • Solving a 2nd order equation

  6. Is all running methods, top to bottom?! • How to skip one or more lines? • How to decide what to run, based on current state of machine (e.g. value of the variables) • Solution: if! • Let’s see an example… • Find equality • Find max, min • Find oddity If, this is the problem!

  7. Doing something until getting to a wanted statement! That is “iteration”! Another core of programming. Syntax? While

  8. Let’s do examples! Practice is all that matter…

  9. Find number of bits a number needs • Number of digits • Sum of digits • Reverse number (1435 => 5341) • Prime Number • optimizations Practice

  10. Thank you! Let’s go for some sleep :D Any question?

More Related