SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Introduction to C# Programming
Company

LOGO






C#
Arithmetic

Expressions)

Raptor
C#





Programming – OOP)

Object-Oriented

.NET
Java

C++
.NET
.NET

Text Editor
csc.exe
C:WINDOWSMicrosoft.NETFramework
v4.0.30319 (VS 2010 Express)

Integrated
Development Environment (IDE)
Text Editor

Microsoft Visual C#

C#
Application)
solution)

solution)
project)


 VC# -> Console Application
New Project
New Project
C#

Namespace
2
class
namespace Hello
{
3
start point
class HelloClass
1

{

static void Main ()
{
System.Console.WriteLine("Hello World!");
4
System.Console.ReadLine();
}
}

code
}
 Write
WriteLine

Console
System

System.Console.Write( "Hello");
Console.Write("Hello");

System
using System;
Formatting String
{index [,alignment] [:formatSpecifier]}
 Console.WriteLine(" Two sample integers
are { } and { }. ", ,
 Index 0
 Console.WriteLine("{0,-9}{0,9}",
12,45);

Formatting String
Console.WriteLine("x = {0} y = {1}",123,456);
Console.WriteLine("123456789");
Console.WriteLine("{0,9}", 123);
Console.WriteLine("123456789");
Console.WriteLine("{0,-9}End", 123);
Console.WriteLine("123456789123456789");
Console.WriteLine("{0,-9}{0,9}", 123,456);
Formatting String

E

e

Exponential (

F

f

Fixed-point (

G

g

General (

N

n

Number (

2

Fixed-point
comma

P

p

Percentage (

X

x

Hexadecimal (

3
Formatting String
int n = 123456789;
Console.WriteLine("{0:E}", n);
Console.WriteLine("{0:F}", n);
Console.WriteLine("{0:G}", n);
Console.WriteLine("{0:N}", n);
Console.WriteLine("{0:P}", n);
Console.WriteLine("{0:X}", n);
Escape Sequence
Escape Sequence
n
n
t
t
r
r

"

tab


Backslash ()
"
double quote (")
Escape Sequence
Console.WriteLine("Welcome ntonC#nProgramming!");
 Read, ReadLine

System

ReadKey
Console


Read

ASCII Code)

int a;
Console.Write("Input : ");
a = Console.Read();
Console.WriteLine(a);
Console.ReadKey();


Read

ASCII Code)

int a;
Console.Write("Input : ");
a = int.Parse(Console.ReadLine());
Console.WriteLine(a);
Console.ReadKey();
1.
2.

3.

4.

Console.ReadKey()
DOS
int a;
float b;
string c;
char d;
Console.Write("Input integer : ");
a = int.Parse(Console.ReadLine());
Console.Write("Input float : ");
b = float.Parse(Console.ReadLine());
Console.Write("Input string: ");
c = Console.ReadLine();
Console.Write("Input character: ");
d = char.Parse(Console.ReadLine());
Arithmetic Expressions)

+
*
/
%
++
--

Modulas
1
1
Arithmetic Expressions)

=
+=

A = 2;

A +=1
A = A + 1;

-=

A -=2
A = A - 2;

*=

A *=3
A = A * 3;

/=

A /=2
A = A / 2;

%=

A %=2
A = A % 2;
Arithmetic Expressions)

==
!=
>
>=

2 == 3
2 != 3
2>3
2 >= 3

<
<=

2<3
2 <= 3

==

2 == 3
Arithmetic Expressions)

&&
||
!
^
-

/

/
-

-
Arithmetic Expressions)

1
2
3
4
5
6
7
8
9

C#
( ) parenthesis –
++, -*, /, %
+, ==, !=
&&
||
=, +=, -=, /=, %=
++, --
Math
Math.Abs(x)
Math.Ceiling(x)
Math.Floor(x)
Math.Log(x)
Math.Log x)
Math.Round(x)
Math.Pow(x,y)
Math.Sqrt(x)
Math.Max(x,y)
Math.Min(x,y)
Math.Sin(x)
Math.Cos(x)

x (|x|)
x
x
x
x

x
x

y()
x( )
x
x
x (x
x (x

y (2
y (2
Math
Math.PI
Math.E

e



string)
RAPTOR to C#

Watch Window

int BirthYear, Age;
RAPTOR to C#

Input

Console.WriteLine("Your Birth Year");
BirthYear = int.Parse(Console.ReadLine());
RAPTOR to C#

Process

Age = 2556-BirthYear;
RAPTOR to C#

Output

Console.WriteLine("You are " + Age + " Years old");
RAPTOR to C#

int BirthYear, Age;
Console.WriteLine("Your Birth Year");
BirthYear = int.Parse(Console.ReadLine());
Age = 2556-BirthYear;
Console.WriteLine("You are " + Age + " Years old");
Console.ReadKey();



4

/

Weitere ähnliche Inhalte

Andere mochten auch

Basics of c# by sabir
Basics of c# by sabirBasics of c# by sabir
Basics of c# by sabirSabir Ali
 
ใบความรู้ที่ 5 การเขียนผังงานโปรแกรม
ใบความรู้ที่ 5 การเขียนผังงานโปรแกรมใบความรู้ที่ 5 การเขียนผังงานโปรแกรม
ใบความรู้ที่ 5 การเขียนผังงานโปรแกรมdechathon
 
การเขียนผังงาน (Flowchart)
การเขียนผังงาน (Flowchart)การเขียนผังงาน (Flowchart)
การเขียนผังงาน (Flowchart)Fair Kung Nattaput
 

Andere mochten auch (6)

Chapter02
Chapter02Chapter02
Chapter02
 
Basics of c# by sabir
Basics of c# by sabirBasics of c# by sabir
Basics of c# by sabir
 
Flowchart
FlowchartFlowchart
Flowchart
 
ใบความรู้ที่ 5 การเขียนผังงานโปรแกรม
ใบความรู้ที่ 5 การเขียนผังงานโปรแกรมใบความรู้ที่ 5 การเขียนผังงานโปรแกรม
ใบความรู้ที่ 5 การเขียนผังงานโปรแกรม
 
การเขียนผังงาน (Flowchart)
การเขียนผังงาน (Flowchart)การเขียนผังงาน (Flowchart)
การเขียนผังงาน (Flowchart)
 
หลักการเขียนผังงาน(Flow chart)
หลักการเขียนผังงาน(Flow chart)หลักการเขียนผังงาน(Flow chart)
หลักการเขียนผังงาน(Flow chart)
 

Ähnlich wie Chapter04

01 Introduction to programming
01 Introduction to programming01 Introduction to programming
01 Introduction to programmingmaznabili
 
01. introduction to-programming
01. introduction to-programming01. introduction to-programming
01. introduction to-programmingStoian Kirov
 
Roslyn: el futuro de C# y VB.NET by Rodolfo Finochietti
Roslyn: el futuro de C# y VB.NET by Rodolfo FinochiettiRoslyn: el futuro de C# y VB.NET by Rodolfo Finochietti
Roslyn: el futuro de C# y VB.NET by Rodolfo Finochietti.NET Conf UY
 
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNextMicrosoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNextRodolfo Finochietti
 
LECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptxLECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptxAOmaAli
 
2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with VoltaDaniel Fisher
 
.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#Bertrand Le Roy
 
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)Jannat Ruma
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersDave Bost
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfAnassElHousni
 

Ähnlich wie Chapter04 (20)

Introduction to Programming Lesson 01
Introduction to Programming Lesson 01Introduction to Programming Lesson 01
Introduction to Programming Lesson 01
 
01 Introduction to programming
01 Introduction to programming01 Introduction to programming
01 Introduction to programming
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
01. introduction to-programming
01. introduction to-programming01. introduction to-programming
01. introduction to-programming
 
Roslyn: el futuro de C# y VB.NET by Rodolfo Finochietti
Roslyn: el futuro de C# y VB.NET by Rodolfo FinochiettiRoslyn: el futuro de C# y VB.NET by Rodolfo Finochietti
Roslyn: el futuro de C# y VB.NET by Rodolfo Finochietti
 
Srgoc dotnet_new
Srgoc dotnet_newSrgoc dotnet_new
Srgoc dotnet_new
 
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNextMicrosoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
 
2310 b 03
2310 b 032310 b 03
2310 b 03
 
Session Four C#
Session Four C# Session Four C#
Session Four C#
 
LECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptxLECTURE 1 - Introduction to Programming.pptx
LECTURE 1 - Introduction to Programming.pptx
 
Session4 csharp
Session4 csharpSession4 csharp
Session4 csharp
 
2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta
 
Intro to .NET and Core C#
Intro to .NET and Core C#Intro to .NET and Core C#
Intro to .NET and Core C#
 
C# Lab Programs.pdf
C# Lab Programs.pdfC# Lab Programs.pdf
C# Lab Programs.pdf
 
C# Lab Programs.pdf
C# Lab Programs.pdfC# Lab Programs.pdf
C# Lab Programs.pdf
 
.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#
 
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
Iron python
Iron pythonIron python
Iron python
 

Kürzlich hochgeladen

Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 

Kürzlich hochgeladen (20)

Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 

Chapter04