Lecture14

Lecture14 - CNIT 155 Lecture14 Selection in C Lab05 ◦ Due...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CNIT 155 Lecture14 Selection in C# Lab05 ◦ Due tonight, 11:50 PM ◦ Questions? About the template ◦ Make sure to follow the steps in Chap02 ◦ Add a frmMain.cs code file ◦ Add a frmMain.Designer.cs ◦ We want to separate the code for the GUIfrom the code for the logic that you will be typing. Read ◦ Chap05 Announcements Review Arithmetic Expressions Selection = Making Decisions in C# Relational Operators If statement If / else If/ else if Objectives Any combination of numeric literals, variables and operators: Gets evaluated from left to right, respecting the precedence of operators. Precedence rules: ( ) gets evaluated first - unary minus * / % + - = lowest precedence Arithmetic Expressions: Dividing 2 whole numbers à whole number: 13 / 3 4 To do real division, make one of the operands a real number: 13 / 3.0 4.333333 When using variables? Use cast to perform real division: int a, b; a = 10; b = 4; REMEMBER: Given: int a, b, c; a = 12; b = 5; c = 10; Arithmetic expression Value 3 * (a + b ) / c (1/2.0) * c – a 4 + 1.25 * 2 Examples: Ex:: int m = 12;...
View Full Document

This note was uploaded on 03/04/2012 for the course CNIT 155 taught by Professor Guityravai during the Spring '12 term at Purdue.

Page1 / 26

Lecture14 - CNIT 155 Lecture14 Selection in C Lab05 ◦ Due...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online