q4 sol8 - CSCI.1100 Computer Science I Quiz 4 October 5,...

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

View Full Document Right Arrow Icon
CSCI.1100 Computer Science I Quiz 4 October 5, 2009 Closed book, closed notes, no computers or calculators of any kind. Name: RCS login: Circle your lab section: (01 MTh 10:00) (02 MTh 12:00) (03 MTh 2:00) (04 MTh 4:00) (05 MTh 6:00) (06 MTh 10:00) (07 TF 10:00) (08 TF 12:00) (09 MTh 12:00) (10 TF 2:00) (11 MTh 4:00) You will have 15 minutes to complete this test. Make sure you do not spend too much time on any question. The time spent on each question should be proportional to the number of points 1. Here is a square root program with one additional line. Each time through the loop it prints out the value of max, min and guess. If the user enters the number 16, show the first three lines of output (9 points). #include <iostream> using namespace std; int main() { double number, max, min, guess, diff; cout <<"Enter a number greater than one: "; cin >> number; min = 1.0; max = number; while (true) {
Background image of page 1

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

View Full DocumentRight Arrow Icon
guess = (max - min)/2 + min; cout << max << " " << min << " " << guess << endl; diff = (guess * guess) - number;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/04/2011 for the course CORE 101 taught by Professor Poop during the Spring '08 term at Rensselaer Polytechnic Institute.

Page1 / 3

q4 sol8 - CSCI.1100 Computer Science I Quiz 4 October 5,...

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

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