Wednesday, August 27, 2008

Computer and program Design

For the sake of test i write some guideline here for people who read my blog.. so here goes. I'll be basically writing about the programming part and some guidelines. and some notes too.

format string:
  1. %.5f presicion 5 decimal place
  2. %9.5f field width 9 character
  3. %e show in exponent form
logical operation :
  1. NOT !
  2. AND &&
  3. OR ||
some notes about equality and assignment operator:
== means comparing between the 2 value
= means assigning some value to the variable

Chapter 4
Terms
  1. Classical waterfall model-----RDCTDM--requirement, design, code, testing, documentation,maintainance
  2. Algorithm
  3. Pseudocode
  4. Flowchart
  5. Control structure in C
  • Sequence structure
  • Selection structure
  • Repetition structure

Selection structure
  1. If.. else
  • if(condition)statement true; else{ statement false}
  • using ternery operator||(condition? statement true:statement false)
2.Switch
  • switch(control expression){
case a: if the case is char need((((' '))))))
action; break means come out of loop
break;
.............
...............
.............
default:
action;
break;

}

notes..
getchar()>>>>>>>>> get 1 character from keyboard

Repetition structure

1.While

while(condition) in while there is no ; beside condition
{ body}
2. do..while
do{
statement;}
while(condition);
3. for
for(initialization; loop continuation test; counter)
{
use comma for many initialization
} initialize then test do the statement only the increase counter and check again

Function
usefull library function
  1. stdlib.h
  2. math.h
  3. ctype.h
  4. string.h
Function definition
return_data_type function function_name(parameter list)
{ **** can only return 1 item
declaration
statement
}

Function prototype
return-data-type function name(parameter-list);
  • required only when function definition comes after use in program
  • no need variable name
Function call
same as function prototype but supply with real parameter

2 way to call function
  1. call by reference
  2. call by value


Slide 20












No comments: