Download presentation
Presentation is loading. Please wait.
Published byOphelia York Modified over 8 years ago
1
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Fundamentals of Programming Most programming today is done in High- Level Languages Examples: C++, Java, Visual Basic, LISP, FORTRAN, MATLAB. Basic ideas of programming –data types –variables –control flow
2
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 2 Entry Point All programs have an entry point: where they start executing In C/C++, this is called main The first statement in main is the first to be executed
3
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 3 Data Types Recall that a data type is a set of values and operations C/C++ offers a variety of built-in types –int integer –long long integer (increased range) –float real number (floating point) –double double precision real number –char single character What are some of the operations over each type?
4
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 4 Operations Numerical operators: –+, -, *, /, % (modulus) Automatic increment/decrement, e.g., –i++, i-- Comparison operators: –==, !=,, >=, <= Logical operators: –and ( && ), or ( || ), not ( ! ), xor ( ^ )
5
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 5 Variables Recall the 4x3 memory: each group of bits is a memory cell with a unique location Variable: a name and type associated with a cell (or cells). Examples: –int age; integer value for a person’s age –long wage; long integer for hourly wage –float gpa; real number for student GPA –double inter; double precision for bank interest –char response; holds ‘y’ or ‘n’ response to question
6
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 6 Structured Data Types Two basic types – a collection of the same kind of basic types (array) –a collection of different kinds of types ( struct or record) Example: array of integers –int test_scores[25]; –holds integer values for 25 test scores Example: array of characters –char name[80]; –holds 80 characters to store a student’s name
7
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 7 Control Flow Sequential execution: first statement, next statement, etc. Each statement can actually be a block of statements Conditional branching: if a condition is true, execute one statement; else execute another
8
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 8 Control Flow Looping: while a condition is true, repeat a statement –iterate a fixed number of times –iterate based on a condition that eventually is triggered Subroutine (function) call: execute a named block of statements; return to calling location when done
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.