Presentation is loading. Please wait.

Presentation is loading. Please wait.

Welcome to Visual Programming using C#

Similar presentations


Presentation on theme: "Welcome to Visual Programming using C#"— Presentation transcript:

1 Welcome to Visual Programming using C#
What the Course is About

2 Course info Instructor: Yrd. Doç. Dr. Cengiz Örencik
Course material all the notes / codes will be shared there

3 Book Not required You may use any programming book on C#
Microsoft Visual C# .NET step by step John Sharp and Jon Jagger

4 Grading Midterm 30% Inclass quizes (2) 20% (10+10) Final 50% Hws
Mostly coding Self study Not be graded

5 Aims to learn Developing an algorithmic way of thinking
The nature of object oriented programming Operators, precedence Class, objects, methods etc. Building big programs using small ones. Test/debug Inheritance, polymorphism …. GUI design Toolbox and control properties Event driven programming Exception handling

6 Tentative Outline Classes (constructor, properties, access/modify)
Methods (overloading, pass by reference, scope of variables…) Introduction to visual programming (textbox, buttons, checkbox, radiobuton, timer…) Control statements (if-else, switch, while, for, do-while) Arrays, strings (sorting, searching) Recursion Inheritance and Polymorphism Generics (type independent) Exception handling Files and streams

7 Getting started You will need an integrated development environment (IDE) Download Visual Studio Community 2015 If you already have a running visual studio you may go on with it, they are more or less the same If you prefer an open source IDE, you may use SharpDevelop Almost the same interface with visual studio

8 Add 3 Number Lets do it from scratch First as console application
Next as Visual Read input/write output

9 Data Types Char String Bool For single character
Digits, letters, symbols… One byte (8 bit) Can store 28 = 256 different values String Any set of chars (words, sentences) Can be arbitrarily long More tecnically, string is a class Bool True / false

10 Numeric Types int (short / long) signed versus unsigned integers
integer numbers no infinity in computers  limited range 4 bytes (32 bits) integer range: –2,147,483, ,147,483,647 for 32-bit computers why? signed versus unsigned integers you can put signed or unsigned keywords before the type unsigned integers use the same amount of bits but ranges are different 32-bit: ,294,967,295 (232 –1) Double 8 bytes (64 bits) e21

11 Arithmetic Operations
Mixed type expressions what if one operator is int other is double? integer is converted into double before operation 5.0 * is 40.0 5 / is 0 (integer division) 5.0 / is 0.5 (real division) 10 – 8 is 2 (integer) 10 – is 2.0 (double)

12 Expressions with several operators
You can use parentheses in expressions to group them Open ( and close ) parentheses should match Rule 1: Parenthesized sub-expressions are evaluated first inside to out Rule 2: Within an expression/subexpression if there are several operators, use operator precedence, evaluate * / % before + - Rule 3: If the operators are in the same expression/subexpression and at the same precedence level, then associativity rule applies evaluate operators from left-to-right Examples (5 - 3 * (7 - 3)) * is -56 10 / 2 * 6 / 2 + (5 - 3 * (2 - 1)) is 17

13 Expressions with several operators
Are the following expressions equivalent? (40 – 32) * 5 / 9 (40 – 32) * (5 / 9) NO, first one is 4, second one is 0 What about this? (40 – 32.0) * 5 / 9 Operations are double operations. Result is See the example Arithmeticoperations – console circleArea – Windows


Download ppt "Welcome to Visual Programming using C#"

Similar presentations


Ads by Google