CS001 Introduction to Programming Day 2 Sujana Jyothi

Slides:



Advertisements
Similar presentations
Chapter 4 Computation Bjarne Stroustrup
Advertisements

Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Programming Basics using Real-life examples Dr. Jeyakesavan Veerasamy CS faculty, UT Dallas, USA
Programming Basics using Real-life examples. Activities Recipe Assembly instructions for a toy Map out the plan at amusement park A busy day schedule.
4.
CSE 1301 Lecture 5B Conditionals & Boolean Expressions Figures from Lewis, “C# Software Solutions”, Addison Wesley Briana B. Morrison.
Programming Languages and Paradigms
Team 5220 Roboknights. Outline  Getting Started  Hardware Setup/Wiring  Software Setup/Pragmas  Programming with RobotC  Grammar/Syntax  Basic Statements.
Lecture 2 Introduction to C Programming
Principles of Programming Fundamental of C Programming Language and Basic Input/Output Function 1.
1 CS101 Introduction to Computing Lecture 23 Flow Control & Loops (Web Development Lecture 8)
CS001 Introduction to Programming Day 3 Sujana Jyothi
True or false A variable of type char can hold the value 301. ( F )
Homework Any Questions?. Statements / Blocks, Section 3.1 An expression becomes a statement when it is followed by a semicolon x = 0; Braces are used.
Introduction to Computers and Programming Lecture 5 Boolean type; if statement Professor: Evan Korth New York University.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
C++ for Engineers and Scientists Third Edition
Introduction to C Programming
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Concept of Computer Programming November 2, 2011.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.
An Introduction to Textual Programming
High-Level Programming Languages: C++
CIS Computer Programming Logic
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
AS Computing Introduction to Programming. What is a Computer Program? A list of instructions that a computer must work through, in a logical sequence,
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
The Logical Structure of Algorithms. Algorithms Steps necessary to complete a task or solve a problem. Example: Recipe for baking a cake –Will contain.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
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.
1 Chapter 4: Selection Structures. In this chapter, you will learn about: – Selection criteria – The if-else statement – Nested if statements – The switch.
Lecture 4 Introduction to Programming. if ( grade ==‘A’ ) cout
COMPUTER PROGRAMMING. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may repeat code.
CPS120: Introduction to Computer Science Decision Making in Programs.
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
Flow of Control Part 1: Selection
Introduction to C Programming Angela Chih-Wei Tang ( 唐 之 瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan 2010 Fall.
Logic and Systems A beginner’s guide.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
CPS120: Introduction to Computer Science Decision Making in Programs.
CPS120: Introduction to Computer Science Lecture 14 Functions.
VARIABLES, CONSTANTS, OPERATORS ANS EXPRESSION
1 CS161 Introduction to Computer Science Topic #9.
1 Principles of Information Technology Introduction to Software and Information Systems Copyright © Texas Education Agency, All rights reserved.
CPS120 Introduction to Computer Science Iteration (Looping)
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
1 CS161 Introduction to Computer Science Topic #8.
Principle of Programming Lanugages 3: Compilation of statements Statements in C Assertion Hoare logic Department of Information Science and Engineering.
CPS120: Introduction to Computer Science Decision Making in Programs.
EGR 115 Introduction to Computing for Engineers Branching & Program Design – Part 3 Friday 03 Oct 2014 EGR 115 Introduction to Computing for Engineers.
Data Handling in Algorithms. Activity 1 Starter Task: Quickly complete the sheet 5mins!
CPS120: Introduction to Computer Science Decision Making in Programs.
Chapter 2: Fundamental Programming Structures in Java Adapted from MIT AITI Slides Control Structures.
 2003 Prentice Hall, Inc. All rights reserved. 1 Basic C++ Programming.
Introduction to Computing Systems and Programming Programming.
Chapter 6 Functions The Tic-Tac-Toe Game. Chapter Content In this chapter you will learn to do the following: 0 Write your own functions 0 Accept values.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
Chapter 10 Programming Fundamentals with JavaScript
REPETITION CONTROL STRUCTURE
CSC201: Computer Programming
Statements (6 of 6) A statement causes an action to be performed by the program. It translates directly into one or more executable computer instructions.
Java programming lecture one
Chapter 10 Programming Fundamentals with JavaScript
Programming Fundamentals Lecture #3 Overview of Computer Programming
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Basic Programming Concepts
Presentation transcript:

CS001 Introduction to Programming Day 2 Sujana Jyothi

2 What will you learn today? Useful Terms in Programming Sequence & Selection

3 Resources –Use the material from my website. Save your work –on your flash drive –or it to yourself

What is programming? Technical Common Sense Logical Thinking & execution simpler than logic puzzles Need not be a cryptic activity Concepts are similar to daily activities

Useful terms used in Programming Source code The actual text used to write the instructions for a computer program. This text is then translated into something meaningful the computer can understand. Compiler A software tool that translates source code into data that the computer can understand.

Useful terms used in Programming Data type The classification of pieces of information in a program. Typically, there are data types for integers (whole numbers), floating-point numbers (numbers with a decimal part), and single characters.

Useful terms used in Programming Variable A container which represents a value in a program. Variables can store different types of data including numeric values, single characters, and text strings. The value of a variable can change all throughout a program. Constant The same thing as a variable with one major difference - the value of a constant does not change, while the value of a variable can change all throughout a program.

8 Structured Programming Constructs Use only three constructs — sequence (statements, blocks) — selection (if, switch) — iteration (loops like while and for)

Activities Recipe Assembly instructions for a toy Map out the plan at amusement park A busy day schedule What is common to all of these?

Activities Recipe Assembly instructions for a toy Map out the plan at amusement park A busy day schedule What is common to all of these? SEQUENCE

Any valid expression terminated by a semicolon is a statement. Statements may be grouped together by surrounding them with a pair of curly braces { }. Such a group is syntactically equivalent to one statement and can be inserted where ever one statement is legal. Sequence

Such a group, known as a block, has one entry point (the first statement) and one exit point (the last statement). From now, whenever we mention statement, understand that you may substitute a block instead. Sequence

Activities Drive car or take DART bus? Party or study? Fly or drive? What is common to all of these?

Activities Drive car or take DART bus? Party or study? Fly or drive? What is common to all of these? DECISION

if (expression) statement1 else statement2 if and else are independent constructs, in that if can occur without else (but not the reverse). Selection (Decision)

“Guess The Number Game": (Suppose, these are the instructions for the robot to play me at the game) 1. Think of a random number between 1 and 1000 and don't tell me it. 2. Ask me to guess what the number is. Say "What is your Guess?". 3. Listen to my answer. 4. If my answer is less than the number you thought of, say "Too Small" and then GOTO step If my answer is more than the number you thought of, say "Too Big" and then GOTO step Say "Well Done! You got the right answer!" Example to write a Program