Variables, Input, and Output. Challenge: ● Ask the user his or her name, and repeat that name to the user ● Pause video and try.

Slides:



Advertisements
Similar presentations
This Time Whitespace and Input/Output revisited The Programming cycle Boolean Operators The “if” control structure LAB –Write a program that takes an integer.
Advertisements

Variables i)Numeric Variable ii)String Variable
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Hand Crafting your own program By Eric Davis for CS103.
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
Constants Variables change, constants don't final = ; final double PI = ; … area = radius * radius * PI; see Liang, p. 32 for full code.
Python November 14, Unit 7. Python Hello world, in class.
Introduction to Python
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
Game Programming © Wiley Publishing All Rights Reserved. The L Line The Express Line to Learning L Line L.
Input/Output  Input/Output operations are performed using input/output functions  Common input/output functions are provided as part of C’s standard.
A Variable is symbolic name that can be given different values. Variables are stored in particular places in the computer ‘s memory. When a variable is.
Input & Output: Console
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
The string data type String. String (in general) A string is a sequence of characters enclosed between the double quotes "..." Example: Each character.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Module 4 Constants Copy Statement Perform Verb Part 1.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
Chapter 2. C++ Program Structure C++ program is a collection of subprograms Subprograms in C++ are called FUNCTIONS Each function performs a specific.
Chapter 2: Java Fundamentals
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.
VARIABLES Programmes work by manipulating data placed in memory. The data can be numbers, text, objects, pointers to other memory areas, and more besides.
Variables and Data Types Data (information we're going to store) – Numbers – Text – Dates What types of data can JavaScript process? How do we store it?
Data Structure and c K.S.Prabhu Lecturer All Deaf Educational Technology.
CSCI 3133 Programming with C Instructor: Bindra Shrestha University of Houston – Clear Lake.
Chapter 2 Variables.
Math, Data Types. Python Math Operations OperationOperator Addition + Subtraction – Multiplication * Division (floating point) / Division (integer) //
ITEC 109 Lecture 7 Operations. Review Variables / Methods Functions Assignments –Purpose? –What provides the data? –What stores the data? –What type of.
Operators and Expressions. 2 String Concatenation  The plus operator (+) is also used for arithmetic addition  The function that the + operator performs.
MULTIPLYING INTEGERS LESSON 2-4, P. 83. RULES When multiplying integers with like (the same) signs, the product (answer) will be positive. EX.) negative.
Python Let’s get started!.
Variables and Strings. Variables  When we are writing programs, we will frequently have to remember a value for later use  We will want to give this.
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
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,
Lecture 5 Computer programming -1-. Input \ Output statement 1- Input (cin) : Use to input data from keyboard. Example : cin >> age; 2- Output (cout):
GCSE Computing: Programming GCSE Programming Remembering Python.
Literals A literal (sometimes called a constant) is a symbol which evaluates to itself, i.e., it is what it appears to be. Examples: 5 int literal
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Chapter 2: Data and Expressions. Variable Declaration In Java when you declare a variable, you must also declare the type of information it will hold.
A Sample Program #include using namespace std; int main(void) { cout
Input, Output and Variables GCSE Computer Science – Python.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
JUST BASIC Lessons 6 – 9 Mr. Kalmes.
Chapter 2 Variables.
Using the Console.
Python Let’s get started!.
Data Types and Conversions, Input from the Keyboard
Chapter 3: Variables, Functions, Math, and Strings
Variables, Expressions, and IO
Microsoft Visual Basic 2005 BASICS
OUTPUT STATEMENTS GC 201.
Input/Output Input/Output operations are performed using input/output functions Common input/output functions are provided as part of C’s standard input/output.
Examples of Primitive Values
Building Java Programs
Chapter 2 Variables.
Microsoft Visual Basic 2005 BASICS
Introduction to Primitive Data types
Coding Concepts (Data- Types)
Chapter 2: Introduction to C++.
7 – Variables, Input and Output
Unit 3: Variables in Java
Chapter 2 Variables.
Data Types and Maths Programming Guides.
An Introduction to Programming
L L Line CSE 420 Computer Games Lecture #3 Introduction to Python.
Variables and Constants
Introduction to Primitive Data types
Presentation transcript:

Variables, Input, and Output

Challenge: ● Ask the user his or her name, and repeat that name to the user ● Pause video and try

Input ● Asks the user a question (input implies output!) ● Stores answer in a variable ● You can't use input if you haven't created the variable

Input Requires ● A question ● A variable to put answer in

Variable ● A place in memory to hold things ● Like a container ● Different containers for different stuff ● Has a name

Variables require: ● Name – descriptive ● Init – starting value ● Type – kind of data (string, numeric) ● Purpose – or description

String Data ● Text ● Series of alphanumeric characters ● Usually enclosed in quotes (“”) ● Size depends on length of text

Numeric Data ● Integer (+/-,0, no decimals) ● Long Integer ● Float (includes decimal values) ● Double ● Size depends on type of number

Challenge: ● Ask the user his or her name. ● Reply “Hello, ” Where is the user name. ● Username should be incorporated into greeting

Sample Run ● Comp: what is your name? ● User: Marsha ● Comp: Hi Marsha! ● Pause video and try

String Concatenation ● Technique for combining text ● “a” + “b” = “ab” ● Frequently uses the plus sign ● Can be used to combine variables and literals: ● “Hi, “ + userName + “!”