# Lab4 - COSC1415/COSC1436 Chapter 4 Lab Assignment Page 1 of...

This preview shows pages 1–2. Sign up to view the full content.

Chapter 4 Lab Assignment Page 1 of 1 Name Chintu Patel 8001 COSC1415/COSC1436 Lab - Chapter 4 Objective: To learn how to use selection structure in a program At the end of this lab you should know how to: 1. write if, if…else and nested if structures 2. use selection structure in a value-returning function Lab 4A: Write a program that prompts the user to input three integers. You may assume that none of the integers are equal. The output of the program should print the numbers in order from largest to smallest. Use value-returning functions to determine which number is largest, smallest and in the middle. Remember that value-returning functions should not have cin or cout statements. Don’t forget to put the < your name> statement in your program. Run the program with the following six sets of data: (You may paste all of the sets of output into the same text file. Make sure you include your prompts and input values.) 86 76 66 43 73 93 52 92 72 61 71 51 75 65 95 100 50 80 Print a copy of the program and its output. Lab 4B: Write a program that prompts the user to input the x-y coordinate of a point in a Cartesian plane. The program should then output the point (x, y) and a message indicating whether the point is at the origin, is located on the x (or y) axis, or appears in a particular quadrant. (See example below) Don’t forget to put the < your name> statement in your program. Remember that value-returning functions should not have cin or cout statements. (0, 0) is the origin II I (4, 0) is on the x-axis (0, -3) is on the y-axis (-2, 3) is in the second quadrant III IV Run the program with the following seven sets of data: (You may paste all of the sets of output in the same text file. Make sure you include your prompts and input values.) x y x y 2 5 0 0 -4 -8 -15 0 2 -6 0 11 -7 9 Print a copy of the program and its output. When you are finished: Staple the program printouts and the lab assignment together. Put the programs and their output

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 05/06/2008 for the course COSC 1436 taught by Professor May during the Spring '08 term at Dallas Colleges.

### Page1 / 6

Lab4 - COSC1415/COSC1436 Chapter 4 Lab Assignment Page 1 of...

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

View Full Document
Ask a homework question - tutors are online