c# basics
TRANSCRIPT
![Page 1: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/1.jpg)
Puzzled about programming languages????
Abhishek Mukherjee | Utkarsh Srivastava
![Page 2: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/2.jpg)
What is programming?
• Think about a problem.• Any problem statement.• U will get a path to approach the problem.• Frame the path stepwise.• The same problem can be solved using your compiler.• The path of stepwise approaching the problem is called
algorithm.
![Page 3: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/3.jpg)
THE STEPS OF CREATING A CODE
Decide the approach of your Problem statement.i.e. some predefined algorithm or your own idea
Choice of languagei.e. object oriented(java , c#) or modular(c)
Compile Time errorsSyntax errors…
Execute the program after successful compilationRun time errors???!!!! Logical errors
Successful CompilationProceed to next problem…..
Algorithmkl
Various compliers are available for various languagesi.e. turbo(c , c ++ ) , dev etc….
Choice?
Compiler?
Problems…
Run…
Executed….
![Page 4: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/4.jpg)
• Many types of data can be worked upon• U might want to encrypt ur name(string
type)• U might want to make your own
personalized calculator(various types of numbers)
• U might want to have a binary output for your program(Boolean type)
• Many permutations are available for optimizing ur code.
• U might want to create an excel sheet(2D array)
BASICS OF PROGRAMMINGVariables
![Page 5: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/5.jpg)
• INTEGER(int)• Many types of int are available in
all languages• This includes types based on sizes• Int32,int64,int16 are the few
available in c#• Int64 is normally used in place of
long type numbers as in other languages
• DOUBLE and FLOAT• Smaller decimal number of 6th
precision can be stored in float types
• Float can be used to store decimal numbers upto 12th precision
• Any type conversion from int to these types leads to the the digits after the point becoming zero
• Type conversion takes place only form a datatype of hIgher size to a data type of lower size
DATA TYPES TO BE USED FOR NUMBERS
![Page 6: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/6.jpg)
• ARRAY(1 D)• Can be used to store multiple:• Integers• Strings• Double , Float• Boolean• Characters
• ARRAY(2 D)• The same data as 1d array can be
stored in a tabular form like data in rows and columns as in a excel sheet.
STORING MUTIPLE DATA IN A VARIABLE:
![Page 7: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/7.jpg)
• Predefined functions:• Defined by the language we use• Defined to serve a specific purpose• Allows reusability of code• Makes program more efficient by
making debugging easier
• User defined functions:• Make the code according to our
own specifications
FUNCTIONS
![Page 8: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/8.jpg)
• The coding will be operated on a specific operand/operands. These variables are called the parameters of the function
• The functionality of a function(coding of the function)
• The output value of the function i.e. the result of the operation preformation(if any) is called return value..
FUNCTIONS:Parts of a function:
![Page 9: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/9.jpg)
• Characters:• Used to store a single character• We have a system to represent any
character called ASCII• The values vary from 0-255• Example all capital letters have
values ranging form 65-90• This concept comes from the
concept of a byte• A byte contains 8 bits each and
thus 2^8 (256) combinations available
• Strings:• Used to store multiple characters.• Can be manipulated• Always stored in double quotes• String s=“C#”• Many functions available to
manipulate strings• Example of functions used-Length ,
substring
Variables Contd……
![Page 10: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/10.jpg)
• Call by reference:• The parameters which are
operated upon will change their value after function call
• In this case the memory reference of the parameter is sent which has the scope to change the original value of the variable bcoz the memory address is sent
• It has the advantage of returning multiple variables without actually returning them!!!!!!!!!!!!!!!
• Think yyy????
• Call by value:• It’s the normal function call where
we require normal function calls
FUNCTION CALLING:Two types:
![Page 11: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/11.jpg)
• GLOBAL:• Scope is defined throughout the scope of the program.• Can be accessed by all the functions of the program.• A Constructor needs to be initialized to give default
values to these variables.
• LOCAL:• These variables can be accessed
only in their specific function definitions
Another classification of variables:Scope…………..
![Page 12: C# basics](https://reader035.vdocuments.mx/reader035/viewer/2022070319/55820826d8b42aa9498b4fb6/html5/thumbnails/12.jpg)
NOW LETS CREATE SOME REAL TIME APPS