Building Applications

Size: px
Start display at page:

Download "Building Applications"

Transcription

1 V B. N E T P r o g r a m m i n g, T h e B a s i c C o n c e p t s a n d To o l s E n g. H a s a n A l h o u r i Building Applications analyzing designing coding testing deploying Eng. Hasan Alhouri 1

2 Programming Steps Writing the code in a high level language Compiling to an assembly Executing the executable program The structure solution Project1 project2 module1 module2 Class1 Class2 sub1 sub2 function1 function2 Eng. Hasan Alhouri 2

3 Notes about the structure The program has to be included within a solution. The program has to has one module at least. There is a module at which the compiler begins; it s called the main module. The main module has to has one subroutine at least, which has the name main. Each module has to be saved as.vb file. The Simplest Program module module1 sub main() console.writeline( the smallest program ) end sub end module Module definition Main() is a mandatory sub in the console application A command that print something on the screen The compiler need to know that the sub ends at some place The compiler need to know that the module ends at some place Eng. Hasan Alhouri 3

4 The Keywords module, sub, end module and end sub are keywords. The keywords are known by the compiler. They tell it some things. They have to be written correctly. They can t be used for other purposes. Printing Texts writeline( the smallest program ) write( the smallest ) write( program ) writeline() Eng. Hasan Alhouri 4

5 Name Spaces module module1 omit this sub main() console.writeline( the smallest program ) end sub end module Imports system.console module module1 sub main() writeline( the smallest program ) end sub end module and add this A module with more than a subroutine Imports system.console module module1 sub main() writeline( first time ) print_hello() writeline( first time ) print_hello() writeline( that s enough ) end sub sub print_hello() writeline( Hello ) end sub end module Eng. Hasan Alhouri 5

6 The scenario sub main() writeline( first time ) print_hello() writeline( first time ) print_hello() writeline( enough ) end sub sub print_hello() writeline( Hello ) end sub Main() writeline( first time ) print_hello() print_hello() writeline( enough ) Print_hello() writeline( Hello ) writeline( Hello ) Comments module module1 sub main() console.writeline( the smallest program ) console.writeline( comments ) this is a comment this line will not be executed end sub end module Eng. Hasan Alhouri 6

7 Breaking out a long command writeline( this is a tall command &_ so we have to break it out into two &_ lines ) writeline( this is a tall command so we have to break it out into two lines ) More than a command on a line writeline( this is so funny ):writeline( that we are learning programming ) writeline( this is so funny ) writeline( that we are learning programming ) Eng. Hasan Alhouri 7

8 Variables dim x1 as integer x1 0 x1=12 x1 12 dim x2 as integer=3 x2 3 dim x3 as integer=4.3 x3 4 dim x4 as integer=4.7 x4 5 Variables Special case: When the decimal part is 5 Even integer part rounded down dim x5 as integer=4.5 x5 4 dim x6 as integer=3.5 x6 4 Odd integer part rounded up Eng. Hasan Alhouri 8

9 Variables dim x7,x8 as integer x7 x8 0 0 dim x9 as integer, x10 as double x9 x dim x11 as integer=21, x12 as double=2.7 x11 x Variables dim c1 as char c1 c2= A c2 A dim c3 as char= 312 c3 3 Eng. Hasan Alhouri 9

10 Variables dim s1 as string s1 s1= Hello s1 Hello dim s2 as string= Samer s2 Samer writeline(s1 & & s2) Hello Samer Variables Long (Int64) Integer (Int32) Short (Int16) Byte Eng. Hasan Alhouri 10

11 Variables Double Single E E E E+308 Getting Information about Variables dim x1,x2,x3 as integer x1=31 : x2=0 : x3= -17 x1 x2 x writeline(sign(x1)) writeline(sign(x2)) writeline(sign(x3)) Eng. Hasan Alhouri 11

12 Getting Information about Variables dim x1as integer writeline(x1.min()) writeline(x1.max()) The Arithmetical Operations writeline(3+4) 7 writeline(3-4) -1 writeline(3*4) 12 writeline(3^4) 81 Eng. Hasan Alhouri 12

13 The Arithmetical Operations writeline(13/4) 4.25 writeline(13\4) 4 writeline(13 mod 4) 1 Priority Order 12/4-2*4^3*(40 - (20/5+32)) 12/4-2*4^3*(40 - (4+32)) 12/4-2*4^3*(40-36) 12/4-2*4^3*4 12/4-2*64*4 3-2*64* * Eng. Hasan Alhouri 13

14 Some Useful Built-in Math Functions sign(x) sign(319) sign(0) sign(-25) x > 0 x = 0 x < Some Useful Built-in Math Functions abs(x) +x abs(319) 319 abs(-25) 25 Eng. Hasan Alhouri 14

15 The Boolean Data Type dim b1 as boolean dim b2 as boolean= dim b3 as boolean= dim b4 as boolean= Hello boys dim b5 as boolean=44 b1 b2 b3 b4 b5 Comparing writeline(3+4) writeline(3=4) writeline(3>4) writeline(3<4) Eng. Hasan Alhouri 15

16 Comparing writeline(3>=4) writeline(3<=4) writeline(3<>4) writeline(3+5=12-1*10) Logical Operation C1 C2 C1 AND C2 C1 OR C2 NOT(C1) Eng. Hasan Alhouri 16

17 Comparing writeline(3>=4 and 6=5) writeline(3>=4 or 5-1=4) writeline(not(3>=4)) writeline(3=2 and (4=16 or 1>9)) Conditions Syntax If(condition1) then Statements1 Elseif(condition2) then Statements2 Elseif(condition3) then Statements3 Else Statements4 End if Example If(a=b) then writeline(a & is equal to & b) Elseif(a>b) then writeline(a & is larger than & b) Elseif(a<b) then writeline(a & is smaller than & b) Else writeline( can t decide ) End if Eng. Hasan Alhouri 17

18 Notes About The Conditions If is necessary always and it must be closed by End if but Elseif and Else are optional. Syntax If(condition1) then Statements1 End if Example If(a>b) then writeline(a & is larger than & b) End if Notes About The Conditions When the statements are one line it may be placed directly after the then at the same line with If and End if could be omitted. Syntax If(condition) then Statements Example If(a>b) then writeline(a & > & b) Eng. Hasan Alhouri 18

19 Notes About The Conditions The condition may be any logical expression that could be evaluated to or. Syntax If(condition1) then Statements1 End if Example If(a>b and s= Hello or b=7) then writeline( it s ok ) End if Notes About The Conditions It s possible to include a If statement inside another If statement. Syntax If(condition1) then Statements1 If(condition2)then Statements2 End if Statement3 End if Example If(a<>0 and b<>0) then If(a<b)then writeline(b & is the length ) End if End if Eng. Hasan Alhouri 19

20 The GOTO Statement It s used for two reasons: -To return to a previous line of the code. - Or to skip some lines of the code. Example1 p1: If(a<10) then a=a+1 GOTO p1 End if Example2 If(a<>0) then GOTO p2 End if writeline( this will be skipped ) p2: Making Loops With GOTO -To returning to a previous line with GOTO may produce a loop. Example1 dim a as integer=2 p1: If(a<7) then a=a+1 writeline(a) GOTO p1 End if Eng. Hasan Alhouri 20

21 The While Loop Syntax While (condition) Statements End while Example1 dim a as integer=2 while(a<7) a=a+1 writeline(a) End while The For Loop Syntax For variable=initial to final step step Statements Next Example1 Dim i as integer For i=3 to 11 step 2 writeline(i) Next Eng. Hasan Alhouri 21

22 Notes About The For Loop If the step were omitted; its value will be +1 Example Dim i as integer For i=3 to 7 writeline(i) Next Notes About The For Loop The step could be negative; and then the final value must be smaller than the initial value. Example Dim i as integer For i=13 to 7 step -2 writeline(i) Next Eng. Hasan Alhouri 22

23 Notes About The For Loop The loop variable could be defined inside the loop; and then it will be local at the loop only. Example For i as integer =13 to 7 step -2 writeline(i) Next Breaking the Loop - exit For i as integer =1 to 10 writeline(i) if (i=5) then exit for end if writeline (i^2) Next Breaking the loop at a condition, and jumping to the next command after the loop Eng. Hasan Alhouri 23

24 Breaking the Loop - continue For i as integer =1 to 10 writeline(i) if (i=5) then continue for end if writeline (i^2) Next Breaking the loop at a condition, and jumping to the next iteration in the loop Arrays Vector of 3 elements 2D array of 2 rows and 3 columns A B A(0) A(1) A(2) B(1,2) dim a() as integer a=new integer(2) {2,4,9} dim b(,) as integer a=new integer(1,2) {{3,5,-7},{11,2,50}} Eng. Hasan Alhouri 24

25 Many Ways to Define Arrays Dim a(3), b() As Integer b = New Integer(3) {} b is still nothing in the memory now b is a vector of 3 0's b = New Integer() {1, 12, 11, 10} [0 0 0] a way to fill the elements a [ ] b (0)=33 to access an element and change it a b a b b a b [0 0 0] [0 0 0] [0 0 0] [0 0 0] [ ] Information about Arrays A 2 4 dim a() as integer a=new integer(2) {2,4,9} 9 3 B dim b(,) as integer b=new integer(1,2) {{3,5,-7},{11,2,50}} writeline(a.length) writeline(a.rank) 3 1 writeline(b.length) writeline(b.rank) writeline(b.getlength(0)) writeline(a.length) 3 writeline(b.getlength(1)) 3 Eng. Hasan Alhouri 25

26 Sorting Arrays 1D A dim a() as integer a=new integer(5) {5, 1, 2, 9, 6, 3} Array.Sort(a) Array.Sort(a) Array.Reverse(a) dim b(,) as integer b=new integer(1,2) {{3,5,-7},{11,2,50}} Dim a(b.length - 1) As Integer Dim k As Integer Sorting Arrays 2D a will be used temporary to store the elements of b as a vector For i As Integer = 0 To b.getlength(0) - 1 For j As Integer = 0 To b.getlength(1) - 1 a(k) = b(i, j) k = k + 1 Next Next Filling a with the elements of b Array.Sort(a) k=0 3 B 11 Sorting a Resetting k to For i As Integer = 0 To b.getlength(0) - 1 For j As Integer = 0 To b.getlength(1) - 1 b(i, j)=a(k) k = k + 1 Next Next Filling b with the sorted elements Eng. Hasan Alhouri 26

27 Printing Arrays A dim a() as integer a=new integer(3) {5, 2, 7, 3} For i As Integer = 0 To a.length- 1 Write(vbTab & a(i)) Next Printing Arrays B Dim b(,) As Integer b = New Integer(1, 2) {{3, 5, -7}, {11, 2, 50}} For i As Integer = 0 To b.getlength(0) - 1 For j As Integer = 0 To b.getlength(1) - 1 Write(vbTab & b(i, j)) Next WriteLine() Next Eng. Hasan Alhouri 27

28 Referencing Arrays Dim b(,) As Integer b = New Integer(1, 2) {{3, 5, -7}, {11, 2, 50}} Creating the array b b Dim c(,) As Integer c = b c(0, 0) = 10 b(0,1)=25 c is another reference to the same array Changing an element in c or in b affects the same array b c b c Cloning Arrays Dim b(,) As Integer b = New Integer(1, 2) {{3, 5, -7}, {11, 2, 50}} Creating the array b Dim c(,) As Integer c = b.clone c is a new copy of b, so it s a different array b b c c(0, 0) = 10 b(0,1)=25 Changing an element in c affects only c, and changing an element in b affects only b b c Eng. Hasan Alhouri 28

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Basic language This reference guide

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING 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 information

Flow Control. CSC215 Lecture

Flow Control. CSC215 Lecture Flow Control CSC215 Lecture Outline Blocks and compound statements Conditional statements if - statement if-else - statement switch - statement? : opertator Nested conditional statements Repetitive statements

More information

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

Objectives. 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 information

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Pascal language This reference guide

More information

Unit 6 - Software Design and Development LESSON 3 KEY FEATURES

Unit 6 - Software Design and Development LESSON 3 KEY FEATURES Unit 6 - Software Design and Development LESSON 3 KEY FEATURES Last session 1. Language generations. 2. Reasons why languages are used by organisations. 1. Proprietary or open source. 2. Features and tools.

More information

Unit 6 - Software Design and Development LESSON 3 KEY FEATURES

Unit 6 - Software Design and Development LESSON 3 KEY FEATURES Unit 6 - Software Design and Development LESSON 3 KEY FEATURES Last session 1. Language generations. 2. Reasons why languages are used by organisations. 1. Proprietary or open source. 2. Features and tools.

More information

Flow Chart. The diagrammatic representation shows a solution to a given problem.

Flow Chart. The diagrammatic representation shows a solution to a given problem. low Charts low Chart A flowchart is a type of diagram that represents an algorithm or process, showing the steps as various symbols, and their order by connecting them with arrows. he diagrammatic representation

More information

Glossary. (Very) Simple Java Reference (draft, v0.2)

Glossary. (Very) Simple Java Reference (draft, v0.2) (Very) Simple Java Reference (draft, v0.2) (Very) Simple Java Reference (draft, v0.2) Explanations and examples for if and for (other things to-be-done). This is supposed to be a reference manual, so we

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science Department Lecture 3: C# language basics Lecture Contents 2 C# basics Conditions Loops Methods Arrays Dr. Amal Khalifa, Spr 2015 3 Conditions and

More information

Object Oriented Programming with Visual Basic.Net

Object Oriented Programming with Visual Basic.Net Object Oriented Programming with Visual Basic.Net By: Dr. Hossein Hakimzadeh Computer Science and Informatics IU South Bend (c) Copyright 2007 to 2015 H. Hakimzadeh 1 What do we need to learn in order

More information

School of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15

School of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15 Table of Contents 1 INTRODUCTION... 1 2 IF... 1 2.1 BOOLEAN EXPRESSIONS... 3 2.2 BLOCKS... 3 2.3 IF-ELSE... 4 2.4 NESTING... 5 3 SWITCH (SOMETIMES KNOWN AS CASE )... 6 3.1 A BIT ABOUT BREAK... 7 4 CONDITIONAL

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: 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 information

Assignment: 1. (Unit-1 Flowchart and Algorithm)

Assignment: 1. (Unit-1 Flowchart and Algorithm) Assignment: 1 (Unit-1 Flowchart and Algorithm) 1. Explain: Flowchart with its symbols. 2. Explain: Types of flowchart with example. 3. Explain: Algorithm with example. 4. Draw a flowchart to find the area

More information

Introduction to C# Applications

Introduction 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 information

AP COMPUTER SCIENCE A

AP COMPUTER SCIENCE A AP COMPUTER SCIENCE A CONTROL FLOW Aug 28 2017 Week 2 http://apcs.cold.rocks 1 More operators! not!= not equals to % remainder! Goes ahead of boolean!= is used just like == % is used just like / http://apcs.cold.rocks

More information

SELECTION STATEMENTS:

SELECTION STATEMENTS: UNIT-2 STATEMENTS A statement is a part of your program that can be executed. That is, a statement specifies an action. Statements generally contain expressions and end with a semicolon. Statements that

More information

ME 461 C review Session Fall 2009 S. Keres

ME 461 C review Session Fall 2009 S. Keres ME 461 C review Session Fall 2009 S. Keres DISCLAIMER: These notes are in no way intended to be a complete reference for the C programming material you will need for the class. They are intended to help

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

204111: Computer and Programming

204111: 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 information

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Review: 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 information

Programming for Experimental Research. Flow Control

Programming for Experimental Research. Flow Control Programming for Experimental Research Flow Control FLOW CONTROL In a simple program, the commands are executed one after the other in the order they are typed. Many situations require more sophisticated

More information

Fall Semester (081) Dr. El-Sayed El-Alfy Computer Science Department King Fahd University of Petroleum and Minerals

Fall Semester (081) Dr. El-Sayed El-Alfy Computer Science Department King Fahd University of Petroleum and Minerals INTERNET PROTOCOLS AND CLIENT-SERVER PROGRAMMING Client SWE344 request Internet response Fall Semester 2008-2009 (081) Server Module 2.1: C# Programming Essentials (Part 1) Dr. El-Sayed El-Alfy Computer

More information

x = 3 * y + 1; // x becomes 3 * y + 1 a = b = 0; // multiple assignment: a and b both get the value 0

x = 3 * y + 1; // x becomes 3 * y + 1 a = b = 0; // multiple assignment: a and b both get the value 0 6 Statements 43 6 Statements The statements of C# do not differ very much from those of other programming languages. In addition to assignments and method calls there are various sorts of selections and

More information

In Delphi script, when values are assigned to variables, the colon-equal operator is used; :=

In Delphi script, when values are assigned to variables, the colon-equal operator is used; := Statements and Operators Old Content - visit altium.com/documentation Modified by on 13-Sep-2017 Parent page: DelphiScript DelphiScript Statements A statement in DelphiScript is considered as simple when

More information

UNIT IV INTRODUCTION TO C

UNIT IV INTRODUCTION TO C UNIT IV INTRODUCTION TO C 1. OVERVIEW OF C C is portable, structured programming language. It is robust, fast.extensible. It is used for complex programs. The root of all modern language is ALGOL (1960).

More information

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8 Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(

More information

UNIT 1. Introduction to Microsoft.NET framework and Basics of VB.Net

UNIT 1. Introduction to Microsoft.NET framework and Basics of VB.Net UNIT 1 Introduction to Microsoft.NET framework and Basics of VB.Net 1 SYLLABUS 1.1 Overview of Microsoft.NET Framework 1.2 The.NET Framework components 1.3 The Common Language Runtime (CLR) Environment

More information

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE a) Mention any 4 characteristic of the object car. Ans name, colour, model number, engine state, power b) What

More information

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018 Object-oriented programming 1 and data-structures CS/ENGRD 2110 SUMMER 2018 Lecture 1: Types and Control Flow http://courses.cs.cornell.edu/cs2110/2018su Lecture 1 Outline 2 Languages Overview Imperative

More information

Introduction to the Java Basics: Control Flow Statements

Introduction to the Java Basics: Control Flow Statements Lesson 3: Introduction to the Java Basics: Control Flow Statements Repetition Structures THEORY Variable Assignment You can only assign a value to a variable that is consistent with the variable s declared

More information

DelphiScript Keywords

DelphiScript Keywords DelphiScript Keywords Old Content - visit altium.com/documentation Modified by on 13-Sep-2017 This reference covers the DelphiScript keywords used for the Scripting System in Altium Designer. The scripting

More information

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls.

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls. Jump Statements The keyword break and continue are often used in repetition structures to provide additional controls. break: the loop is terminated right after a break statement is executed. continue:

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer 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 information

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003 Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an

More information

WYSE Academic Challenge 2002 Computer Science Test (Sectional) SOLUTION

WYSE Academic Challenge 2002 Computer Science Test (Sectional) SOLUTION Computer Science - 1 WYSE Academic Challenge 2002 Computer Science Test (Sectional) SOLUTION 1. Access to moving head disks requires three periods of delay before information is brought into memory. The

More information

Type Conversion. and. Statements

Type Conversion. and. Statements and Statements Type conversion changing a value from one type to another Void Integral Floating Point Derived Boolean Character Integer Real Imaginary Complex no fractional part fractional part 2 tj Suppose

More information

6.096 Introduction to C++ January (IAP) 2009

6.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 information

egrapher Language Reference Manual

egrapher 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 information

DECISION CONTROL AND LOOPING STATEMENTS

DECISION CONTROL AND LOOPING STATEMENTS DECISION CONTROL AND LOOPING STATEMENTS DECISION CONTROL STATEMENTS Decision control statements are used to alter the flow of a sequence of instructions. These statements help to jump from one part of

More information

- If you want to repeat the same blocks of code over and over you have two choices. Copy

- If you want to repeat the same blocks of code over and over you have two choices. Copy 2013/2014 Programming Fundamentals for Engineers Lab Lab Session # 4 Loops ALQUDS University Department of Computer Engineering Objective: 1. Study the benifits of using loops in programming. 2. Investigate

More information

8. Control statements

8. Control statements 8. Control statements A simple C++ statement is each of the individual instructions of a program, like the variable declarations and expressions seen in previous sections. They always end with a semicolon

More information

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types Managing Data Unit 4 Managing Data Introduction Lesson 4.1 Data types We come across many types of information and data in our daily life. For example, we need to handle data such as name, address, money,

More information

C library = Header files + Reserved words + main method

C library = Header files + Reserved words + main method DAY 1: What are Libraries and Header files in C. Suppose you need to see an Atlas of a country in your college. What do you need to do? You will first go to the Library of your college and then to the

More information

Introduction. C provides two styles of flow control:

Introduction. C provides two styles of flow control: Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if

More information

Syntax and Variables

Syntax and Variables Syntax and Variables What the Compiler needs to understand your program, and managing data 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line

More information

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT C Review MaxMSP Developers Workshop Summer 2009 CNMAT C Syntax Program control (loops, branches): Function calls Math: +, -, *, /, ++, -- Variables, types, structures, assignment Pointers and memory (***

More information

Array. Array Declaration:

Array. Array Declaration: Array Arrays are continuous memory locations having fixed size. Where we require storing multiple data elements under single name, there we can use arrays. Arrays are homogenous in nature. It means and

More information

Assignment 2.4: Loops

Assignment 2.4: Loops Writing Programs that Use the Terminal 0. Writing to the Terminal Assignment 2.4: Loops In this project, we will be sending our answers to the terminal for the user to see. To write numbers and text to

More information

Java is an objet-oriented programming language providing features that support

Java is an objet-oriented programming language providing features that support Java Essentials CSCI 136: Spring 2018 Handout 2 February 2 Language Basics Java is an objet-oriented programming language providing features that support Data abstraction Code reuse Modular development

More information

3. Convert 2E from hexadecimal to decimal. 4. Convert from binary to hexadecimal

3. Convert 2E from hexadecimal to decimal. 4. Convert from binary to hexadecimal APCS A Midterm Review You will have a copy of the one page Java Quick Reference sheet. This is the same reference that will be available to you when you take the AP Computer Science exam. 1. n bits can

More information

Java. Programming: Chapter Objectives. Why Is Repetition Needed? Chapter 5: Control Structures II. Program Design Including Data Structures

Java. Programming: Chapter Objectives. Why Is Repetition Needed? Chapter 5: Control Structures II. Program Design Including Data Structures Chapter 5: Control Structures II Java Programming: Program Design Including Data Structures Chapter Objectives Learn about repetition (looping) control structures Explore how to construct and use count-controlled,

More information

Getting started with Java

Getting started with Java Getting started with Java by Vlad Costel Ungureanu for Learn Stuff Programming Languages A programming language is a formal constructed language designed to communicate instructions to a machine, particularly

More information

COGS 119/219 MATLAB for Experimental Research. Fall 2016 Week 1 Built-in array functions, Data types.m files, begin Flow Control

COGS 119/219 MATLAB for Experimental Research. Fall 2016 Week 1 Built-in array functions, Data types.m files, begin Flow Control COGS 119/219 MATLAB for Experimental Research Fall 2016 Week 1 Built-in array functions, Data types.m files, begin Flow Control .m files We can write the MATLAB commands that we type at the command window

More information

An overview about DroidBasic For Android

An overview about DroidBasic For Android An overview about DroidBasic For Android from February 25, 2013 Contents An overview about DroidBasic For Android...1 Object-Oriented...2 Event-Driven...2 DroidBasic Framework...2 The Integrated Development

More information

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

B.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 information

CS 6353 Compiler Construction Project Assignments

CS 6353 Compiler Construction Project Assignments CS 6353 Compiler Construction Project Assignments In this project, you need to implement a compiler for a language defined in this handout. The programming language you need to use is C or C++ (and the

More information

Control Structures. Code can be purely arithmetic assignments. At some point we will need some kind of control or decision making process to occur

Control Structures. Code can be purely arithmetic assignments. At some point we will need some kind of control or decision making process to occur Control Structures Code can be purely arithmetic assignments At some point we will need some kind of control or decision making process to occur C uses the if keyword as part of it s control structure

More information

Instructor: SIR MUHAMMAD NAVEED Created by: ARSLAN AHMED SHAAD ( ) MUHAMMAD BILAL ( ) ISIT:

Instructor: SIR MUHAMMAD NAVEED Created by: ARSLAN AHMED SHAAD ( ) MUHAMMAD BILAL ( ) ISIT: Instructor: SIR MUHAMMAD NAVEED Created by: ARSLAN AHMED SHAAD ( 1163135 ) MUHAMMAD BILAL (1163122 ) ISIT:www.techo786.wordpress.com CHAPTER: 3 NOTE: CONTROL STATEMENTS Question s Given below are Long

More information

Methods: A Deeper Look

Methods: A Deeper Look 1 2 7 Methods: A Deeper Look OBJECTIVES In this chapter you will learn: How static methods and variables are associated with an entire class rather than specific instances of the class. How to use random-number

More information

DELHI PUBLIC SCHOOL TAPI

DELHI PUBLIC SCHOOL TAPI Loops Chapter-1 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

More information

BASIC ELEMENTS OF A COMPUTER PROGRAM

BASIC 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 information

a. ++ b. -- c. sizeof d. - e. all the above 11. Which of the following is the wrong combination for any two operators in C a. different precedence,

a. ++ b. -- c. sizeof d. - e. all the above 11. Which of the following is the wrong combination for any two operators in C a. different precedence, UNIT III 1. Which of the following cannot be value of the expression in switch case statement a. integer b. float c. char d. shortint 2. What will happen if we write semicolon after switch statement switch(choice);

More information

SCoLang - Language Reference Manual

SCoLang - Language Reference Manual SCoLang - Language Reference Manual Table of Contents: 1. Introduction 2. Types a. Basic Data types b. Advanced Data types 3. Lexical Convention a. Identifiers b. Keywords c. Comments d. Operators e. Punctuators

More information

EMBEDDED SYSTEMS PROGRAMMING Language Basics

EMBEDDED SYSTEMS PROGRAMMING Language Basics EMBEDDED SYSTEMS PROGRAMMING 2014-15 Language Basics (PROGRAMMING) LANGUAGES "The tower of Babel" by Pieter Bruegel the Elder Kunsthistorisches Museum, Vienna ABOUT THE LANGUAGES C (1972) Designed to replace

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II

CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II CS313D: ADVANCED PROGRAMMING LANGUAGE Lecture 3: C# language basics II Lecture Contents 2 C# basics Methods Arrays Methods 3 A method: groups a sequence of statement takes input, performs actions, and

More information

Chapter 2.6: Testing and running a solution

Chapter 2.6: Testing and running a solution Chapter 2.6: Testing and running a solution 2.6 (a) Types of Programming Errors When programs are being written it is not surprising that mistakes are made, after all they are very complicated. There are

More information

Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition

Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition Learn about repetition (looping) control structures Explore how to construct and use: o Counter-controlled

More information

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls.

Jump Statements. The keyword break and continue are often used in repetition structures to provide additional controls. Jump Statements The keyword break and continue are often used in repetition structures to provide additional controls. break: the loop is terminated right after a break statement is executed. continue:

More information

Decision making with if Statement : - Control Statements. Introduction: -

Decision making with if Statement : - Control Statements. Introduction: - Control Statements Introduction: - Any C program if you consider, the set of statements are normally executed sequentially in the order in which they are written, and such programs have sequential structure

More information

Sample Paper Class XI Subject Computer Sience UNIT TEST II

Sample Paper Class XI Subject Computer Sience UNIT TEST II Sample Paper Class XI Subject Computer Sience UNIT TEST II (General OOP concept, Getting Started With C++, Data Handling and Programming Paradigm) TIME: 1.30 Hrs Max Marks: 40 ALL QUESTIONS ARE COMPULSURY.

More information

Introduction To C#.NET

Introduction 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 information

1. Lexical Analysis Phase

1. Lexical Analysis Phase 1. Lexical Analysis Phase The purpose of the lexical analyzer is to read the source program, one character at time, and to translate it into a sequence of primitive units called tokens. Keywords, identifiers,

More information

If you note any errors, typos, etc. with this manual or our software libraries, let us know at

If you note any errors, typos, etc. with this manual or our software libraries, let us know at Oregon State University Robotics Club ORK 2011 Programming Guide Version 1.0 Updated: 10/28/2011 Note: Check back for more revisions and updates soon! If you note any errors, typos, etc. with this manual

More information

There are algorithms, however, that need to execute statements in some other kind of ordering depending on certain conditions.

There are algorithms, however, that need to execute statements in some other kind of ordering depending on certain conditions. Introduction In the programs that we have dealt with so far, all statements inside the main function were executed in sequence as they appeared, one after the other. This type of sequencing is adequate

More information

2/3/2018 CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II. Lecture Contents. C# basics. Methods Arrays. Dr. Amal Khalifa, Spr17

2/3/2018 CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II. Lecture Contents. C# basics. Methods Arrays. Dr. Amal Khalifa, Spr17 CS313D: ADVANCED PROGRAMMING LANGUAGE Lecture 3: C# language basics II Lecture Contents 2 C# basics Methods Arrays 1 Methods : Method Declaration: Header 3 A method declaration begins with a method header

More information

Chapter 4 Control Structures

Chapter 4 Control Structures Chapter 4 Control Structures Foundational Java Key Elements and Practical Programming 1 if - else switch Control Structures break and continue Ternary operator while and do-while loops for loops 2 Two

More information

JAVA Programming Fundamentals

JAVA Programming Fundamentals Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol

More information

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - 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 information

Statements and Operators

Statements and Operators Statements and Operators Old Content - visit altium.com/documentation Mod ifi ed by Rob Eva ns on Feb 15, 201 7 Parent page: EnableBasic Enable Basic Statements Do...Loop Conditional statement that repeats

More information

YEAH 2: Simple Java! Avery Wang Jared Bitz 7/6/2018

YEAH 2: Simple Java! Avery Wang Jared Bitz 7/6/2018 YEAH 2: Simple Java! Avery Wang Jared Bitz 7/6/2018 What are YEAH Hours? Your Early Assignment Help Only for some assignments Review + Tips for an assignment Lectures are recorded, slides are posted on

More information

Graphiti A Simple Graph Language. Language Reference Manual

Graphiti A Simple Graph Language. Language Reference Manual Graphiti A Simple Graph Language Language Reference Manual Alice Thum, System Architect, at3160@barnard.edu Sydney Lee, System Architect, stl2121@barnard.edu Michal Porubcin, Language Guru, mp3242@columbia.edu

More information

Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition

Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition Learn about repetition (looping) control structures Explore how to construct and use: o Counter-controlled

More information

Decision Making -Branching. Class Incharge: S. Sasirekha

Decision Making -Branching. Class Incharge: S. Sasirekha Decision Making -Branching Class Incharge: S. Sasirekha Branching The C language programs presented until now follows a sequential form of execution of statements. Many times it is required to alter the

More information

Module 4: Decision-making and forming loops

Module 4: Decision-making and forming loops 1 Module 4: Decision-making and forming loops 1. Introduction 2. Decision making 2.1. Simple if statement 2.2. The if else Statement 2.3. Nested if Statement 3. The switch case 4. Forming loops 4.1. The

More information

Computers and Programming Section 450. Lab #1 C# Basic. Student ID Name Signature

Computers 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 information

C PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5

C PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5 C PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5 1. Pointers As Kernighan and Ritchie state, a pointer is a variable that contains the address of a variable. They have been

More information

C introduction: part 1

C introduction: part 1 What is C? C is a compiled language that gives the programmer maximum control and efficiency 1. 1 https://computer.howstuffworks.com/c1.htm 2 / 26 3 / 26 Outline Basic file structure Main function Compilation

More information

Eng. Mohammed S. Abdualal

Eng. Mohammed S. Abdualal Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Computer Programming Lab (ECOM 2114) Created by Eng: Mohammed Alokshiya Modified by Eng: Mohammed Abdualal Lab 3 Selections

More information

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above P.G.TRB - COMPUTER SCIENCE Total Marks : 50 Time : 30 Minutes 1. C was primarily developed as a a)systems programming language b) general purpose language c) data processing language d) none of the above

More information

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It

More information

Character 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. 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 information

CS107 Handout 13 Spring 2008 April 18, 2008 Computer Architecture: Take II

CS107 Handout 13 Spring 2008 April 18, 2008 Computer Architecture: Take II CS107 Handout 13 Spring 2008 April 18, 2008 Computer Architecture: Take II Example: Simple variables Handout written by Julie Zelenski and Nick Parlante A variable is a location in memory. When a variable

More information

More Programming Constructs -- Introduction

More Programming Constructs -- Introduction More Programming Constructs -- Introduction We can now examine some additional programming concepts and constructs Chapter 5 focuses on: internal data representation conversions between one data type and

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

Flow Control: Branches and loops

Flow Control: Branches and loops Flow Control: Branches and loops In this context flow control refers to controlling the flow of the execution of your program that is, which instructions will get carried out and in what order. In the

More information

REPETITION CONTROL STRUCTURE LOGO

REPETITION CONTROL STRUCTURE LOGO CSC 128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING REPETITION CONTROL STRUCTURE 1 Contents 1 Introduction 2 for loop 3 while loop 4 do while loop 2 Introduction It is used when a statement or a block of

More information

Review for Test 1 (Chapter 1-5)

Review for Test 1 (Chapter 1-5) Review for Test 1 (Chapter 1-5) 1. Introduction to Computers, Programs, and Java a) What is a computer? b) What is a computer program? c) A bit is a binary digit 0 or 1. A byte is a sequence of 8 bits.

More information

COP 3223 Final Review

COP 3223 Final Review COP 3223 Final Review Jennifer Brown December 2, 2018 1 Introduction 1.1 Variables I. How can we store data in a program? Initializing variables with data types A. Which of these are valid names for variables?

More information