Sample C Programs for CS 1713 Section 3
Here are some of the programs presented in class, as well as solutions
to some of the programming assignments.
- Check for balanced curly braces in a C program.
- Print the file named on the command line to standard output.
- Represent complex numbers in C as an abstract data type.
- Header file to accompany complex.c
- Program to print factorials of 0 through 13 using a function.
- Program to print the first 21 Fibonacci numbers using a function.
- Program that prints all occurences of string in the the first
command line argument in the file named by the second command line argument.
- Examples of using void functions.
- An early version of the program to generate Finite State Automata
from your login name (somewhat advanced).
- Program to print the maximum number in a file called numbers.
- Read in a string and print it backwards, using a void function.
- Instructors solution to Assignment 4.
- Find the mean and standard deviation of numbers in a file
- Do timings on linear search, binary search, insertion sort, and
qsort (a version of quick sort).
- Sieve of Erasthones: print out prime numbers from 2 through 1000
by sieving out the composites.
- Use a function to print the value of the first decimal integer
in a string, without using scanf().
- Read in a list of students IDs and scores, giving the weighted
average for each student and the average for the best student.
- Read in a description of a Finite State Automaton, and then check
to see if the string on the standard input is accepted.
- Draw circles on the screen using 2D arrays
- matrix.c and
- An abstract data type using typedef and struct
that implements a matrix data type with bounds checking.
- A program that prints the twenty most frequent words in the
file on the standard input. Try it on William Shakespeare's
King Henry VIII .
- Instructor's Game of Life