Lab 4 Instructions If you have a text book, you can go to drill at pp. 126 for steps 1-6 at the end of chapter 4, Or you can read following slides of the.

Slides:



Advertisements
Similar presentations
This Time Whitespace and Input/Output revisited The Programming cycle Boolean Operators The “if” control structure LAB –Write a program that takes an integer.
Advertisements

08/2012Tanya Mishra1 EASYC for VEX Cortex Llano Estacado RoboRaiders FRC Team 1817.
CS110 Programming Language I
Lecture 2 Introduction to C Programming
Copyright 2010 by Pearson Education Building Java Programs Chapter 4 Lecture 4-2: Advanced if/else ; Cumulative sum reading: 4.1, 4.3, 4.5; "Procedural.
Switch structure Switch structure selects one from several alternatives depending on the value of the controlling expression. The controlling expression.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
Chapter 2: Design of Algorithms
Introduction to C Programming
1 Lab Session-III CSIT-120 Spring 2001 Revising Previous session Data input and output While loop Exercise Limits and Bounds GOTO SLIDE 13 Lab session.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Repetition Statements.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
Chapter 2: Algorithm Discovery and Design
C Programming. Chapter – 1 Introduction Study Book for one month – 25% Learning rate Use Compiler for one month – 60%
CS305j Introduction to Computing Conditional Execution 1 Topic 12 Conditional Execution "We flew down weekly to meet with IBM, but they thought the way.
CS Class 07 Topics –  When software goes wrong  Count controlled loops  Sentential controlled loops  putting it all together Announcements.
1 Lab Session-III CSIT-120 Fall 2000 Revising Previous session Data input and output While loop Exercise Limits and Bounds Session III-B (starts on slide.
CPSC 171 Introduction to Computer Science 3 Levels of Understanding Algorithms More Algorithm Discovery and Design.
Invitation to Computer Science, Java Version, Second Edition.
A little PHP. Enter the simple HTML code seen below.
Lab 3 Instructions Drill: Write a letter
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
Chapter 5 Control Structures: Loops 5.1 The while Loop The while loop is probably the most frequently used loop construct. The while loop is a conditional.
The while Loop Syntax while (condition) { statements } As long condition is true, the statements in the while loop execute.
Functions Introduction to Programming By Engr. Bilal Ahmad 1ITP by Engr. Bilal Ahmad.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
1 Lab 2 “Hello world” in Unix/Linux #include "std_lib_facilities_4.h" int main(){ cout
C++ for Engineers and Scientists, Third Edition1 Objectives In this chapter, you will learn about: Basic loop structures while loops Interactive while.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
CS Class 03 Topics  Sequence statements Input Output Assignment  Expressions Read pages Read pages 40 – 49 for next time.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 10.
5 jumps right 9 jumps left Objective - To use scientific notation to write very large or very small numbers. Scientific Notation Examples: 6,320,000,000.
Arrays. The array data structure Array is a collection of elements, that have the same data type Integers (int) Floating point numbers (float, double)
Think Possibility 1 Iterative Constructs ITERATION / LOOPS C provides three loop structures: the for-loop, the while-loop, and the do-while-loop. Each.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.
Agenda  Take up homework  Loops - Continued –For loops Structure / Example involving a for loop  Storing Characters in variables  Introduction to Functions.
REPETITION MTS3033 OBJECT ORIENTED PROGRAMMING 1.
Chapter 2: Fundamental Programming Structures in Java Adapted from MIT AITI Slides Control Structures.
 2003 Prentice Hall, Inc. All rights reserved. 1 Basic C++ Programming.
Loops (While and For) CSE 1310 – Introduction to Computers and Programming 1.
Lab 12 Instructions You can use g++ on build server, visual studio on local machine or your preferred C++ IDE. Important Note: For your grade, please show.
Looping Increment/Decrement Switch. Flow of Control Iteration/Switch Statements.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Loops ( while and for ) CSE 1310 – Introduction to Computers and Programming Alexandra Stefan 1.
01/05/100 1 Loops/Iteration Used to repeat an action Must have a STOP condition Three flavors - for, while, do/while.
A little PHP. Enter the simple HTML code seen below.
1 ENERGY 211 / CME 211 Lecture 3 September 26, 2008.
CIS199 Test Review 2 REACH.
Lab 6 Instructions You can use g++ on build server, visual studio on local machine or your preferred C++ IDE. Important Note: For your grade, please show.
A little PHP.
Chapter 4 – C Program Control
Chapter 1: Introduction to computers and C++ Programming
Chapter 2 - Introduction to C Programming
CS1010 Programming Methodology
Objective - To use scientific notation to write very large or very small numbers. Examples: 6,320,000,000 = 9 jumps left = 5 jumps right.
Lab 7 Instructions You can use g++ on build server, visual studio on local machine or your preferred C++ IDE. Important Note: For your grade, please show.
Lab 8 Instructions You can use g++ on build server, visual studio on local machine or your preferred C++ IDE. Important Note: For your grade, please show.
Lab 10 Instructions You can use g++ on build server, visual studio on local machine or your preferred C++ IDE. Important Note: For your grade, please show.
Introduction to Programming
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Lab 9 Instructions You can use g++ on build server, visual studio on local machine or your preferred C++ IDE. Important Note: For your grade, please show.
Algorithm Discovery and Design
Lab5 PROGRAMMING 1 Loop chapter4.
Functions continued.
Introduction to Computer Science
Every number has its place!
CSE 1321 Modules 1-5 Review Spring 2019
Chapter 13 Control Structures
Presentation transcript:

Lab 4 Instructions If you have a text book, you can go to drill at pp. 126 for steps 1-6 at the end of chapter 4, Or you can read following slides of the drill instructions. You can use g++ on build server, visual studio on local machine or your preferred C++ IDE. Important Note: For your grade, please show me the result after you finish all the tasks. If you cannot finish the drill in the lab, you can go back to work on it. But please send me the result and source code for your credits.

Drill Go through this drill step by step. Do not try to speed up by skipping steps. Test each step by entering at least three pairs of values – more values would be better. 1.Write a program that consists of a while-loop that (each time around the loop) reads in two ints and then prints them. Exit the program when a terminating ‘|’ is entered. Hint: cin.peek() - Returns the next character in the input sequence, without extracting it.

Drill 2. Change the program to write out the smaller value is: followed by the smaller of the numbers and the larger value is: followed by the larger value. 3. Augment the program so that it writes the line the numbers are equal (only) if they are equal. 4. Change the program so that it uses doubles instead of ints.

Drill 5. Change the program so that it writes out the numbers are almost equal after writing out the value entered. If it’s smallest if the two numbers differ by less than 1.0/ Now change the body of the loop so that it reads just one double each time around. Define two variables to keep track of which is the smallest and which is the largest value you have seen so far. Each time through the loop write out the value entered. If it’s the smallest so far, write the smallest so far after the number. If it is the largest so far, write the largest so far after the number.