Introduction to Programming

Slides:



Advertisements
Similar presentations
08/2012Tanya Mishra1 EASYC for VEX Cortex Llano Estacado RoboRaiders FRC Team 1817.
Advertisements

Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
Types and Variables. Computer Programming 2 C++ in one page!
10-Jun-15 Introduction to Primitives. 2 Overview Today we will discuss: The eight primitive types, especially int and double Declaring the types of variables.
Introduction to Primitives. Overview Today we will discuss: –The eight primitive types, especially int and double –Declaring the types of variables –Operations.
How Create a C++ Program. #include using namespace std; void main() { cout
COMPUTER PROGRAMMING. Data Types “Hello world” program Does it do a useful work? Writing several lines of code. Compiling the program. Executing the program.
Variables and Data Types
CIS Computer Programming Logic
Lecture 2 Introduction to Computer Programming CUIT A.M. Gamundani Presentation Layout Data types.
Representing numbers and Basic MATLAB 1. Representing numbers  numbers used by computers do not behave the same as numbers used in mathematics  e.g.,
CSE 1301 Lecture 2 Data Types Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Chapter 6 Fundamental Types Dept of Computer Engineering Khon Kaen University.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
Lecture #5 Introduction to C++
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
1 C++ Syntax and Semantics, and the Program Development Process.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Course Title: Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
Primitive Variables.
Ch Chapter 4 Basic Data Types and Variables 4.1 Basic Data Types In C TABLE 4.1 Introduction to Basic Data Types in C Type SizeDescription char 1.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Lecture 3 Introduction to Computer Programming CUIT A.M. Gamundani Presentation Layout from Lecture 1 Background.
CSI 3125, Preliminaries, page 1 Data Type, Variables.
1.2 Primitive Data Types and Variables
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
Types Chapter 2. C++ An Introduction to Computing, 3rd ed. 2 Objectives Observe types provided by C++ Literals of these types Explain syntax rules for.
Types Chapter 2. C++ An Introduction to Computing, 3rd ed. 2 Objectives Observe types provided by C++ Literals of these types Explain syntax rules for.
1 MT258 Computer Programming and Problem Solving Tutorial 03.
Data Types Always data types will decide which type of information we are storing into variables In C programming language we are having 3 types of basic.
Variables  A piece of memory set aside to store data  When declared, the memory is given a name  by using the name, we can access the data that sits.
 Data Type is a basic classification which identifies different types of data.  Data Types helps in: › Determining the possible values of a variable.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Integer VariablestMyn1 Integer Variables It must be possible to store data items in a program, and this facility is provided by variables. A variable is.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Constants, Data Types and Variables
Topics Designing a Program Input, Processing, and Output
The Machine Model Memory
Variables Mr. Crone.
Review C/C++ Programming Language
BASIC ELEMENTS OF A COMPUTER PROGRAM
Data Types, Arithmetic Operations
ITEC113 Algorithms and Programming Techniques
Revision Lecture
ICS103 Programming in C Lecture 3: Introduction to C (2)
CSCI 161: Introduction to Programming
CSE101-Lec#3 Components of C Identifiers and Keywords Data types.
Introduction to the C Language
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Introduction to Programming
Computers & Programming Languages
Windows Programming Lecture 02.
CS111 Computer Programming
Chapter 2: Java Fundamentals
Chapter # 2 Part 2 Programs And data
Chapter 2: Java Fundamentals
Topics Designing a Program Input, Processing, and Output
ECE 103 Engineering Programming Chapter 8 Data Types and Constants
Topics Designing a Program Input, Processing, and Output
Introduction to Primitives
Introduction to Primitives
C Programming Pointers
Variables and Computer Memory
© A+ Computer Science - Variables & Data Types © A+ Computer Science - ©A+ Computer Science
Unit 3: Variables in Java
Variables in C Topics Naming Variables Declaring Variables
C Programming Lecture-3 Keywords, Datatypes, Constants & Variables
Variables and Constants
Introduction to Pointers
Getting Started With Coding
Presentation transcript:

Introduction to Programming Engineering 1020 Introduction to Programming Peter King peter.king@mun.ca www.engr.mun.ca/~peter Winter 2010

ENGI 1020: Variables Functions have two main components Data – blocks of information Numbers, letters Instructions – task to be completed on the data Mathematical, logical, display Takes data and generates new data Variables are the means we use to store data

ENGI 1020: Variables Variables offer a place to hold data Data in a variable can change You might say they're variable Variables can hold data from a specified set of values (its type) Variables must be declared before they can be used

ENGI 1020: Variables Type Variables are like bins for storing data Different data goes in different bins Big data, big bins Small data, small bins Int … -3, -2, -1, 0, 1, 2, 3, ..... Computer places limit on max/min Long Same as int, but longer (bigger bin)

ENGI 1020: Variables Float Double Char -3.2111, 0.198734, 5.6, 7.0 Real numbers Computer places limit on max/min Double Sames as float, but double the precision More decimal places Limited by computer Char All symbols that can be printed to screen Letter, numbers, punctuation Special chars (\n, \t)

ENGI 1020: Variables CHAR_BIT Number of bits for a char object (byte) 8 INT_MIN Minimum value for an object of type int -32767 INT_MAX Maximum value for an object of type int 32767 UINT_MAX Maximum value for an object of type unsigned int 65535 LONG_MIN Minimum value for an object of type long int -2147483647 LONG_MAX Maximum value for an object of type long int 2147483647 ULONG_MAX Maximum value for an object of type unsigned long int 4294967295

ENGI 1020: Variables Variables have 4 attributes Name Address Type Given by the human Address Assigned by the compiler Type Chosen by the human Value Set by human, computer, function, expression, etc. The power of variables is that the value changes, but the name, type, address stay the same

ENGI 1020: Variables We must declare variables before use Type name = expression The type is chosen for the particular application The name follows the rules and makes sense The expression sets the initial value Not required, but a good idea. The computer will assign a new variable an address The compiler keeps track of what address the variable points to char c; int x = 0; double y = 1.5 + 2.0;

ENGI 1020: Variables bins

ENGI 1020: Variables Examples from online notes