Introduction to Programming (22C:16, 22C:106)

Homework 7: Due Thursday, 4/3/97

Problem 1: [10 points]

Write a C++ program that reads four non-negative integers A, B, C, and D and produces as output all non-negative integer solutions of the equation:

Ax + By + Cz = D

Your solution should contain two nested while-loops. The solution is a small modification of what I went over in lecture on 3/19 and 3/21.

Problem 2: [10 points]

Write a program to compute the square root of an arbitrarily large non-negative integer. Use Newton's method (pages 199-203) and use the BigInt class to store and manipulate the arbitrarily large integer. Use your program to find the square root of 987678098765680987656.



Sriram Pemmaraju
Fri Mar 21 14:55:09 CST 1997