C Language, Assignment #8, April 8, '08

1.  Develop a function to take the coeficients of a polynomial and solve for the two complex 
roots.

typedef struct
{
    float x, y;
} RECT;

 calc_roots(float a, float b, float c,  RECT *p_rt_1,  RECT *p_rt_2)

 where a, b and c are the coefficients and *p_rt_1 and *p_rt_2 are addresses of the roots.

For example;

     RECT root_1, root_2;

     calc_roots(3.0, 2,0, 1.0, &root_1, &root2);
     printf("Root1 %.2f\t%.2f,  Root2 %.2f\t%.2f\n", root_1.x, root_1.y, root_2.x, root_2.y);

2.  Develop a routine to calculate the time between two times in the same day.

long calc_diff(TM *pt1, TM *t2);

3.  Develop a routine to open a text file.  Count the number of each alphabetical character.  
Then, display the percentage of appearances of each character.  Don't make a distinction between 
upper and lower case.

4.  Develop and test the following macros;

#define MAX2(a, b)
#define MAX5(a, b, c, d, e)
#define UP_CASE(a) // if a is lower case, returns the upper case.  Otherwise, leaves the letter unchanged.
#define WHOLE_PART(a) // returns the whole part of a float

5.  Strings.

Develop and test the following functions.  It is okay to use the strln function in implementing these.

	void reverse_string(char s[]);
	void join_string(char s1[], char s2[]); // s1 = s1 + s2
	void string_to_lower(char s[]);
	int compare_strings(char s1[], char s2[]); 
                             // return -1 is s1 < s2, 0 is they are the same, +1 if s1 > s2