Computer Programs CS 1400 Dennis A. Fairclough Version 1.1 CS 1400 Dennis A. Fairclough Version 1.1.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 12 Introduction to ASP.NET.
Advertisements

2. C# Language Fundamentals
Procedural Programming in C# Chapters Objectives You will be able to: Describe the most important data types available in C#. Read numeric values.
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Execute Blocks of Code Multiple Times Svetlin Nakov Telerik Corporation
Execute Blocks of Code Multiple Times Telerik Software Academy C# Fundamentals – Part 1.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 6 th Lecture Pavel Ježek
C# Language Report By Trevor Adams. Language History Developed by Microsoft Developed by Microsoft Principal Software Architect Principal Software Architect.
Computer and Programming
Neal Stublen C# Data Types Built-in Types  Integer Types byte, sbyte, short, ushort, int, uint, long, ulong  Floating Point Types.
Getting Started with C# 1 SWE 344 Internet Protocols & Client Server Programming.
C#: Data Types Based on slides by Joe Hummel. 2 UCN Technology: Computer Science Content: “.NET is designed around the CTS, or Common Type System.
Introduction to VC++.NET #include”stdsfx.h” // includes contents of stdsfx.h into this program file #using // references prepackaged Microsoft code Using.
Thanachat Thanomkulabut
1 Chapter Two Using Data. 2 Objectives Learn about variable types and how to declare variables Learn how to display variable values Learn about the integral.
Introduction to Classes and Objects (Through Ch 5) Dr. John P. Abraham Professor UTPA.
.NET Data types. Introduction ٭ A "data type" is a class that is primarily used just to hold data. ٭ This is different from most other classes since they're.
1. 2 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Decisions { class.
Data Types, Operators, Expressions, Statements, Console I/O, Loops, Arrays, Methods Svetlin Nakov Telerik Corporation
Introduction to C# Programming ณภัทร สักทอง Application Program Development.
Input & Output: Console
C#C# Classes & Methods CS3260 Dennis A. Fairclough Version 1.1 Classes & Methods CS3260 Dennis A. Fairclough Version 1.1.
3. Declaring Value-Type Variables
INPUT/OUTPUT STATEMENT ADDITION SLIDES. Console.ReadLine() – Use to get the input (String) from user Convert string to other data type – int.Parse() 
CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects UTPA – Fall
CS_OOP Lecture #2: Computer Hardware/Software; Variables, C# Data Types, and IO.
C#C# Introduction CS3260 Dennis A. Fairclough Version 1.0 Introduction CS3260 Dennis A. Fairclough Version 1.0.
CH2 – Using Data. Constant Something which cannot be changed Data Type Format and size of a data item Intrinsic Data Types Pg. 47 – Table 2-1 Basic ones.
Chapter 2: Using Data.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
Introduction to C++ Version 1.1. Topics C++ Structure Primitive Data Types I/O Casting Strings Control Flow.
Computing with C# and the.NET Framework Chapter 2 C# Programming Basics ©2003, 2011 Art Gittleman.
CSCI 3328 Object Oriented Programming in C# Chapter 4: C# Control Statement – Part I 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX.
C# C1 CSC 298 Elements of C# code (part 1). C# C2 Style for identifiers  Identifier: class, method, property (defined shortly) or variable names  class,
Enumeration.
Matlab Data types, input and output. Data types Char: >> a = ‘ Jim ’ Char: >> a = ‘ Jim ’ Numeric: uint8, uint16, uint32, uint64 int8, int16, int32, int64.
CSC 298 Streams and files.
1.2 Primitive Data Types and Variables
Chapter One Lesson Three DATA TYPES ©
A: A: double “4” A: “34” 4.
C# Programming: Basic Concept Part 2 Computer and Programming (204111)
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
INPUT/OUTPUT STATEMENT ADDITION SLIDES. Console.ReadLine() – Use to get the input (String) from user Convert string to other data type – int.Parse() 
1 nd Semester Module2 C# Basic Concept Thanawin Rakthanmanon Computer Engineering Department Kasetsart University, Bangkok.
Declaring variables The type could be: int double char String name is anything you want like lowerCaseWord.
1 INPUT/OUTPUT Statements Dept. of Computer Engineering Faculty of Engineering, Kasetsart University Bangkok, Thailand.
Lecture 2 Review of 1301 and C# Richard Gesick. Common data types int, long, double, float, char, bool, string.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
C# Basic Syntax, Visual Studio, Console Input / Output
C# Basic Syntax, Visual Studio, Console Input / Output
User Interaction and Variables
C# — Console Application
Code -> Build -> Run
Numeral Types and Type Conversion
Understand Computer Storage and Data Types
Computing with C# and the .NET Framework
Chapter 2.
CSCI 3328 Object Oriented Programming in C# Chapter 4: C# Control Statement – Part I UTPA – Fall 2012 This set of slides is revised from lecture slides.
.Net Programming with C#
Variables, Loops, Decision Statements, etc
CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects UTPA – Fall 2012 This set of slides is revised from lecture.
Data Types Imran Rashid CTO at ManiWeber Technologies.
The important features of OOP related to C#:
Module 2 Variables, Assignment, and Data Types
Encapsulation.
Variables and Constants
Presentation transcript:

Computer Programs CS 1400 Dennis A. Fairclough Version 1.1 CS 1400 Dennis A. Fairclough Version 1.1

Overview Computer Programs –Data –Methods –Program Puts it all together Computer Programs –Data –Methods –Program Puts it all together 2

C# Data Integers (whole numbers) –int, sbyte, short, long (Signed) –uint, byte, ushort, ulong (Unsigned) Floating Point –double, float, decimal (Signed only) Others –char, bool Reference Type Objects –object, string Integers (whole numbers) –int, sbyte, short, long (Signed) –uint, byte, ushort, ulong (Unsigned) Floating Point –double, float, decimal (Signed only) Others –char, bool Reference Type Objects –object, string 3

Methods Console –Output to Display WriteLine(…) Write(…) –Input from Keyboard ReadLine(…) Read(…) Console –Output to Display WriteLine(…) Write(…) –Input from Keyboard ReadLine(…) Read(…) 4

Program class Program { void Main() { System.Console.WriteLine(“Hello, world!”); System.Console.ReadLine(); }//End Main() }//End class Program class Program { void Main() { System.Console.WriteLine(“Hello, world!”); System.Console.ReadLine(); }//End Main() }//End class Program 5

Program using System; class Program { void Main() { string sData = “”; int iData = 0; double dData = 0.0; Console.WriteLine(“Enter: string, int, double”); sData = Console.ReadLine(); iData = int.Parse(Console.ReadLine()); dData = double.Parse(Console.ReadLine()); Console.ReadLine(); }//End Main() }//End class Program using System; class Program { void Main() { string sData = “”; int iData = 0; double dData = 0.0; Console.WriteLine(“Enter: string, int, double”); sData = Console.ReadLine(); iData = int.Parse(Console.ReadLine()); dData = double.Parse(Console.ReadLine()); Console.ReadLine(); }//End Main() }//End class Program 6

Data Characteristics Size –int – 32 bits –double – 64 bits –char - 16 bits –string – length based on number of char’s + ‘\0’ Shape –char –int –double –string Methods –char –ToUpper(…), ToString(…) –int – Parse(…), ToString(…) –double – parse(…), ToString(…) –string – SubString(…), ToUpper(…) Size –int – 32 bits –double – 64 bits –char - 16 bits –string – length based on number of char’s + ‘\0’ Shape –char –int –double –string Methods –char –ToUpper(…), ToString(…) –int – Parse(…), ToString(…) –double – parse(…), ToString(…) –string – SubString(…), ToUpper(…) 7