eBook: Integration and Automation of Manufacturing Systems
   



TOC PREV NEXT

3.11 LABORATORY - C PROGRAMMING


Purpose:

To practice programming in `C'.

Overview:

C programming is an essential tool for developing automated systems. It can be used to develop customized applications for communication and data handling.

Pre-Lab:

Review C programming.

In-Lab:

1. Start up the linux machine, and get X-windows running.
2. Create a new directory with `mkdir src', and then enter the directory with `cd src'.
3. Use the `kedit test.c &' text editor to enter the program below.



4. Compile the program with `cc test.c -o test'. Run the program with `./test'.
5. Use `kedit Makefile &' to enter the makefile below.



6. Compile the program with `make'. Run the program with `./test'.
7. Modify the program to only print every second number.
8. Write a number guessing game that will randomly pick a number between 1 and 100. The user can then guess the number, and the computer will give clues `high' or `low' until the value is guessed. The program will then quit. Use a top-down programming approach.
9. Enter and compile the program below with the expanded makefile. This program will allow a user to enter their name, and output an HTML file that can then be viewed with a browser.







10. Write a program that will allow a user to enter their name. The program will then count the number of letters in their name.

Submit (individually):

1. All program listings, with comments.

TOC PREV NEXT

Search for More:

Custom Search