Day 2
- Lecture Topics
- programs, main, comments
- Style Guidelines
- gcc -Wall -Werror -ansi -pedantic miles2feet.c -o m2f
- make files
- testing with checkit.h
- input/output
- printf: %d for int, %f for double, %c for char
- scanf: %d for int, %lf for double (that is the letter 'l' not the number '1'), %c for char
- see examples: i.c and o.c
- Example: calculate monthly payment and total loan cost
- Write header comment
- Write main and makefile
- Write test_cases() with one test
- Write calcPayment() to make test pass
- Write a second test
- Write calcPayment() to make tests pass
- Refactor
- Write test for convertToTwoDecimals()
- Write convertToTwoDecimals()
- Write I/O in main()
- See final files: loan.c,
checkit.h,
makefile
- Project 1 due Friday
- Lab 2 assigned in Blackboard