1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.

Slides:



Advertisements
Similar presentations
Pemrograman VisualMinggu …2… Page 1 MINGGU Ke Dua Pemrograman Visual Pokok Bahasan: Console Application Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan.
Advertisements

 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
 2005 Pearson Education, Inc. All rights reserved Introduction.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Chapter 2 - Introduction to Java Applications
 2006 Pearson Education, Inc. All rights reserved Introduction to C# Applications.
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
1 Introduction to Java Programming Lecture 4 Using JOptionPane Spring 2008.
CMT Programming Software Applications
 2002 Prentice Hall. All rights reserved. 1 Outline 3.1Introduction 3.2Simple Program: Printing a Line of Text 3.3Another Simple Program: Adding Integers.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 5a: Input and.
Repeating Instructions
Chapter 2 - Introduction to Java Applications
Introduction to.NET Microsoft announced in June 2000 A new software –development model that allows applications created in disparate programming languages.
Relational Operators Control structures Decisions using “if” statements  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course.
Beginning Programming with the Visual Studio.NET Environment.
An Introduction to C# and the .NET Framework
Getting Started Example ICS2O curriculum
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
 2001 Prentice Hall, Inc. All rights reserved. 1 Introduction to C# Programming Part I.
Chapter 3 – Introduction to Visual Basic Programming
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 - Introduction to Java Applications Outline 2.1Introduction 2.2A First Program in Java: Printing.
Jozef Goetz,  2009 Pearson Education, Inc. All rights reserved.  2002 Prentice Hall. All rights reserved. expanded by J. Goetz, 2012.
Advanced Programming LOOP.
C# B 1 CSC 298 Writing a C# application. C# B 2 A first C# application // Display Hello, world on the screen public class HelloWorld { public static void.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Programming in C#. I. Introduction C# (or C-Sharp) is a programming language. C# is used to write software that runs on the.NET Framework. Although C#
 Simple C# program  Console applications input and output text in a console window, which in Windows XP and Windows Vista is known as the Command Prompt.
Introduction to Visual Basic Programming Introduction to Visual Basic Programming Ch3 – Deitel’s Book.
Introduction to Windows Programming
 2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Introduction to Java Applications Outline 2.1Introduction 2.2A Simple Program: Printing a.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Programming Fundamentals 2: Simple/ F II Objectives – –give some simple examples of Java applications and one applet 2. Simple Java.
1 COMP 241: Object-Oriented Programming with Java Fall 2004 Lecture 1 September 27, 2004 Serdar Taşıran.
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
Introduction to Visual Basic Programming. Introduction Simple Program: Printing a Line of Text Another Simple Program: Adding Integers Memory Concepts.
Introduction to Visual Basic Programming Chapter 3 – Introduction to Visual Basic Programming.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
Dialog Boxes.
Advanced Programming LOOP. 2 while Repetition Structure Repetition Structure –An action is to be repeated Continues while statement is true Ends when.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
JavaScript 1 COE 201- Computer Proficiency. Introduction JavaScript scripting language ▫Originally created by Netscape ▫Facilitates disciplined approach.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 – Introduction to C# Programming Outline 3.1 Introduction 3.2 Simple Program: Printing a Line.
Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing a Line of Text in a Web Page 7.3 Another JavaScript.
 2002 Prentice Hall. All rights reserved. 1 Chapter 4 – Control Structures Part 1 Outline Counter-Controlled Repetition: Example Sentinel-Controlled Repetition:
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Introduction to Java Applications Outline 2.1Introduction 2.2A First Program in Java: Printing.
Lecture 02 Dr. Eng. Ibrahim El-Nahry Methods. 2 Learning Objectives Class Definition includes both methods and data properties Method Definition and Declaration.
 2007 Pearson Education, Inc. All rights reserved Introduction to Visual Basic Programming.
UFCFY5-30-1Multimedia Studio Coding for Interactive Media Fundamental Concepts.
1 Chapter 2 - Introduction to Java Applications Outline 2.1Introduction 2.2A First Program in Java: Printing a Line of Text 2.2.1Compiling and Executing.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
2.5 Another Java Application: Adding Integers
Chapter 2 - Introduction to Java Applications
Chapter 7 - JavaScript: Introduction to Scripting
Advanced Programming Lecture 02: Introduction to C# Apps
JavaScript: Introduction to Scripting
Chapter 2 - Introduction to Java Applications
Chapter 2 - Introduction to Java Applications
Chapter 3 – Introduction to C# Programming
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 2 - Introduction to Java Applications
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
F II 2. Simple Java Programs Objectives
Chapter 7 - JavaScript: Introduction to Scripting
Presentation transcript:

1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command prompt - Used in later versions of Windows

2 Namespaces Group related C# features into a categories Contain code that can be reused.NET framework library contains many namespaces Must be referenced in order to be used Example: Console feature is in namespace System

3 Methods Building blocks of C# programs Every program is a class! The Main method Each console or windows application must have exactly one

4 Simple Program: Printing a Line of Text Visual Studio.NET-generated console application. Rename Complete the code

6 Simple Program: Output Execution of the Welcome1 program.

Welcome2.cs

8 Some common escape sequences

9 Displaying output With C#  Windows applications Forms with several output types Contain Graphical User Interfaces (GUIs) Graphical User Interface GUIs are used to make it easier to get data from the user as well as display data to the user Message boxes Within the System.Windows.Forms namespace Used to prompt or display information to the user

Welcome4.cs The System.Windows.Forms namespace allows the programmer to use the MessageBox class. This will display the contents in a message box as opposed to the console.

11 Adding a reference to an assembly in Visual Studio.NET Add Reference dialogue

12 Adding a reference to an assembly in Visual Studio.NET References folder Solution Explorer System.Windows.Forms reference

13 Dialog displayed by calling MessageBox.Show. OK button allows the user to dismiss the dialog. Dialog is automatically sized to accommodate its contents. Close box

14 Getting input Primitive data types built into C# string, int, double, char, long …15 types Console.ReadLine() Used to get a value from the user input Int32.Parse() Used to convert a string argument to an integer Allows math to be performed once the string is converted

1 // Addition.cs 2 // An addition program. 3 4 using System; 5 6 class Addition 7 { 8 static void Main( string[] args ) 9 { 10 string firstNumber, // first string entered by user 11 secondNumber; // second string entered by user int number1, // first number to add 14 number2, // second number to add 15 sum; // sum of number1 and number // prompt for and read first number from user as string 18 Console.Write( "Please enter the first integer: " ); 19 firstNumber = Console.ReadLine();

21 // read second number from user as string 22 Console.Write( "\nPlease enter the second integer: " ); 23 secondNumber = Console.ReadLine(); // convert numbers from type string to type int 26 number1 = Int32.Parse( firstNumber ); 27 number2 = Int32.Parse( secondNumber ); // add numbers 30 sum = number1 + number2; // display results 33 Console.WriteLine( "\nThe sum is {0}.", sum ); 34 Console.Write("Press ENTER to continue"); 35 Console.ReadLine(); 36 } // end method Main 37 } // end class Addition

17 Combining steps 21 // read second number from user as string 22 Console.Write( "\nPlease enter the second integer: " ); 23 secondNumer = Int32.Parse( Console.ReadLine() );

18 Should know! Memory Concepts Arithmetic Decision Making: Equality and Relational Operators