Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (202.69 KB, 2 trang )
Course: Programming Fundamentals (C language)
LAB 6 – Functions
Main content:
1.
2.
3.
4.
Get used to standard library functions
Get used to function definitions and function calls
Start more complex data processing
Check coding styles
Practice:
1. Get used to standard library functions
1.1. Write a C program to approximate a value of the function ex using a function for your
approximation and then use a corresponding function pow() in the standard library to
evaluate your approximated values.
1.2. Write a C program to check if a user has entered an alphabetic letter from the keyboard till
the user enters #. How many times has the user entered an alphabetic letter? What is the
percentage of that event? For checking a character input by a user, define and use a
corresponding function and then use a standard function provided by the library.
1.3. Write a C program to compute an average grade of at least three courses that you studied
last semester. It is supposed that the average grade is rounded with two digits after the
floating point. Can we use any existing function in the standard library to round a floating
point number in such a context? If yes, compare your rounded number and the one from
the function in the standard library.
2. Get used to function definitions and function calls
2.1. Given the information of a few students as follows, write a C program to compute the
percentage of the students enrolled in 2014 using functions.
ID