EXERCISE IN CLASS CHAPTER 3. PART 1 IDENTIFIER SCENARIO 1 o record1 o 1record o file_3 o return o $tax o Name o name and address o name-and-address o.

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 2 Simple C Programs.
Advertisements

Incomplete Structs struct B; struct A { struct B * partner; // other declarations… }; struct B { struct A * partner; // other declarations… };
CS 240 Computer Programming 1
Call By Address Parameters (Pointers) Chapter 5. Functions that “return” more than a single value What if we need more than one value to be returned from.
Introduction to Programming Lecture 39. Copy Constructor.
1 C++ Syntax and Semantics The Development Process.
By Senem Kumova Metin 1 POINTERS + ARRAYS + STRINGS REVIEW.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 7: User-Defined Functions II.
Computer Science Department FTSM Variables and Constants Knowledge: Understand the concept of storage location representation as identifiers Skill: Identify.
Software Development Method. Assignments Due – Homework 0, Warmup Reading – Chapter 2 –
Structure of a C program
1 9/8/08CS150 Introduction to Computer Science 1 Data Types Section 2.7 – 2.12 CS 150 Introduction to Computer Science I.
Variables and Declarations 02/06/15. Objectives Create and use variables in a program. Use correct identifiers for the variables' names.
Chapter 10 More on Modular Programming and Functions.
Wednesday, 10/9/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 10/9/02  QUESTIONS ??  Today:  Discuss HW #02  Discuss test question types  Review 
Declarations/Data Types/Statements. Assignments Due – Homework 1 Reading – Chapter 2 – Lab 1 – due Monday.
Chapter 2: Introduction to C++.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Programming Pointers. COMP104 Lecture 32 / Slide 2 Pointers l Pointers are objects whose values are the locations of other objects l Pointers are memory.
CSC 125 Introduction to C++ Programming Chapter 2 Introduction to C++
C Tokens Identifiers Keywords Constants Operators Special symbols.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
Chapter 7 Formatted input and output. 7.1 introduction Tax: This result is correct; but it would be better Maybe as $13, Make formatting.
Dynamic memory allocation and Pointers Lecture 4.
Introduction to Programming Languages S1.3.1Bina © 1998 Liran & Ofir Introduction to Programming Languages Programming in C.
Chapter 12: String Manipulation Introduction to Programming with C++ Fourth Edition.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
Copyright 2005, The Ohio State University 1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation.
Passing Structure to function.  structure to function structure to function  Passing structure to function in C Passing structure to function in C 
Pascal Programming Today Chapter 11 1 Chapter 11.
Functions: Part 2 of /11/10: Lecture 16 CMSC 104, Section 0101 John Y. Park 1.
C Programming Lecture 16 Pointers. Pointers b A pointer is simply a variable that, like other variables, provides a name for a location (address) in memory.
Arrays. Topics to be Covered... Arrays ◦ Declaration ◦ Assigning values ◦ Array manipulation using loops Multi-dimensional arrays ◦ 2D arrays ◦ Declaration.
POINTERS IN C. Introduction  A pointer is a variable that holds a memory address  This address is the location of another object (typically another.
A.Abhari CPS1251 Topic 2: C Overview C Language Elements Variable Declaration and Data Types Statement Execution C Program Layout Formatting Output Interactive.
Fun fun ’til daddy takes your C turbo away! A C program is organized into one or more modules (source files created by a programmer), within which are.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to C++
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
Current Assignments Project 3 has been posted, due next Tuesday. Write a contact manager. Homework 6 will be posted this afternoon and will be due Friday.
C Language Elements Preprocessor Directives # (sign for preprocessor directive commands) #include Standard header file (.h) Library.
Basic Concepts:- Invalid use of Address Operator &75 &(‘a’) &(a+b)
C LANGUAGE UNIT 3. UNIT 3 Arrays Arrays – The concept of array – Defining arrays – Initializing arrays.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
Overview Working directly with memory locations is beneficial. In C, pointers allow you to: change values passed as arguments to functions work directly.
CS1010 Programming Methodology
Variables Mr. Crone.
C LANGUAGE MULTIPLE CHOICE QUESTION
Variables A variable is a placeholder for a value. It is a named memory location where that value is stored. Use the name of a variable to access or update.
CSE 303 Concepts and Tools for Software Development
Lecture Note Set 1 Thursday 12-May-05
Visit for more Learning Resources
C Basics.
Buy book Online -
Introduction to the C Language
2.1 Parts of a C++ Program.
CISC181 Introduction to Computer Science Dr
Pointers The C programming language gives us the ability to directly manipulate the contents of memory addresses via pointers. Unfortunately, this power.
CS150 Introduction to Computer Science 1
C Programming Lecture-8 Pointers and Memory Management
POINTER CONCEPT 4/15/2019.
C Data Types and Variable
EECE.2160 ECE Application Programming
Variables and Constants
POINTER CONCEPT 8/3/2019.
ㅎㅎ Fourth step for Learning C++ Programming Call by value
Data in a C++ Program Numeric data and character data
Presentation transcript:

EXERCISE IN CLASS CHAPTER 3

PART 1 IDENTIFIER

SCENARIO 1 o record1 o 1record o file_3 o return o $tax o Name o name and address o name-and-address o name_and_address o Determine which of the following are valid identifiers. If invalid, explain why.

SCENARIO 2 #include void main() { int 1st, second, third; float fun, Fun; char x, initial name, my-name; Second = 8; Fun=10.2 fun = x; } Trace all the syntax error(s) in below program:

PART 1 BASIC DATA TYPE

SCENARIO 1 Write appropriate declarations and assign the given initial values for each group of variables: Floating-point variables: a = -8.2, b = Integer variables: x = 129, y = 87, z = -22 Character variables : c1 = ‘w’, c2 = ‘&’

SCENARIO 2 Identify the syntactic errors in the following program. Then rewrite the correct program. #include void main() {integer a; floating-point b; character c; printf(“End.”); }

SCENARIO 3 Write the #define preprocessor directive for a program that has the constant macro HOURLY_WAGES (5.50). Rewrite the following program that uses variables with memory constants. #include void main() { float weight = 30.5; int product_code = 1000; }

THAT’S ALL FOR TODAY…… SEE YA NEXT CLASS