C#_Lec1_Sakr

Embed Size (px)

Citation preview

  • 8/7/2019 C#_Lec1_Sakr

    1/20

    -

    C#.NET

  • 8/7/2019 C#_Lec1_Sakr

    2/20

    Why should we

    learn aprogramminglanguage ?

    Toda

    y , we know that almost all of theprocesses that we do or need in our daily life

    is managed by computer , computer is notthat intelligent machine that can collect

    INPUTS , guess the process that you want it todo to get the OUTPUT . No , it can not do this ,

    it needs your orders in each step starting inthe moment that the program is run to the

    moment it is closed in .That is Why you need a programming

    language .

  • 8/7/2019 C#_Lec1_Sakr

    3/20

    Why should we

    learn aprogramminglanguage ?Program

    ming language (C# for ex.) translatesthe process which we want the machine to do

    into CODES that the machine canunderstand . Actually , the computer dont

    under stand such a simple process like (1+2)in the way you see it , it needs this process to

    be converted into a number system (Binary)consists of only (0 & 1) , the language doesthis step to enable the machine to run the

    process in the way you planed to .

  • 8/7/2019 C#_Lec1_Sakr

    4/20

    Why should we

    learn aprogramminglanguage ?

    As an E

    ngineer , you are supposed to dealwith applications and operations that you will

    need the computer to run . For ex. , the airconditioning systems , power distribution

    control , data processes and a huge amount

    of operations are run and controlled bycomputer programs that made by a

    PROGRAMMING LANGUAGE .

  • 8/7/2019 C#_Lec1_Sakr

    5/20

    THE PROGRAMNEEDS INPUT ,

    A SPECIFIED

    PROCESSES , TOGIVE THE

  • 8/7/2019 C#_Lec1_Sakr

    6/20

    INPUTINTEGER,CHAR,

    FLOAT , SHORT

    PROCESS

    DIRECT

    OPERATIONS+ . - . / , , , %

    FLOW CONTROL

    COMMANDSIF, FOR, WHILE, DOWHILE , SWITCH

    OUTPU

    T

  • 8/7/2019 C#_Lec1_Sakr

    7/20

    Types of DATA

  • 8/7/2019 C#_Lec1_Sakr

    8/20

    My first program :

    Hello Egypt !Open your visual studio >> File >> new >>project

  • 8/7/2019 C#_Lec1_Sakr

    9/20

    Choose your settings as shown ,then press OK:

  • 8/7/2019 C#_Lec1_Sakr

    10/20

    Namespaces used in theprogram.

    The MAINfunctionWrite your code

    here !

    Namespace : a collection of classes each has a specificfunctions and methods that you need in the program , thismake the coding much more simpler as you dont have todefine this functions every time you need to use them .

    Ex. : System.Text (not system.text !) contains classes thatrepresent ASCII and Unicode character encodings.. Etc.

  • 8/7/2019 C#_Lec1_Sakr

    11/20

    Namespaces used in theprogram.

    The MAINfunctionWrite your code

    here !

    Main() : The Method or the BIG function where you put the codelines you want the program to run . All the code which makesthe process must be written in it in order to tell the COMBILER

    that this is the code of the operation

  • 8/7/2019 C#_Lec1_Sakr

    12/20

    Write the program shown , then from the menuchoose , or press , see what you get !

  • 8/7/2019 C#_Lec1_Sakr

    13/20

    If you has a Very fast eye , youll see this for a second ,If you have a very fast computer m you will not what ever you

    did !

  • 8/7/2019 C#_Lec1_Sakr

    14/20

    Change the program to be as following :

  • 8/7/2019 C#_Lec1_Sakr

    15/20

    The result will be as the following , this will remain until youpress the key

  • 8/7/2019 C#_Lec1_Sakr

    16/20

    Now , let us make a very little change in the code and run it :

  • 8/7/2019 C#_Lec1_Sakr

    17/20

    When we run the program , we had a different result , just ablack screen !!

    What does that mean ?!!!

  • 8/7/2019 C#_Lec1_Sakr

    18/20

    So, lets press and see what will happen !The result CHANGED ..?

    Yes !!

  • 8/7/2019 C#_Lec1_Sakr

    19/20

    PROCESSES

    :1- Process order

    The operations are written inthe form of CODE LINES , thiscode lines are taken in series

    while the program is run .The first code run first and so

    on .

  • 8/7/2019 C#_Lec1_Sakr

    20/20

    End of the first lectureHope it is helpful

    Thanks for you timeEng. Ahmed Sakr

    [email protected]