Quick Summary C++/CLI Basics Data Types Controls Arrays In-class assignments.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Air Force Institute of Technology Electrical and Computer Engineering
Introduction to Programming Lecture 15. In Today’s Lecture Pointers and Arrays Manipulations Pointers and Arrays Manipulations Pointers Expression Pointers.
C# Language Report By Trevor Adams. Language History Developed by Microsoft Developed by Microsoft Principal Software Architect Principal Software Architect.
1 Demo Reading Assignments Important terms & concepts Fundamental Data Types Identifier Naming Arithmetic Operations Sample Programs CSE Lecture.
Lecture 1 Introduction to Java Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
Introduction to Computers and Programming Lecture 7:
Data types and variables
Primitive Types Java supports two kinds of types of values – objects, and – values of primitive data types variables store – either references to objects.
Chapter 2 Data Types, Declarations, and Displays
2015/8/221 Data Types & Operators Lecture from (Chapter 3,4)
Chapter 2 Data Types, Declarations, and Displays.
Objectives You should be able to describe: Data Types
Chapter 2: Introducing Data Types and Operators.  Know Java’s primitive types  Use literals  Initialize variables  Know the scope rules of variables.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Outline Variables 1.
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
PRIMITIVE DATA TYPES -Integer -Floating Point -Decimal -Boolean -Character STRINGS -Character Array -Class -String Length -Static -Limited Dynamic -Dynamic.
Chapter 3: Data Types and Operators JavaScript - Introductory.
Simple Data Types and Statements. Namespaces namespace MyNamespace { // …. { MyNamespace::func1() using namespace OtherNamespace; Comments: // /* xxxx.
Chapter 6 Fundamental Types Dept of Computer Engineering Khon Kaen University.
Chapter 2: Using Data.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
Knowledge Base C++ #include using std namespace; int main(){} return 0 ; cout
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
1 Programming Java Java Basics. 2 Java Program Java Application Program Application Program written in general programming language Applet Program running.
These notes were originally developed for CpSc 210 (C version) by Dr. Mike Westall in the Department of Computer Science at Clemson.
SE-1010 Dr. Mark L. Hornick 1 Variables & Datatypes.
Computing with C# and the.NET Framework Chapter 2 C# Programming Basics ©2003, 2011 Art Gittleman.
Primitive Variables.
Ch Chapter 4 Basic Data Types and Variables 4.1 Basic Data Types In C TABLE 4.1 Introduction to Basic Data Types in C Type SizeDescription char 1.
Java Language Basics By Keywords Keywords of Java are given below – abstract continue for new switch assert *** default goto * package.
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.
Operators in JAVA. Operator An operator is a symbol that operates on one or more arguments to produce a result. Java provides a rich set of operators.
“Great leaders are never satisfied with current levels of performance. They are restlessly driven by possibilities and potential achievements.” – Donna.
Java Nuts and Bolts Variables and Data Types Operators Expressions Control Flow Statements Arrays and Strings.
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
Objects Variables and Constants. Our Scuba Problem #include // cin, cout, > using namespace std; int main() { const double FEET_PER_ATM = 33.0, LBS_PER_SQ_IN_PER_ATM.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
CS0007: Introduction to Computer Programming Primitive Data Types and Arithmetic Operations.
Object Oriented Programming Lecture 2: BallWorld.
1Object-Oriented Program Development Using C++ Built-in Data Types Data type –Range of values –Set of operations on those values Literal: refers to acceptable.
Java Programming Language Lecture27- An Introduction.
© 2004 Pearson Addison-Wesley. All rights reserved August 27, 2007 Primitive Data Types ComS 207: Programming I (in Java) Iowa State University, FALL 2007.
LESSON 06.
The Machine Model Memory
Chapter 6 – Data Types CSCE 343.
Primitive Data Types August 28, 2006 ComS 207: Programming I (in Java)
Computing with C# and the .NET Framework
What to bring: iCard, pens/pencils (They provide the scratch paper)
Java Programming: From Problem Analysis to Program Design, 4e
Escape Sequences What if we wanted to print the quote character?
Starting JavaProgramming
Introduction to Programming
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Character Set Uppercase Alphabets A,
Sun Mon Tue Wed Thu Fri Sat
Fundamental Programming
Sun Mon Tue Wed Thu Fri Sat
Names of variables, functions, classes
ENERGY 211 / CME 211 Lecture 5 October 1, 2008.
2016 | 10 OCT SUN MON TUE WED THU FRI SAT
Sun Mon Tue Wed Thu Fri Sat
ECE 120 Midterm 1 HKN Review Session.
Presentation transcript:

Quick Summary C++/CLI Basics Data Types Controls Arrays In-class assignments

Namespaces namespace MyNamespace { // …. } MyNamespace::func1() using namespace OtherNamespace; Comments: // /* xxxx */

Basic Data Types Type Range Literals/constants and variables Operators and expressions Assignment Input and output

Primitive Data Types in C++/CLI Integer: –Int16 (short); UInt16 (unsinged short) –Int32 (int or long); UInt32(unsigned int or long) –Int64 (long long); UInt64(unsigned long long, _int64) int x, y(1), z = 123; (signed, 32 bits) int x = y = z = 200; Console::WriteLine(0x10); Console::WriteLine(-0x10); // negative hex 10 is base Floating: –Single (float, 32bits) –Double (double, 64bits)

Primitive Data Types in C++/CLI Boolean (bool, true or false) Character (Char, 16bits, unsigned unicode) –Character and escape sequence char a = ‘A’; // character ‘A’ Char b = L‘A’; // unicode ‘A’ Char c = L‘\x0041’; // hex 41 is ASCII ‘A’ char d = ‘\t’; // tab escape Char e = L‘\\’; // unicode backslash escape

Handles vs Pointers Handle: safe code Handle: ^ Reference data in managed heap (CLR offers memory management) Handle’s address can not be manipulated (no add or subtract offsets to it Return from gcnew after creating an instance of a reference type object in managed heap Pointer: unsafe code Pointer: * Reference data in C Run-Time heap, need to handle memory management yourself pointer’s address can be manipulated Return from new after creating an instance of a reference type object in CRT heap

Operators, Expressions and Assignments, Precedence and Associativity Arithmetic Operators Unary Operators Bitwise and Shift Operators Relational Operators Logical Operators Ternary Operator

Quick Summary C++/CLI Basics Data Types Controls Arrays In-class assignments

Control Structures Structured Programming Selection –if –if else –switch(break) Repetition (break, continue) –while –do … while –for

break & continue int sum=0; for (int i=1; i<=10; i++) { if (i%5==0) continue; sum += i;// sum = sum+i; } int sum=0; for (int i=1; i<=10; i++) { if (i%5==0) break; sum += i;// sum = sum+i; }

Quick Summary C++/CLI Basics Data Types Controls Arrays In-class assignments

Arrays –One dimensional array –Two or multiple dimensional array

Array in C++/CLI Array, element, index(or subscript) array ^ a = gcnew array (12); array ^ a = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; a[0], a[1],…, and a[11] a->Length array ^d = {“Sun”, “Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat”}; int main(array ^args) {}

Array in C++/CLI Multi-dimensional Array array ^ b = gcnew array (4,3); array ^ b = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {0, 1, 2}}; b[0,0], b[0,1],…, b[3,2]; b->Rank, b->GetLength(0), b->GetLength(1)

Quick Summary C++ for.NET Data Types Controls Arrays In-class assignments –Control –Array