SlideShare ist ein Scribd-Unternehmen logo
1 von 11
C Sharp (C#)
By:
Ralph W.
Summary

Defining variables

Getting user input

Displaying user input

Finding odd or even numbers

Switch cases, looping, and logic statements

Comparing sub string within a another string

Clearing screen

Quitting Program
Defining variables

Byte – byte, 8 width, 0 -255

Signed byte – sbyte, 8 width, -127 to 127

integer – int, 32 width,
-2147483648 to 2127483647

String – string,

long, short, char, object, decimal, bool,
double, float, ulong, ushort,

ex: int value;
Getting user input

valueStr = Console.ReadLine()
Displaying user input

Console.WriteLine(valueStr);
Finding odd or even numbers

if(value % 2 != 0), odd

if(value % 2 == 0), even
Switches, loops, and logic

Switch ( caseNumber)
{ case 0: break; default: }

Do { // do something } while( condition);

While (condition) { // do something}

If (condition) { } else { }
Comparing strings

Compare String
String.Compare(str1, str2, true)
− True to ignore case during comparison,
otherwise false.
Clearing screen

Console.Clear();
Exiting Program

Normal exit
− Run a tight loop for the display
− Allow the user to select exit criteria
− Put up a warning message
− Allow the program to exit naturally

Graceful exit with exceptions
− If you want to get fancy you can catch
exceptions and exit gracefully
Extras

Structures

Classes

Linked Lists

Converting strings to integers

Weitere ähnliche Inhalte

Was ist angesagt?

Operators , Functions and Options in VB.NET
Operators , Functions and Options in VB.NETOperators , Functions and Options in VB.NET
Operators , Functions and Options in VB.NETShyam Sir
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in CSahithi Naraparaju
 
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdfPOINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
3 data-types-in-c
3 data-types-in-c3 data-types-in-c
3 data-types-in-cteach4uin
 
C data types, arrays and structs
C data types, arrays and structsC data types, arrays and structs
C data types, arrays and structsSaad Sheikh
 
Data types and Operators
Data types and OperatorsData types and Operators
Data types and Operatorsraksharao
 
Enumerated data types in C
Enumerated data types in CEnumerated data types in C
Enumerated data types in CArpana shree
 
arrays and pointers
arrays and pointersarrays and pointers
arrays and pointersSamiksha Pun
 
Lecture no 1
Lecture no 1Lecture no 1
Lecture no 1hasi071
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C ProgrammingQazi Shahzad Ali
 

Was ist angesagt? (19)

JAVA Literals
JAVA LiteralsJAVA Literals
JAVA Literals
 
Operators , Functions and Options in VB.NET
Operators , Functions and Options in VB.NETOperators , Functions and Options in VB.NET
Operators , Functions and Options in VB.NET
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
 
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdfPOINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
 
Type casting
Type castingType casting
Type casting
 
[ITP - Lecture 05] Datatypes
[ITP - Lecture 05] Datatypes[ITP - Lecture 05] Datatypes
[ITP - Lecture 05] Datatypes
 
Character set of c
Character set of cCharacter set of c
Character set of c
 
Basic of c &c++
Basic of c &c++Basic of c &c++
Basic of c &c++
 
3 data-types-in-c
3 data-types-in-c3 data-types-in-c
3 data-types-in-c
 
Ppt lesson 08
Ppt lesson 08Ppt lesson 08
Ppt lesson 08
 
C data types, arrays and structs
C data types, arrays and structsC data types, arrays and structs
C data types, arrays and structs
 
Data types and Operators
Data types and OperatorsData types and Operators
Data types and Operators
 
Enumerated data types in C
Enumerated data types in CEnumerated data types in C
Enumerated data types in C
 
arrays and pointers
arrays and pointersarrays and pointers
arrays and pointers
 
Lecture no 1
Lecture no 1Lecture no 1
Lecture no 1
 
Ppt lesson 07
Ppt lesson 07Ppt lesson 07
Ppt lesson 07
 
Lect 9(pointers) Zaheer Abbas
Lect 9(pointers) Zaheer AbbasLect 9(pointers) Zaheer Abbas
Lect 9(pointers) Zaheer Abbas
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
Type conversion
Type conversionType conversion
Type conversion
 

Andere mochten auch

Muhammad imtiaz azam. Cv
Muhammad imtiaz azam. CvMuhammad imtiaz azam. Cv
Muhammad imtiaz azam. CvImtiaz Azam
 
6º módulo 1ª aula
6º módulo   1ª aula6º módulo   1ª aula
6º módulo 1ª aulaJoel Silva
 
Water alternating gas (WAG) - A Enhanced Oil Recovery technique
Water alternating gas (WAG) - A Enhanced Oil Recovery techniqueWater alternating gas (WAG) - A Enhanced Oil Recovery technique
Water alternating gas (WAG) - A Enhanced Oil Recovery techniqueIbrahim Muhammad
 
Cellgen - Companion Diagnostic Platform
Cellgen - Companion Diagnostic PlatformCellgen - Companion Diagnostic Platform
Cellgen - Companion Diagnostic PlatformLavance L. Northington
 
Beyond Basic VoLTE Services: Avoiding 3 Mistakes of the Past
Beyond Basic VoLTE Services: Avoiding 3 Mistakes of the PastBeyond Basic VoLTE Services: Avoiding 3 Mistakes of the Past
Beyond Basic VoLTE Services: Avoiding 3 Mistakes of the PastRadisys Corporation
 
4º módulo 4ª aula
4º módulo   4ª aula4º módulo   4ª aula
4º módulo 4ª aulaJoel Silva
 
5º módulo 1ª aula
5º módulo   1ª aula5º módulo   1ª aula
5º módulo 1ª aulaJoel Silva
 
BCH Electric Limited- Complete Product Range Catalogue
BCH Electric Limited- Complete Product Range CatalogueBCH Electric Limited- Complete Product Range Catalogue
BCH Electric Limited- Complete Product Range CatalogueBCH Electric Limited
 

Andere mochten auch (10)

CV Rauf
CV RaufCV Rauf
CV Rauf
 
Muhammad imtiaz azam. Cv
Muhammad imtiaz azam. CvMuhammad imtiaz azam. Cv
Muhammad imtiaz azam. Cv
 
6º módulo 1ª aula
6º módulo   1ª aula6º módulo   1ª aula
6º módulo 1ª aula
 
Resume_Irshad
Resume_IrshadResume_Irshad
Resume_Irshad
 
Water alternating gas (WAG) - A Enhanced Oil Recovery technique
Water alternating gas (WAG) - A Enhanced Oil Recovery techniqueWater alternating gas (WAG) - A Enhanced Oil Recovery technique
Water alternating gas (WAG) - A Enhanced Oil Recovery technique
 
Cellgen - Companion Diagnostic Platform
Cellgen - Companion Diagnostic PlatformCellgen - Companion Diagnostic Platform
Cellgen - Companion Diagnostic Platform
 
Beyond Basic VoLTE Services: Avoiding 3 Mistakes of the Past
Beyond Basic VoLTE Services: Avoiding 3 Mistakes of the PastBeyond Basic VoLTE Services: Avoiding 3 Mistakes of the Past
Beyond Basic VoLTE Services: Avoiding 3 Mistakes of the Past
 
4º módulo 4ª aula
4º módulo   4ª aula4º módulo   4ª aula
4º módulo 4ª aula
 
5º módulo 1ª aula
5º módulo   1ª aula5º módulo   1ª aula
5º módulo 1ª aula
 
BCH Electric Limited- Complete Product Range Catalogue
BCH Electric Limited- Complete Product Range CatalogueBCH Electric Limited- Complete Product Range Catalogue
BCH Electric Limited- Complete Product Range Catalogue
 

Ähnlich wie C sharp_basic_ideas

Csharp4 operators and_casts
Csharp4 operators and_castsCsharp4 operators and_casts
Csharp4 operators and_castsAbed Bukhari
 
Python programming workshop
Python programming workshopPython programming workshop
Python programming workshopBAINIDA
 
CSharp Language Overview Part 1
CSharp Language Overview Part 1CSharp Language Overview Part 1
CSharp Language Overview Part 1Hossein Zahed
 
Bsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and stringsBsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and stringsRai University
 
Dr. Rajeshree Khande : Java Basics
Dr. Rajeshree Khande  : Java BasicsDr. Rajeshree Khande  : Java Basics
Dr. Rajeshree Khande : Java BasicsDrRajeshreeKhande
 
Dr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javaDr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javajalinder123
 
Btech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and stringsBtech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and stringsRai University
 
Functions torage class and array and strings-
Functions torage class and array and strings-Functions torage class and array and strings-
Functions torage class and array and strings-aneebkmct
 
Type header file in c++ and its function
Type header file in c++ and its functionType header file in c++ and its function
Type header file in c++ and its functionFrankie Jones
 
Diploma ii cfpc u-4 function, storage class and array and strings
Diploma ii  cfpc u-4 function, storage class and array and stringsDiploma ii  cfpc u-4 function, storage class and array and strings
Diploma ii cfpc u-4 function, storage class and array and stringsRai University
 
function, storage class and array and strings
 function, storage class and array and strings function, storage class and array and strings
function, storage class and array and stringsRai University
 
Mcai pic u 4 function, storage class and array and strings
Mcai pic u 4 function, storage class and array and stringsMcai pic u 4 function, storage class and array and strings
Mcai pic u 4 function, storage class and array and stringsRai University
 
Chapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).pptChapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).ppthenokmetaferia1
 

Ähnlich wie C sharp_basic_ideas (20)

Csharp4 operators and_casts
Csharp4 operators and_castsCsharp4 operators and_casts
Csharp4 operators and_casts
 
C tutorial
C tutorialC tutorial
C tutorial
 
Python programming workshop
Python programming workshopPython programming workshop
Python programming workshop
 
Csharp4 basics
Csharp4 basicsCsharp4 basics
Csharp4 basics
 
vb.net.pdf
vb.net.pdfvb.net.pdf
vb.net.pdf
 
CSharp Language Overview Part 1
CSharp Language Overview Part 1CSharp Language Overview Part 1
CSharp Language Overview Part 1
 
Bsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and stringsBsc cs i pic u-4 function, storage class and array and strings
Bsc cs i pic u-4 function, storage class and array and strings
 
Dr. Rajeshree Khande : Java Basics
Dr. Rajeshree Khande  : Java BasicsDr. Rajeshree Khande  : Java Basics
Dr. Rajeshree Khande : Java Basics
 
Dr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javaDr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic java
 
Btech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and stringsBtech i pic u-4 function, storage class and array and strings
Btech i pic u-4 function, storage class and array and strings
 
Functions torage class and array and strings-
Functions torage class and array and strings-Functions torage class and array and strings-
Functions torage class and array and strings-
 
Type header file in c++ and its function
Type header file in c++ and its functionType header file in c++ and its function
Type header file in c++ and its function
 
VHDL
VHDLVHDL
VHDL
 
Diploma ii cfpc u-4 function, storage class and array and strings
Diploma ii  cfpc u-4 function, storage class and array and stringsDiploma ii  cfpc u-4 function, storage class and array and strings
Diploma ii cfpc u-4 function, storage class and array and strings
 
function, storage class and array and strings
 function, storage class and array and strings function, storage class and array and strings
function, storage class and array and strings
 
unit 1 (1).pptx
unit 1 (1).pptxunit 1 (1).pptx
unit 1 (1).pptx
 
Mcai pic u 4 function, storage class and array and strings
Mcai pic u 4 function, storage class and array and stringsMcai pic u 4 function, storage class and array and strings
Mcai pic u 4 function, storage class and array and strings
 
Java Cheat Sheet
Java Cheat SheetJava Cheat Sheet
Java Cheat Sheet
 
C# overview part 1
C# overview part 1C# overview part 1
C# overview part 1
 
Chapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).pptChapter 2&3 (java fundamentals and Control Structures).ppt
Chapter 2&3 (java fundamentals and Control Structures).ppt
 

C sharp_basic_ideas