Sale!

COP 4530 Homework 1

$30.00

Category:

COP 4530 Homework 1
Exercises 1.5
9. What are some of the ways in which student programs differ from real-world software?
10. Name three kinds of programming errors and give examples of each. When during program development is
each likely to be detected?
12. Find some other examples of “software horror stories” and write brief reports for each, describing the error
and what harm or adversity resulted from it.
Page 1 of 2
COP 4530 Homework 1
Chapter 1 Programming Problems
4. The following function performs a linear search of a list l of length ll for the item it, returning 0 or 1 depending
on whether it is not found. Many principles of good programming are violated. Describe some of these and
rewrite the function in an acceptable format.
int LS(int l[], int ll, int it)
/* Search l for it */
{
int i=0, f=0; A:if (l[i]==it)
goto B; if (i=ll) goto
C;/*ADD 1 to i*/i++;goto A;
B:f=1;C:return f;
}
Exercises 2.4
16. Describe the output produced by the following statements
int * foo, * goo;
foo = new int;
*foo = 1;
cout << (*foo) << endl;
goo = new int;
*goo = 3;
cout << (*foo) << (*goo) << endl;
*foo=*goo+3;
cout << (*foo) << (*goo) << endl;
foo = goo;
*goo = 5;
cout << (*foo) << (*goo) << endl;
*foo = 7;
cout << (*foo) << (*goo) << endl;
goo = foo;
*foo = 9;
cout << (*foo) << (*goo) << endl;
Page 2 of 2

Reviews

There are no reviews yet.

Be the first to review “COP 4530 Homework 1”

Your email address will not be published.