1 / 9

Variables as Containers

Variables as Containers. Variables have: Name Type Data. int length; l ength = 7;. Conditional Statements. if(condition) statement; if(length < 7) { statements; statements; }. Operators. < Less than <= Less than or equal > Greater than >= Greater than or equal == Equal to

odell
Download Presentation

Variables as Containers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Variables as Containers Variables have: Name Type Data

  2. int length; length = 7;

  3. Conditional Statements if(condition) statement; if(length < 7) { statements; statements; }

  4. Operators • < Less than • <= Less than or equal • > Greater than • >= Greater than or equal • == Equal to • != Not equal

  5. Loops • Initialization • Condition • Update • Body

  6. for loop - precondition for(initialization; condition; increment) statement; for(int control = 0; control < max; control++) { statement; statement; }

  7. while loop - precondition • initialization; • while(condition) • { • statements… • Increment condition; • }

  8. do loop - post condition • initialization; • do • { • statements… • Increment condition; • }while(condition);

  9. functions prototype: Looks just like your function header int count(int accumulator); int count(int accumulator) { Statements… }

More Related