Using variable Variables are used to store values.

Slides:



Advertisements
Similar presentations
Computer Programming Mr. José A. Ortiz Morris. Computer Language  Languages that the computer understands.  They are low level languages. (BINARY 1.
Advertisements

C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Lab 8 User Defined Function.
COMP 4—Power Tools for the Mind1 PowerTools What’s in the Box? Turing 1: An Introduction to Programming You will learn elementary computer programming.
Python November 14, Unit 7. Python Hello world, in class.
An intro to programming The basic nitty-gritty that’ll make you scratch your head and say, “This is programming?”
1 Key Concepts:  Data types in C.  What is a variable?  Variable Declaration  Variable Initialization  Printf()  Scanf()  Working with numbers in.
Computing Theory: BBC Basic Coding Year 11. Lesson Objective You will: Be able to define what BBC basic is Be able to annotate BBC basic code Be able.
From Scratch to Python Learn to program like the big boys / girls!
Lab 3 Instructions Drill: Write a letter
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
Copyright 1999 by Larry Fuhrer. Pascal Programming Getting Started...
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
Introduction to Pascal The Basics of Program writing.
Lesson 6. Python 3.3 Objectives. In this lesson students will learn how to output data to the screen and request input from the user. Students will also.
Programming Review. Java Class Structure All Java statements are part of a class public class ClassName { }
Variables Damian Gordon. Variables We know what a variable is from maths. We’ve all seen this sort of thing in algebra: 2x – 10 = 0 2x = 10 X = 5.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
Please log on The. AN INTRODUCTION TO ‘Python is a high-level, general purpose programming language’ Python is one of the many programming languages.
1/28: Inputs, Variable Types, etc. Addition.java in depth Variable types & data types Input from user: how to get it Arithmetic operators.
CSC1030 HANDS-ON INTRODUCTION TO JAVA Introductory Lab.
Variables in Java x = 3;. What is a variable?  A variable is a placeholder in memory used by programmers to store information for a certain amount of.
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
Assignment statement and Arithmetic operation 1 The major part of data processing.
C++ Basics Tutorial 5 Constants. Topics Covered Literal Constants Defined Constants Declared Constants.
Math, Data Types. Python Math Operations OperationOperator Addition + Subtraction – Multiplication * Division (floating point) / Division (integer) //
1 CSC103: Introduction to Computer and Programming Lecture No 24.
Variables 1. What is a variable? Something whose value can change over time This value can change more than once over the time period (no limit!) Example:
Creating a mystic meg program A simple program asking the user questions and using their answers to build up a fortune telling in a list.
Data Types and Conversions, Input from the Keyboard If you can't write it down in English, you can't code it. -- Peter Halpern If you lie to the computer,
Overloading a constructor If a constructor is overloaded, then an if statement in the client is needed when creating the object. We have always declared.
Variables in VB. What is a variable? ► A named memory location that stores a value.
POINTERS IN C. Introduction  A pointer is a variable that holds a memory address  This address is the location of another object (typically another.
Computer Science 1000 Algorithms III. Multiple Inputs suppose I ask you to write a program that computes the area of a rectangle area = length * width.
GCSE Computing: Programming GCSE Programming Remembering Python.
Simple “VICO” (“VIPO”) Programs (Variables, Input, Calculating or Processing, Output)
Variables.. Part 2 Calculations. Review of yesterday Three types of variables var num:int var average:real var username:string No decimals Might have.
FOR LOOPS "LOOP FOR A SET NUMBER OF TIMES.". FOR ( START_VALUE; END_VALUE; INCREMENT_NUMBER ) { //YOUR_CODE_HERE } So after the word "for" (in lowercase)
Input and Output Output Prompt: –A message displayed to the user indicating what they are to enter. Should be clear and exact on what you want. write:
CCSA 221 Programming in C CHAPTER 3 COMPILING AND RUNNING YOUR FIRST PROGRAM 1 ALHANOUF ALAMR.
Input, Output and Variables GCSE Computer Science – Python.
Bill Tucker Austin Community College COSC 1315
what is computer programming?
Using the Console.
Data Types and Conversions, Input from the Keyboard
The CONST definition CONST Pi = , City = ‘New York’;
Introduction to Computer Science / Procedural – 67130
Chapter 2 Assignment and Interactive Input
Chapter 2 Overview of C.
Variables, Expressions, and IO
Introduction to C++ October 2, 2017.
JavaScript Functions.
Sequential Structures
G7 programing language Teacher / Shamsa Hassan Alhassouni.
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.
CSCE 206 Lab Structured Programming in C
Class Examples.
Conversion Check your class notes and given examples at class.
C Programming Pointers
User Input Keyboard input.
Variables and Computer Memory
Unit 3: Variables in Java
Data Types and Maths Programming Guides.
CSCE 206 Lab Structured Programming in C
Input, Variables, and Mathematical Expressions
GCSE Computing Mini Assignment.
Getting Started With Coding
Presentation transcript:

Using variable Variables are used to store values

x : = 7 x is the variable. x is assigned the value of 7 7 Think of x as being a box with a 7 inside it

number : = 7.4 The variable called number is assigned the value of The name of this box is number

student: = “B. Orr” The variable called student is assigned the value of “B. Orr” B. Orr The name of this box is student

Variables in Turing Must be declared Three main types – int for integer (a number with no decimals) – real for any number that might have a decimal – string for any variable that might have letters in it Ex. var n: int var radius:real var schoolname:string

What type of variable would you use? 1.To store the price of a milk shake? 2.To store the number of students in a class 3.To store the name of a horse? 4.To store the average of five numbers? 5.To store the number of songs you have in iTunes?

Using the get statement (1) We’ve seen the put statement for output The get statement is for input Example … ask the user for their age var age:int put "Please tell me your age“.. get age put "You are ", age, " years old"

Using the get statement (2) We’ve seen the put statement for output The get statement is for input Example … ask the user for their average mark var mark:real put “What is your average?" get mark put "Your mark is ",mark

Using the get statement (3) We’ve seen the put statement for output The get statement is for input Example … ask the user for their name and address var nme, add:string put “What is your name?" get nme put “What is your address?" get add put “Your name is “, nme,” and you live at “,add

Sample problem Ask the user for their name, their age and their favourite TV show. Print the information on a clear screen. var nme, tvshow:string var ageLint put “What is your name?”.. get nme put “Tell me your favourite TV show”.. get tvshow put “How old are you?” get age put “Thanks “, nme, “ you are “, age, “ years old and you like to watch “,tvshow