ELE 491 - Software Development Practices - 1
(Fall 2001)

Homeworks

Home
Lecture Notes
Textbook
Homeworks
Homework Policies
Exams
TA's Page
README

Go to Previous homeworks

Homework Assignment - 5  (Due to Jan 8th) 

Question 1) (Exercise 6.22 of D&D, 2nd Edition ) Use a double subscripted array to solve the following problem. A company has four salespeople …

Question 2) (Exercise 8.10 of D&D, 2nd Edition ) Write a program that uses function strncmp to compare two strings input  by the user. The program should input the number of characters to be compared. The program should state whether the first string is less than, equal to or greater than the second string.

Question 3) (Exercise 13.10 of D&D, 2nd Edition ) Write a program that uses macro SUMARRAY to sum the values in a numeric array. The macro should receive the array and the number of elements in the array as arguments.

Question 4) (Exercise 14.4 of D D&D, 2nd Edition ) Write a program that sorts an array of integers into ascending order or descending order. The program should use command-line arguments to pass either argument –a for ascending order, or –d for descending order. Exact number of the integers in the array should be also given as a command-line argument: -s 20.

 (i.e., Usage: sort –a –s20 < input.dat    or    Usage: sort –d –s20 < input.dat)  

You should test your program by reading a file containing upto 30 integers by using the indirection operator <. Proper number of those integers should be input into the array, the sorting process should be accomplished and the sorted array should be output.

Hint: You may use bubble sort  function (void bubbleSort(int n[], int size) ) given in Chapter 6.

 

Send mail if any of your  grades (active version) is missing or wrong

Check out the Final Exam solutions

See TA's page for hot news!


Last updated: Aralýk 24, 2001 10:37:31 kdincer@ee.hacettepe.edu.tr