03-C-Functions

03-C-Functions - ECE 175: Computer Programming for...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 175: Computer Programming for Engineering Applications Top-Down Design with Functions
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ECE 175: Computer Programming for Engineering Applications - Top Down Design With Functions Designing a program Problem statement Analysis Identifying problem's data requirements (inputs, outputs, and data types) Design Initial algorithm: Write down the steps involved Algorithm re±nement: If any of the step does not have an obvious solution, expand it Implementation Writing the C program Testing Comprehensive test patterns to check if your program is working correctly or not Do it yourself Go through the case study in the book on ±nding area and circumference of a circle 2
Background image of page 2
ECE 175: Computer Programming for Engineering Applications - Top Down Design With Functions Library functions PredeFned functions and code reuse Code reuse: Reusing program fragments that have already been written and tested C library provides several such functions Math library (math.h) Provides a set of useful mathematical functions Include math.h in the program Use the option of "-lm" when compiling (to link the math objective ±le) Example: Function sqrt Example Compute the distance between two given points in a plane 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 9

03-C-Functions - ECE 175: Computer Programming for...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online