CISC105 - General Computer Science
Lab #8
Character Strings
- Goals
This lab is an exercise to familiarize you with the C Language concept of Character
Strings. You will need to perform the following:
- Create (edit), compile (debug), and execute a C program.
- Facilitate the concepts of Character Strings.
- Create a script which includes the following for the program:
- Concatenation of the source code.
- Compilation of the source code.
- Execution of the completed bug-free program.
- Character String Exercise
Create a program that performs the following facilitating the use of character strings:
- Accepts ten employee records (structures) from the screen
- employee number
- employee name
- hours worked
- pay rate
- Displays the records to the screen with a gross pay calculated from hours worked and pay rate
- Displays totals for hours worked and gross pay; and averages for hours worked, pay rate, and gross pay
- Sort the records in ascending employee name order.
- More than one function must be used (main, input, output, sort).
Please enter the following records in the order shown:
EMP# NAME HOURS RATE
===== ========== ====== =====
2173 Smith 40 5.00
6925 Jones 37 5.25
4732 Valdez 20 7.25
8641 Miller 40 8.25
9732 Brown 40 25.00
1378 Chang 25 9.50
5937 Kelley 36 10.00
4188 Otis 38 15.00
5264 Zimmerman 40 12.75
3343 Wagner 30 13.00
HINT: Make the name at least 10 characters long.
Check out the "strcmp" function in the book to sort by employee name.