Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain
|
|
- Stephany Dean
- 5 years ago
- Views:
Transcription
1 Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain
2 Overview. C# program structure. Variables and Constant. Conditional statement (if, if/else, nested if and switch statement). Repetition Control Structures 1. while. 2. Do while. 3. for Statement. Flow control statements (continue and break) Array ( One and Two dimensional array) 10/16/2016 1
3 Overview. C# is a modern, general-purpose, object-oriented programming language developed by Microsoft and approved by European Computer Manufacturers Association (ECMA) and International Standards Organization (ISO). C# was developed by Anders Hejlsberg and his team during the development of.net Framework. C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows use of various highlevel languages on different computer platforms and architectures. 10/16/2016 2
4 Overview. Anders Hejlsberg 10/16/2016 3
5 C# program structure: Code NamespaceBlock namespace NamespaceName NamespaceBody identifier(system) Class Block public class Class Name ClassBody identifier(myclass) Class Members 10/16/2016 4
6 C# program structure: Creating Hello World Program: A C# program consists of the following parts: Namespace declaration A class Class methods Class attributes A Main method Statements and Expressions Comments Let us look at a simple code that prints the words "Hello World": 10/16/2016 5
7 C# program structure: using System; namespace HelloWorldApplication class HelloWorld static void Main(string[] args) /* my first program in C# */ Console.WriteLine("Hello World"); Console.ReadKey(); 10/16/2016 6
8 Variables and Constant Unified Type System: Types Value Types reference Types Pointer Simple Types Enums Structs Int, bool, double, long, ulong, byte, short, ushort, char, float, sbyte, unit, decimal. Class Interface Delegates Array 10/16/2016 7
9 Variables and Constant Defining Variables Syntax for variable definition in C# is: <data_type> <variable_list>; Declar Variables: byte MyByteVariable; int _Value123; ulong AVeryLargeNumber; Naming Your Variables: Each variable that you use in your C# code must have a name. Variable names are interpreted as identifiers by the C# compiler and must follow the naming conventions for an identifier: The first character in an identifier must start with an uppercase or lowercase letter or an underscore character. The characters following the first character can be any of the following: An uppercase or lowercase letter A digit An underscore 10/16/2016 8
10 Variables and Constant Using Default Values for Variables: int MyVariable; System.Console.WriteLine(MyVariable); ******* OutPut: error CS0165: Use of unassigned local variable 'MyVariable' Initializing Variables: variable_name = value; int d = 3, f = 5; /* initializing d and f. */ byte z = 22; /* initializes z. */ double pi = ; /* declares an approximation of pi. */ char x = 'x'; /* the variable x has the value 'x'. */ 10/16/2016 9
11 Variables and Constant Accepting Values from User: The Console class in the System namespace provides a function ReadLine() for accepting input from the user and store it into a variable. For example/ int num; num = Convert.ToInt32(Console.ReadLine()); 10/16/
12 Variables and Constant Value Type : Value type variables can be assigned a value directly. They are derived from the class System.ValueType. The value types directly contain data. Some examples are int, char, and float, which stores numbers, alphabets, and floating point numbers, respectively. 10/16/
13 Variables and Constant Value Type : namespace DataTypeApplication class Program static void Main(string[] args) Console.WriteLine("Size of int: 0", sizeof(int)); Console.ReadLine(); Result Size of int: 4 10/16/
14 Variables and Constant Reference Type: The reference types do not contain the actual data stored in a variable, but they contain a reference to the variables. In other words, they refer to a memory location. Using multiple variables, the reference types can refer to a memory location. If the data in the memory location is changed by one of the variables, the other variable automatically reflects this change in value. Example of built-in reference types are: object, dynamic, and string. 10/16/
15 Variables and Constant 1. Object Type : The Object Type is the ultimate base class for all data types in C# Common Type System (CTS). Object is an alias for System.Object class. The object types can be assigned values of any other types, value types, reference types, predefined or user-defined types. However, before assigning values, it needs type conversion. When a value type is converted to object type, it is called boxing. The other hand, when an object type is converted to a value type, it is called unboxing. Example: object obj; int i; obj = 100; // this is boxing i=(int) obj; //unboxing 10/16/
16 Variables and Constant 2. Dynamic Type : You can store any type of value in the dynamic data type variable. Type checking for these types of variables takes place at run-time. Dynamic types are similar to object types except that type checking for object type variables takes place at compile time. Syntax for declaring a dynamic type is: dynamic <variable_name> = value; For example, dynamic d = 20; 10/16/
17 Variables and Constant 3. String Type: The String Type allows you to assign any string values to a variable. The string type is an alias for the System.String class. It is derived from object type. The value for a string type can be assigned using string literals in two forms: quoted For example, String str = "Tutorials Point"; 10/16/
18 Variables and Constant 4. Pointer Type: Pointer type variables store the memory address of another type. Pointers in C# have the same capabilities as the pointers in C or C++. Syntax for declaring a pointer type is: type* identifier; For example, char* cptr; int* iptr; 10/16/
19 Variables and Constant Constant: Constants: are variables whose values, once defined, can not be changed by the program. Constant variables are declared using the const keyword, like: const double PI = 3.142; Constant variables must be initialized as they are declared. It is a syntax error to write: const int MARKS; It is conventional to use capital letters when naming constant variables. 10/16/
20 Conditional statement Conditional Logic: To be able to control the flow in your program is important in every programming language. The two most important techniques are: 1. The if Statement 2. The switch Statement 1. If Statement: An if statement allows you to take different paths of logic, depending on a given condition. When the condition evaluates to a boolean true, a block of code for that true condition will execute. bool mytest; mytest=false; if (mytest==false) MessageBox.Show("Hello"); 10/16/
21 Conditional statement If we have more than one line of code that that shall be executed, we need to use braces. bool mytest; mytest=false; if (mytest == false) MessageBox.Show("Hello1"); MessageBox.Show("Hello2"); 10/16/
22 Conditional statement 2. If..else Statement: For more complex logic we use the if else statement. bool mytest; mytest=true; if (mytest == false) MessageBox.Show("Hello1"); else MessageBox.Show("Hello2"); 10/16/
23 Conditional statement 3. Nested If..else Statement: Start int mytest; mytest=2; if (mytest == 1) MessageBox.Show("Hello1"); else if (mytest == 2) MessageBox.Show("Hello2"); else MessageBox.Show("Hello3"); S1 F Is This True F S2 T Is This True T S3 End 10/16/
24 Conditional statement 4. The? : Operator: We have covered conditional operator? : It has the following general form: Exp1? Exp2 : Exp3; Example in if else statement x=10; If(x>10) x/=2 else x/=4; Example in conditional operator x=10; x=x>10? x/2 : x/4; Homework// Convert the if..else if conditional statement that shown bellow, to form of conditional operator?:. int z=10; int x = 10; int y = 5; if (x == y) Console.WriteLine(z += x); else if (x == z) Console.WriteLine(z += y); else Console.WriteLine(z += 1); 10/16/
25 Conditional statement 5. Switch Statement: Another form of selection statement is the switch statement, which executes a set of logic depending on the value of a given parameter. 10/16/
26 Conditional statement Example: switch (mytest) case 1: MessageBox.Show("Hello1"); break; case 2: MessageBox.Show("Hello2"); break; default: MessageBox.Show("Hello3"); break; 5. Repetition Control Structures:(while, Do while, for Statements) A loop statement allows us to execute a statement or a group of statements multiple times and following is the general from of a loop statement in most of the programming languages: 10/16/
27 Repetition Control Structures Loop: 1. While Loop: A while loop statement in C# repeatedly executes a target statement as long as a given condition is true. Syntax The syntax of a while loop in C# is: while(condition) statement(s); 10/16/
28 Repetition Control Structures Example/// using System; namespace Loops class Program static void Main(string[] args) /* local variable definition */ int a = 10; while loop execution */ while (a < 20) Console.WriteLine("value of a: 0", a); a++; Console.ReadLine(); 10/16/
29 Repetition Control Structures 2. Do While Loop: Unlike for and while loops, which test the loop condition at the start of the loop, the do...while loop checks its condition at the end of the loop. A do...while loop is similar to a while loop, except that a do...while loop is guaranteed to execute at least one time. Syntax: The syntax of a do...while loop in C# is: do statement(s); while( condition ); 10/16/
30 Repetition Control Structures Example using System; namespace Loops class Program static void Main(string[] args) /* local variable definition */ int a = 10; /* do loop execution */ do Console.WriteLine("value of a: 0", a); a = a + 1; while (a < 20); Console.ReadLine(); 10/16/
31 Repetition Control Structures 3. For Loop: A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times. Syntax: The syntax of a for loop in C# is: for ( int ; condition; increment ) statement(s); 10/16/
32 Repetition Control Structures Example// using System; namespace Loops class Program static void Main(string[] args) /* for loop execution */ for (int a = 10; a < 20; a = a + 1) Console.WriteLine("value of a: 0", a); Console.ReadLine(); 10/16/
33 Repetition Control Structures 5. Foreach Loop: Foreach uses no integer index. Instead, it is used on a collection it returns each element in order. Example_1 Example_2 using System; string s = "ABC"; foreach(char c in s) Console.WriteLine(c); class Program static void Main() string[] pets = "dog", "cat", "bird" ; Homework. Given an example using nested loops? //... Loop with the foreach keyword. foreach (string value in pets) Console.WriteLine(value); 10/16/
34 Flow Control(Continue and Break) Flow Control 1. Continue: Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating. using System; namespace Loops class Program static void Main(string[] args) int a = 10; do if (a == 15) a = a + 1; continue; Console.WriteLine("value of a: 0", a); a++; while (a < 20); Console.ReadLine(); 10/16/
35 Flow Control(Continue and Break) 2. Break: The break statement in C# has following two usage: 1. When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop. 2. It can be used to terminate a case in the switch statement. using System; namespace Loops class Program static void Main(string[] args) int a = 10; while (a < 20) Console.WriteLine("value of a: 0", a); a++; if (a > 15) break; //End Loop Console.ReadLine(); 3. Return statements..?????? in void and function methods 10/16/
36 Array in C# Array An array stores a fixed-size sequential collection of elements of the same type. array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type stored at contigeous memory locations. All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element. Declaring Arrays: datatype[] arrayname; for Example.. int[] marks; Initializing an Array: Array is a reference type, so you need to use the new keyword to create an instance of the array. For example, int[] marks= new int[10]; 10/16/
37 Array in C# Assigning Values to an Array: You can assign values to individual array elements, by using the index number, like: int[] marks= new int[10]; marks[0] = 80; You can assign values to the array at the time of declaration as shown: int[] balance = , , ; You can also create and initialize an array as shown: int[] marks = new int[5] 99, 98, 92, 97, 95; You may also omit the size of the array as shown: int[] marks = new int[] 99, 98, 92, 97, 95; You can copy an array variable into another target array variable In such case, both the target and source point to the same memory location: int [] marks = new int[] 99, 98, 92, 97, 95; int[] score = marks 10/16/
38 Array in C# Accessing Array Elements: An element is accessed by indexing the array name. This is done by placing the index of the element within square brackets after the name of the array. For example, double salary = balance[9]; Example. using System; namespace ArrayApplication class MyArray static void Main(string[] args) int [] n = new int[10]; int i,j; for ( i = 0; i < 10; i++ ) n[ i ] = i + 100; for (j = 0; j < 10; j++ ) Console.WriteLine("Element[0] = 1", j, n[j]); Console.ReadKey(); Homework Display the elements of array n[], using the foreach loop? 10/16/
39 Array in C# 1. One Dimensional Array: You can declare a single-dimensional array of five integers as shown in the following example: int[] array = new int[5]; An array that stores string elements can be declared in the same way. For example: string[] stringarray = new string[6]; Initializing array int[] array1 = new int[] 1, 3, 5, 7, 9 ; string[] weekdays = "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ; int[] array2 = 1, 3, 5, 7, 9 ; string[] weekdays2 = "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ; int[] array3; array3 = new int[] 1, 3, 5, 7, 9 ; // OK //array3 = 1, 3, 5, 7, 9; // Error 10/16/
40 Array in C# Example Write a program in C# using Console application to get one dimension array string[5], input name of five subjects and display them? using System; using System.Collections.Generic; using System.Linq; using System.Text; Console.WriteLine("All the element of Books array is:\n\n"); namespace One_Dimensional_Array class Program static void Main(string[] args) //Declaring single dimensional array string[] Books = new string[5]; Books[0] = "C#"; Books[1] = "Java"; Books[2] = "VB.NET"; Books[3] = "C++"; Books[4] = "C"; int i = 0; //Formatting Output Console.Write("\t1\t2\t3\t4\t5\n\n\t"); for (i = 0; i < 5; i++) Console.Write("0\t", Books[i]); Console.ReadLine(); 10/16/
41 Array in C# Homework 1. Write a program to find the size or the length of 1d array? 2. If we have array size of 5 integer number how to resize it at run time to add 10 integer numbers? 3. Write a program in c# to create an array with different data type? 4. How to sort an integer number? sol int[] array = new int[] 3, 1, 4, 5, 2 ; Array.Sort(array); foreach (var str in array) Console.writeline(str.ToString()); 5. Sort an Integer array in descending order? 10/16/
42 Array in C# 2. Two Dimensional Array: C# allows multidimensional arrays. Multi-dimensional arrays are also called rectangular array. You can declare a 2-dimensional array of strings as: string [,] names; or, a 3-dimensional array of int variables as: int [,, ] m; The simplest form of the multidimensional array is the 2-dimensional array. A 2- dimensional array is a list of one-dimensional arrays. Initializing Two-Dimensional Arrays: Multidimensional arrays may be initialized by specifying bracketed values for each row. The following array is with 3 rows and each row has 4 columns. int [,] a = int [3,4] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11; Accessing Two-Dimensional Array Elements An element in 2-dimensional array is accessed by using the subscripts.that is, row index and column index of the array. For example, int val = a[2,3]; 10/16/
43 Array in C# Homework 1. Write a program to creates a 2x2 string array and then prints out all four elements using while loop? 2. What is the value of the UpperBound(0) method of the 2d array that show bellow double[,] price= double[10,5]; 3. How to know home many row in the array of two dimension array? Sol. int[,] n= new int[,]; Console.Writline(n.getliength(0)); 4. What is the output for this segment code? string[] names = new string "John", "Tom", "Peter" ; foreach (string name in names) if (name == "Tom") continue; Console.WriteLine(name); 10/16/
44 Thanks Any Questions 10/16/
.Net Technologies. Components of.net Framework
.Net Technologies Components of.net Framework There are many articles are available in the web on this topic; I just want to add one more article over the web by explaining Components of.net Framework.
More informationC# MOCK TEST C# MOCK TEST I
http://www.tutorialspoint.com C# MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to C#. You can download these sample mock tests at your local machine
More informationThis tutorial has been prepared for the beginners to help them understand basics of c# Programming.
About thetutorial C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its.net initiative led by Anders Hejlsberg. This tutorial covers basic C# programming
More informationDarshan Institute of Engineering & Technology for Diploma Studies
Overview of Microsoft.Net Framework: The Dot Net or.net is a technology that is an outcome of Microsoft s new strategy to develop window based robust applications and rich web applications and to keep
More informationWWW.STUDENTSFOCUS.COM Introduction C# (pronounced "C sharp") is a simple, modern, object-oriented, and type-safe programming language. It will immediately be familiar to C and C++ programmers. C# combines
More informationIntroduction to C# Applications
1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making
More informationC# Fundamentals. Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh
C# Fundamentals Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Semester 1 2018/19 H-W. Loidl (Heriot-Watt Univ) F20SC/F21SC 2018/19
More informationIntroduce C# as Object Oriented programming language. Explain, tokens,
Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation
More informationC# Types. Industrial Programming. Value Types. Signed and Unsigned. Lecture 3: C# Fundamentals
C# Types Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:
More informationIndustrial Programming
Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 C# Types Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:
More informationDuhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain
Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 Pointers: Pointer declaration and initialization. Pointer To Pointer. Arithmetic operation on pointer
More informationFig 1.1.NET Framework Architecture Block Diagram
Overview of Microsoft.NET Framework The.NET Framework is a technology that supports building and running the next generation of applications and XML Web services. Using.Net technology it is easy to use
More informationObjectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments
Basics Objectives Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments 2 Class Keyword class used to define new type specify
More informationJava Loop Control. Programming languages provide various control structures that allow for more complicated execution paths.
Loop Control There may be a situation when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first,
More informationBLM2031 Structured Programming. Zeyneb KURT
BLM2031 Structured Programming Zeyneb KURT 1 Contact Contact info office : D-219 e-mail zeynebkurt@gmail.com, zeyneb@ce.yildiz.edu.tr When to contact e-mail first, take an appointment What to expect help
More informationDuhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain
Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 String and files: String declaration and initialization. Strings and Char Arrays: Properties And Methods.
More informationIntroduction To C#.NET
Introduction To C#.NET Microsoft.Net was formerly known as Next Generation Windows Services(NGWS).It is a completely new platform for developing the next generation of windows/web applications. However
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More informationdata_type variable_name = value; Here value is optional because in java, you can declare the variable first and then later assign the value to it.
Introduction to JAVA JAVA is a programming language which is used in Android App Development. It is class based and object oriented programming whose syntax is influenced by C++. The primary goals of JAVA
More informationBasic Elements of C. Staff Incharge: S.Sasirekha
Basic Elements of C Staff Incharge: S.Sasirekha Basic Elements of C Character Set Identifiers & Keywords Constants Variables Data Types Declaration Expressions & Statements C Character Set Letters Uppercase
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting
More informationDigiPen Institute of Technology
DigiPen Institute of Technology Presents Session Two: Overview of C# Programming DigiPen Institute of Technology 5001 150th Ave NE, Redmond, WA 98052 Phone: (425) 558-0299 www.digipen.edu 2005 DigiPen
More informationEEE-425 Programming Languages (2013) 1
2 Namespaces Classes Fields Properties Methods Attributes Events Interfaces (contracts) Methods Properties Events Control Statements if, else, while, for, switch foreach Additional Features Operation Overloading
More information204111: Computer and Programming
204111: Computer and Programming Week 4: Control Structures t Monchai Sopitkamon, Ph.D. Overview Types of control structures Using selection structure Using repetition structure Types of control ol structures
More informationVisual C# Instructor s Manual Table of Contents
Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms
More informationLecture (07) Arrays. By: Dr. Ahmed ElShafee. Dr. Ahmed ElShafee, ACU : Fall 2015, Programming I
Lecture (07) Arrays By: Dr Ahmed ElShafee ١ introduction An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type Instead
More informationegrapher Language Reference Manual
egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction
More informationARRAYS(II Unit Part II)
ARRAYS(II Unit Part II) Array: An array is a collection of two or more adjacent cells of similar type. Each cell in an array is called as array element. Each array should be identified with a meaningful
More informationBASIC ELEMENTS OF A COMPUTER PROGRAM
BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators
More informationLearn C# Errata. 3-9 The Nullable Types The Assignment Operators
1 The following pages show errors from the original edition, published in July 2008, corrected in red. Future editions of this book will be printed with these corrections. We apologize for any inconvenience
More informationC#: framework overview and in-the-small features
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer
More informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
More informationIntroduction to Java & Fundamental Data Types
Introduction to Java & Fundamental Data Types LECTURER: ATHENA TOUMBOURI How to Create a New Java Project in Eclipse Eclipse is one of the most popular development environments for Java, as it contains
More informationDEPARTMENT OF MATHS, MJ COLLEGE
T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,
More informationObject oriented programming. Instructor: Masoud Asghari Web page: Ch: 3
Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning
More information12 CREATING NEW TYPES
Lecture 12 CREATING NEW TYPES of DATA Typedef declaration Enumeration Structure Bit fields Uninon Creating New Types Is difficult to solve complex problems by using programs written with only fundamental
More information6.096 Introduction to C++ January (IAP) 2009
MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture
More informationHierarchical inheritance: Contains one base class and multiple derived classes of the same base class.
1. What is C#? C# (pronounced "C sharp") is a simple, modern, object oriented, and type safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity
More informationAdvanced Computer Programming
Hazırlayan Yard. Doç. Dr. Mehmet Fidan VARIABLE TYPES Integral Types: In C#, an integral is a category of types. For anyone confused because the word Integral sounds like a mathematical term, from the
More informationCharacter Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Uppercase Alphabets Lowercase Alphabets Character Set A, B, C, Y, Z a, b, c, y, z Digits
More informationQuestion And Answer.
Q.1 What would be the output of the following program? using System; namespaceifta classdatatypes static void Main(string[] args) inti; Console.WriteLine("i is not used inthis program!"); A. i is not used
More informationFollowing is the general form of a typical decision making structure found in most of the programming languages:
Decision Making Decision making structures have one or more conditions to be evaluated or tested by the program, along with a statement or statements that are to be executed if the condition is determined
More informationBIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic
BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines
More informationPROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write
More informationComputational Expression
Computational Expression Variables, Primitive Data Types, Expressions Janyl Jumadinova 28-30 January, 2019 Janyl Jumadinova Computational Expression 28-30 January, 2019 1 / 17 Variables Variable is a name
More informationChapter-8 DATA TYPES. Introduction. Variable:
Chapter-8 DATA TYPES Introduction To understand any programming languages we need to first understand the elementary concepts which form the building block of that program. The basic building blocks include
More informationDC69 C# &.NET JUNE C# is a simple, modern, object oriented language derived from C++ and Java.
Q.2 a. What is C#? Discuss its features in brief. 1. C# is a simple, modern, object oriented language derived from C++ and Java. 2. It aims to combine the high productivity of Visual Basic and the raw
More informationCS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010
CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please
More informationIT 374 C# and Applications/ IT695 C# Data Structures
IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation
More informationADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1
NAGERCOIL COMPUTER SCIENCE Grade: IX C++ PROGRAMMING 1 C++ 1. Object Oriented Programming OOP is Object Oriented Programming. It was developed to overcome the flaws of the procedural approach to programming.
More informationChapter 2: Using Data
Chapter 2: Using Data Declaring Variables Constant Cannot be changed after a program is compiled Variable A named location in computer memory that can hold different values at different points in time
More informationChapter 1 Getting Started
Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement
More informationThe C++ Language. Arizona State University 1
The C++ Language CSE100 Principles of Programming with C++ (based off Chapter 2 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University
More informationData and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence
Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public
More informationCS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University
CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can
More informationComputers and Programming Section 450. Lab #1 C# Basic. Student ID Name Signature
Lab #1 C# Basic Sheet s Owner Student ID Name Signature Group partner 1. Identifier Naming Rules in C# A name must consist of only letters (A Z,a z), digits (0 9), or underscores ( ) The first character
More informationSTUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING
OBJECT ORIENTED PROGRAMMING STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING 1. Object Oriented Programming Paradigms 2. Comparison of Programming Paradigms 3. Basic Object Oriented Programming
More informationArrays. Comp Sci 1570 Introduction to C++ Array basics. arrays. Arrays as parameters to functions. Sorting arrays. Random stuff
and Arrays Comp Sci 1570 Introduction to C++ Outline and 1 2 Multi-dimensional and 3 4 5 Outline and 1 2 Multi-dimensional and 3 4 5 Array declaration and An array is a series of elements of the same type
More informationCSCI 1061U Programming Workshop 2. C++ Basics
CSCI 1061U Programming Workshop 2 C++ Basics 1 Learning Objectives Introduction to C++ Origins, Object-Oriented Programming, Terms Variables, Expressions, and Assignment Statements Console Input/Output
More informationJava+- Language Reference Manual
Fall 2016 COMS4115 Programming Languages & Translators Java+- Language Reference Manual Authors Ashley Daguanno (ad3079) - Manager Anna Wen (aw2802) - Tester Tin Nilar Hlaing (th2520) - Systems Architect
More informationLanguage Reference Manual
ALACS Language Reference Manual Manager: Gabriel Lopez (gal2129) Language Guru: Gabriel Kramer-Garcia (glk2110) System Architect: Candace Johnson (crj2121) Tester: Terence Jacobs (tj2316) Table of Contents
More informationGetting started with Java
Getting started with Java Magic Lines public class MagicLines { public static void main(string[] args) { } } Comments Comments are lines in your code that get ignored during execution. Good for leaving
More informationIntroduction to.net, C#, and Visual Studio. Part I. Administrivia. Administrivia. Course Structure. Final Project. Part II. What is.net?
Introduction to.net, C#, and Visual Studio C# Programming Part I Administrivia January 8 Administrivia Course Structure When: Wednesdays 10 11am (and a few Mondays as needed) Where: Moore 100B This lab
More informationCP FAQS Q-1) Define flowchart and explain Various symbols of flowchart Q-2) Explain basic structure of c language Documentation section :
CP FAQS Q-1) Define flowchart and explain Various symbols of flowchart ANS. Flowchart:- A diagrametic reperesentation of program is known as flowchart Symbols Q-2) Explain basic structure of c language
More informationDAD Lab. 1 Introduc7on to C#
DAD 2017-18 Lab. 1 Introduc7on to C# Summary 1..NET Framework Architecture 2. C# Language Syntax C# vs. Java vs C++ 3. IDE: MS Visual Studio Tools Console and WinForm Applica7ons 1..NET Framework Introduc7on
More information3 The Building Blocks: Data Types, Literals, and Variables
chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating
More informationOutline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors
Outline Overview history and advantage how to: program, compile and execute 8 data types 3 types of errors Control statements Selection and repetition statements Classes and methods methods... 2 Oak A
More informationDuhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain
Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 Objects and classes: Basics of object and class in C#. Private and public members and protected. Static
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler
More informationTo declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows
Unti 4: C Arrays Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type An array is used to store a collection of data, but it is often more useful
More informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
More informationGridLang: Grid Based Game Development Language Language Reference Manual. Programming Language and Translators - Spring 2017 Prof.
GridLang: Grid Based Game Development Language Language Reference Manual Programming Language and Translators - Spring 2017 Prof. Stephen Edwards Akshay Nagpal Dhruv Shekhawat Parth Panchmatia Sagar Damani
More informationCOMP 202 Java in one week
COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of
More informationA Fast Review of C Essentials Part I
A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types
More information1 Lexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler
More informationJava Language Basics: Introduction To Java, Basic Features, Java Virtual Machine Concepts, Primitive Data Type And Variables, Java Operators,
Java Language Basics: Introduction To Java, Basic Features, Java Virtual Machine Concepts, Primitive Data Type And Variables, Java Operators, Expressions, Statements and Arrays. Java technology is: A programming
More information1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...
Contents 1 Introduction 3 1.1 Java, the beginning.......................... 3 1.2 Java Virtual Machine........................ 4 1.3 A First Program........................... 4 1.4 BlueJ.................................
More informationMore non-primitive types Lesson 06
CSC110 2.0 Object Oriented Programming Ms. Gnanakanthi Makalanda Dept. of Computer Science University of Sri Jayewardenepura More non-primitive types Lesson 06 1 2 Outline 1. Two-dimensional arrays 2.
More informationCreating a C++ Program
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer. 1 Creating a C++ Program created using an
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College October 24, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Expressions and Operator Precedence
More informationRicardo Rocha. Department of Computer Science Faculty of Sciences University of Porto
Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto Adapted from the slides Revisões sobre Programação em C, Sérgio Crisóstomo Compilation #include int main()
More informationIntroduction to C Final Review Chapters 1-6 & 13
Introduction to C Final Review Chapters 1-6 & 13 Variables (Lecture Notes 2) Identifiers You must always define an identifier for a variable Declare and define variables before they are called in an expression
More informationA Comparison of Visual Basic.NET and C#
Appendix B A Comparison of Visual Basic.NET and C# A NUMBER OF LANGUAGES work with the.net Framework. Microsoft is releasing the following four languages with its Visual Studio.NET product: C#, Visual
More informationComputer Components. Software{ User Programs. Operating System. Hardware
Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point
More informationSoftware Programming Objectives
Team 2228 CougarTech 1 Software Programming Objectives Part I Understand the Atomic element of the computer Understand the structure of a computer Understand types of computer languages Understand program
More informationInput And Output of C++
Input And Output of C++ Input And Output of C++ Seperating Lines of Output New lines in output Recall: "\n" "newline" A second method: object endl Examples: cout
More informationIntroduction to C# Applications Pearson Education, Inc. All rights reserved.
1 3 Introduction to C# Applications 2 What s in a name? That which we call a rose by any other name would smell as sweet. William Shakespeare When faced with a decision, I always ask, What would be the
More informationB.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University
Unit 1 Programming Language and Overview of C 1. State whether the following statements are true or false. a. Every line in a C program should end with a semicolon. b. In C language lowercase letters are
More informationFundamentals of Programming CS-110. Lecture 2
Fundamentals of Programming CS-110 Lecture 2 Last Lab // Example program #include using namespace std; int main() { cout
More informationProgramming in C. What is C?... What is C?
Programming in C UVic SEng 265 C Developed by Brian Kernighan and Dennis Ritchie of Bell Labs Earlier, in 1969, Ritchie and Thompson developed the Unix operating system We will be focusing on a version
More informationPointers, Dynamic Data, and Reference Types
Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation The new operator The delete operator Dynamic Memory Allocation for Arrays 1 C++ Data Types simple
More informationLecture Notes on Programming Languages
Lecture Notes on Programming Languages 37 Lecture 04: Data Types and Variables All programming languages provide data types. A data type describes a set of data values and a set of predefined operations
More informationINTRODUCTION 1 AND REVIEW
INTRODUTION 1 AND REVIEW hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Programming: Advanced Objectives You will learn: Program structure. Program statements. Datatypes. Pointers. Arrays. Structures.
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More informationUNIT - I. Introduction to C Programming. BY A. Vijay Bharath
UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been
More informationCS201 Some Important Definitions
CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationObject-Oriented Programming
Object-Oriented Programming Java Syntax Program Structure Variables and basic data types. Industry standard naming conventions. Java syntax and coding conventions If Then Else Case statements Looping (for,
More information