In your notebook… Purpose: What types of data can we store in C

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

General Computer Science for Engineers CISC 106 Lecture 28 Dr. John Cavazos Computer and Information Sciences 04/29/2009.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
1 9/10/07CS150 Introduction to Computer Science 1 Data Types Section 2.7 – 2.12 CS 150 Introduction to Computer Science I.
Introduction to Computers and Programming Lecture 7:
Constants Variables change, constants don't final = ; final double PI = ; … area = radius * radius * PI; see Liang, p. 32 for full code.
1 9/20/06CS150 Introduction to Computer Science 1 Review: Exam 1.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
CS150 Introduction to Computer Science 1
The If/Else Statement, Boolean Flags, and Menus Page 180
Variables and constants Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences.
Elements of a C++ program 1. Review Algorithms describe how to solve a problem Structured English (pseudo-code) Programs form that can be translated into.
Input & Output: Console
C Tokens Identifiers Keywords Constants Operators Special symbols.
1 Do you have a CS account? Primitive types –“ building blocks ” for more complicated types Java is strongly typed –All variables in a Java program must.
CS1 Lesson 2 Introduction to C++ CS1 Lesson 2 -- John Cole1.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 3A Integral Data (Concepts)
CPS120: Introduction to Computer Science
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
BUILDING JAVA PROGRAMS CHAPTER 2 PRIMITIVE DATA TYPES AND OPERATIONS.
Primitive Variables.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals. Procedural Constructs.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
Variables and Data Types.  Variable: Portion of memory for storing a determined value.  Could be numerical, could be character or sequence of characters.
CSCI 3133 Programming with C Instructor: Bindra Shrestha University of Houston – Clear Lake.
Copyright © – Curt Hill Types What they do.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
CPS120: Introduction to Computer Science Lecture 15A Structures.
This is CS50 AP. an introduction to the intellectual enterprises of computer science and the art of programming Unit 0 Module 0 © David J. Malan, Doug.
A: A: double “4” A: “34” 4.
Values, Types, and Variables. Values Data Information Numbers Text Pretty much anything.
12/14/2016CS150 Introduction to Computer Science 1 Announcements  Website is up!   All lecture slides, assignments,
1 CSC 1111 Introduction to Computing using C++ C++ Basics (Part 1)
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Introduction C# program is collection of classes Classes are collection of methods and some statements That statements contains tokens C# includes five.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
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
C++ Lesson 1.
Week 2 - Wednesday CS 121.
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Chapter 2 Basic Computation
Computing and Statistical Data Analysis Lecture 2
Documentation Need to have documentation in all programs
Data Transfer ASCII FILES.
Variables and Primative Types
Introduction to C++ October 2, 2017.
Chapter 2 Basic Computation
Time Manager Class Activity Material Manager Writer leader Communicator Programmer Start a journey from the capital AbuDhabi to Alasmaa School using your.
Chapter 2.
Variables Store information needed by the program Must have a TYPE
Introduction to Programming in Java
Mr. Dave Clausen La Cañada High School
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.
Basic Notions Review what is a variable? value? address? memory location? what is an identifier? variable name? keyword? what is legal identifier? what.
Introduction to Java Programming
An overview of Java, Data types and variables
This is CS50 AP. an introduction to the intellectual enterprises
CS150 Introduction to Computer Science 1
C++ Data Types Data Type
Variables, Identifiers, Assignments, Input/Output
Chapter 2: Introduction to C++.
Java Programming Review 1
2. Second Step for Learning C++ Programming • Data Type • Char • Float
ECE 103 Engineering Programming Chapter 8 Data Types and Constants
C Programming Pointers
Data Types and Maths Programming Guides.
Variables and Constants
Presentation transcript:

In your notebook… Purpose: What types of data can we store in C In your notebook… Purpose: What types of data can we store in C? Warmup, Copy these two lines to your notes and then answer in a sentence to tell what each line does. This is a shortcut way to combine those two lines into one line:

what happens? works okay? Download twoChars.c from our web page. Compile and make it work. Copy this table to your notebook. Try each pair above in lines 9 & 10 of your program. Write the results into your notebook. X what happens? works okay? Y 68 ‘D’ 101 (101+1) ‘#’ “#” “boy” “girl”

This is CS50 AP. an introduction to the intellectual enterprises of computer science and the art of programming Unit 1 Module 3 © David J. Malan, Doug Lloyd

variable names in C, underscore preferred style, camel case is okay too. variable name length is between 1 to 32 characters can have alphabet, upper and low er case, underscore and digits. but cannot start with a digit no spaces in the name!!

data types

native types

int 50 -10 8529923 Stands for integer 50 -10 8529923 Stands for integer Holds integers between -32768 and +32767

char ‘a’ ‘Z’ ‘?’ ‘\n’ Holds characters such as ‘x’ and ‘*’ Must have single quotes only Or Since the computer stores it as an ascii, The actual ascii number

float 0.0 -50.505 33.3 3.14159265

double long int Holds extremely large/small floating point values To avoid math rounding problems, less discarded digits Holds extremely large positive and negative integers

const

custom CS50 types #include <cs50.h>

booleans (bool) true false

string “A” “Hello, world!” “Hello, world!\n” “This is CS50.”

sizes char 1 byte bool int 4 bytes float string double 8 bytes long long see more at https://en.wikipedia.org/wiki/C_data_types

later this year… user-defined types typedef, struct, enum

Conversion character Description %d integer %f floating-point %c character %s string Example: printf(“My dad’s name is %s and he is %d years old”, x, y);

This is CS50 AP.