Page 291 - Computer_Science_F5
P. 291

Computer Science  Output:






          FOR ONLINE READING ONLY





                                     Figure 4.61: Output of the program


             Note: - A function“static_cast<char>( )” enable to translate the value within the
                    function tolower() and toupper( ) into character.




                                                          (b)  Write a C++ program to
                Activity 4.7:
                                                              demonstrate how parameters
             Understanding the application of                 are passed by value and by
             some of the built-in function                    reference.

             (a) Search on the internet built-in      2.   (a)   Differentiate  between  a
                functions which are used to                   function  prototype  and
                (i)  Change a character into a                function header

                    number using the ASCII system         (b)  Write a C++ program to show
                (ii)  Round the decimal number                the application of the function
                    into the whole number                     prototype.
                (iii) Solve modulus division by       3. Create a C++ program that will
                    returning remainders after the       prompt a user to enter the range of
                    user divides two numbers.            the number and choose to display
             (b) Write header files of each function     either an even, odd or a prime
             (c) Write a C++ program to show the         number. Then, the program will
                application of each function.            display selected types of number
                                                         according to the range the user
                                                         enters.
                Exercise 4.14
                                                          Example:
            1.   (a)   What is the difference between     Enter a range of the number: 5
                    passing parameters by value           Enter a type of the number: prime
                    and by reference?
                                                          Output: 2, 3, 5, 7, 11.


                                                 282
                                                                for Advanced Secondary Schools



     Computer Science Form 5.indd   282                                                     23/07/2024   12:34
   286   287   288   289   290   291   292   293   294   295   296