Chapter5_Program design and efficiency
Chapter5_Program design and efficiency
Embedded Programmings
Chapter 5: Program
design & efficiency
Lecturer: Dr. Hoang Duc Chinh (Hoàng Đức Chính)
Department of Industrial Automation
School of Electrical Engineering
Email: [email protected] © DIA 2020.2
Content
5.1. Program design process
5.2. Code optimization
5.3. Good habits in programming
START
statements
statements
conditional
FALSE
TRUE
statements
END
1|2|3
-----
4|5|6
-----
7|8|9
len = strlen(str);
for (i = 1;i<=10;i++)
x += len;
Y = 15 + len;
M = sin(d);
for (i =0; i<100;i++)
plot(i, i*M);
x99 sigmoid(x99)
int main(void)
/* Read a circle's radius from stdin, and compute and write its
diameter and circumference to stdout. Return 0 if successful. */
{
const double PI = 3.14159;
int radius;
int diam;
double circum;
Yes: y = x;
x = x + 1;
Attention!
yes UPPER CASE
yes ( )
#include <stdio.h>
/* conversion constants. */
#define FEET_PER_MILE 5280.0
#define SECONDS_PER_HOUR (60.0 * 60.0)
int main(void)
{
double miles_per_hour; /* input mph */
double feet_per_second; /* corresponding feet/sec */
double feet_per_hour; /* corresponding feet/hr */
return(0);
}