1. Send your homework (ZIP or RAR file) to TA at cs101-ta@voip.edu.tw
  2. Deadline:2007/11/30 11:00
  3. HW9_1


    (From: Exercise 3 on P.230) Declare a character array, and initialize it to "National Chi Nan University." Use a loop to change every character to uppercase. Then output the converted character array.
    Hint: In the ASCII character set, values for uppercase characters are 32 less than their lowercase counterparts.
  4. HW9_2


    (From: Exercise 5 on P.230) Write a C++ program that will generate a random integer greater than 10,000. Output the integer and then output the digits in the integer in words. For example, if the integer was 345678, then the output should be:
    The value is 345678
    three four five six seven eight
    

    Hint: The rand function returns a pseudorandom integer in the range 0 to RAND_MAX (32767). You may test the following example:

    #include <stdlib.h>
    #include <time.h>
    // Print 5 random numbers.
    srand( (unsigned) time(NULL) ); 
    for (int i = 0; i < 5; i++ )
        cout << rand() << endl;