Objective: Dealing with data in C++ Agenda: Notes Essay Help.

Slides:



Advertisements
Similar presentations
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Advertisements

Java Syntax Part I Comments Identifiers Primitive Data Types Assignment.
CSE202: Lecture 2The Ohio State University1 Variables and C++ Data Types.
CIS 234: Using Data in Java Thanks to Dr. Ralph D. Westfall.
1 9/10/07CS150 Introduction to Computer Science 1 Data Types Section 2.7 – 2.12 CS 150 Introduction to Computer Science I.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
1 Key Concepts:  Data types in C.  What is a variable?  Variable Declaration  Variable Initialization  Printf()  Scanf()  Working with numbers in.
CS150 Introduction to Computer Science 1
Storing data Getting data out Data types Ruby as a foundation Program Variables Click icon to hear comments (the download may take a minute)
CSC 107 – Programming For Science. Announcements  Textbook available from library’s closed reserve.
Java Data Types. Primitive Data Types Java has 8 primitive data types: – char: used to store a single character eg. G – boolean: used to store true or.
CPS120: Introduction to Computer Science
CSC 107 – Programming For Science. Announcements  Memorization is not important, but…  … you will all still be responsible for information  Instead.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
CSE1222: Lecture 2The Ohio State University1. mathExample2.cpp // math example #include using namespace std; int main() { cout
Constants Numeric Constants Integer Constants Floating Point Constants Character Constants Expressions Arithmetic Operators Assignment Operators Relational.
Primitive Variables.
CSC 107 – Programming For Science. Announcements  Memorization is not important, but…  … you will all still be responsible for information  Instead.
 Character set is a set of valid characters that a language can recognise.  A character represents any letter, digit or any other sign  Java uses the.
PHY-102 SAPVariables and OperatorsSlide 1 Variables and Operators In this section we will learn how about variables in Java and basic operations one can.
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.
VARIABLES AND DATA TYPES Chapter2:part1 1. Objectives: By the end of this section you should: Understand what the variables are and why they are used.
CSC 107 – Programming For Science. Announcements.
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
Chapter 2 Variables.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
ITEC 109 Lecture 7 Operations. Review Variables / Methods Functions Assignments –Purpose? –What provides the data? –What stores the data? –What type of.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
Variables and Constants Objectives F To understand Identifiers, Variables, and Constants.
1 09/03/04CS150 Introduction to Computer Science 1 What Data Do We Have.
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
Java – Variables and Constants By: Dan Lunney. Declaring Variables All variables must be declared before they can be used A declaration takes the form:
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Lecture 5 Computer programming -1-. Input \ Output statement 1- Input (cin) : Use to input data from keyboard. Example : cin >> age; 2- Output (cout):
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.
Primitive Data Types 1 In PowerPoint, point at the speaker icon, then click the "Play" button.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
A Sample Program #include using namespace std; int main(void) { cout
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
Introduction C# program is collection of classes Classes are collection of methods and some statements That statements contains tokens C# includes five.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Chapter 2 Variables.
Chapter Topics The Basics of a C++ Program Data Types
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Computing Fundamentals
IDENTIFIERS CSC 111.
2.1 Parts of a C++ Program.
Computers & Programming Languages
Variables in C Topics Naming Variables Declaring Variables
C++ Data Types Data Type
Chapter 2: Java Fundamentals
Variables in C Topics Naming Variables Declaring Variables
Variables T.Najah Al_Subaie Kingdom of Saudi Arabia
Variables Kevin Harville.
Unit 3: Variables in Java
Module 2 Variables, Data Types and Arithmetic
Java: Variables, Input and Arrays
Chapter 2 Variables.
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Data Types and Maths Programming Guides.
Variables in C Topics Naming Variables Declaring Variables
Variables in C Topics Naming Variables Declaring Variables
C Programming Lecture-3 Keywords, Datatypes, Constants & Variables
Variables in C Topics Naming Variables Declaring Variables
Variables and Constants
Variables in C Topics Naming Variables Declaring Variables
Presentation transcript:

Objective: Dealing with data in C++ Agenda: Notes Essay Help

DataTypes Boolean data Keyword: bool True or False Gender type: male or female

Data Types Character data type Keyward: char Individual Numbers (0-9), alphabet, symbols, tab, backspace, enter key Use apostrophe before and after characters: ‘z’

Data Types Integer data ( 0, + and - whole numbers Short, int or long We will usually use int 3.25 (decimal number) is a real number Float are 3.4 X to 3.4 X Double are from 1.7 x to 1.7 x

Data types String Collection of text “Hello World”

Variables Variables store information for the program To create a variable you declare it Usually the first thing done in an event-handler to store input etc. A variable declaration includes data type and mae of variable: int length; int height; int width;

Declaring variables If variables are of the same data type, you can declare them on one line: int height, width, length; More examples: bool female; char middle-initial; int age; float average; double gpa;

Variable Name Rules Must begin with a letter or underscore (_) Can only use letters, digits, or underscore Are case-sensitive DO NOT use a space Each variable name in a program must be unique Can’t use C++ keywords

Initializing Variables Put data into the variable for the first time after it is declared. All numeric variables are initialized to 0 by default Other types must be initialized Can declare and initialize bool female – false; char middle_initial = ‘S”; float average = 98.6; double gpa = 3.42;

More initializations int num1, num2 = 5; REMEMBER: any information put into a textbox is text. A number is still considered a string “20”

Converting text to numbers TryParse() Method int age; Int 32::TryParse(textbox1->Text, age); Int 32 is the type of data ::Scope resolution operator TryParse() Method to try to see is a string can be a number

Another TryParse Example double temperature; double::TryParse(textbox1->Text, temperature);

Essay Directions Please use google chrome to print. The browser has the print functionality built right in without having to save. Chrome is already installed on our machines. Peer edit Make changes and turn in!!

Activities: Partner to get others to complete the Hello World assignment. Prrogramming is a collaborative effort!!

Activities Complete Hello World Programming Activities and Worksheet questions Complete Activity Worksheet #2