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

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 4, 2007 Closed book, closed notes, no computers or calculators of any kind. Name: RCS login: Circle your lab section: (01 MR 10:00) (02 MR 12:00) (03 MR 2:00) (04 MR 4:00) (05 MR 6:00) (06 MR 10:00) (07 TF 10:00) (08 TF 12:00) (09 MR 12:00) (010 TF 2: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 19, show the first four lines of output (4 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) { guess = (max - min)/2 + min;
Background image of page 1

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

View Full DocumentRight Arrow Icon
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 homework help was uploaded on 04/10/2008 for the course CSCI 1100 taught by Professor Hardwick during the Spring '08 term at Rensselaer Polytechnic Institute.

Page1 / 4

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

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