advertisement

Math Field Day Programming Contest (2006): 1. Write a C++ program that (1) has two character arrays, and each of them can hold of 10 characters (2) randomly generate 10 characters between ‘a’ and ‘z’ for each of the two arrays (3) Sort these two arrays in ascending order. (4) Print characters in two arrays in ascending order, without duplicate characters printed. 2. The following series formula is used to express , please write a program that ask for N and calculate an approximate value of with 10 digits for its fraction. 1 1 1 1 (1) n 4.01 , (2n 1) 3 5 7 9 n0 3. Write a program that (1) ask for 5 positive integers, (2) calculate and print their great common divisors. 4. A polynomial with n + 1 items is, P(x) = a0 + a1 x1 + a2 x2 + … + an xn Write a program which will (1) ask for the integer N, the number of coefficients of the polynomial, (2) ask for N + 1 coefficients, (3) ask for a x value (floating-point number), and (4) calculate P(x) and print out the result.