Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tuesday, 8 st of Aban 2 nd TA Session.  In last session, we did:  Met with Memory and CPU  Met with C++ and compared it, somehow, w/ C and Java  Met.

Similar presentations


Presentation on theme: "Tuesday, 8 st of Aban 2 nd TA Session.  In last session, we did:  Met with Memory and CPU  Met with C++ and compared it, somehow, w/ C and Java  Met."— Presentation transcript:

1 Tuesday, 8 st of Aban 2 nd TA Session

2  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

4  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  Samples:  Calculation of a math formula!  Swap!  How to improve it?!  Solving a 2 nd 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

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

8

9  Find number of bits a number needs  Number of digits  Sum of digits  Reverse number (1435 => 5341)  Prime Number  optimizations

10 Thank you! Let’s go for some sleep :D


Download ppt "Tuesday, 8 st of Aban 2 nd TA Session.  In last session, we did:  Met with Memory and CPU  Met with C++ and compared it, somehow, w/ C and Java  Met."

Similar presentations


Ads by Google