User:Cmjdm



SCHOOL

 * google
 * |  PROGRAMM |   SYSTECH |
 * year1 |  3,732.82 |  3,689.82 |
 * rent1 |  6,000.00 |  6,000.00 |
 * rog  |   1,080.00 |  1,080.00 |
 * cog  |   1,200.00 |  1.200.00 |
 * yTOT |  12,012.00 | 11,969.82 |
 * year2 |  4,099.06 |  3,632.74 |
 * rent2 |  6,000.00 |  6,000.00 |
 * yTOT |  10,099.06 |  9,632.74 |
 * year3 |  3,796.98 |        na |
 * year3 |  6,000.00 |        na |
 * yTOT |   9,796.98 |        na |
 * rent2 |  6,000.00 |  6,000.00 |
 * yTOT |  10,099.06 |  9,632.74 |
 * year3 |  3,796.98 |        na |
 * year3 |  6,000.00 |        na |
 * yTOT |   9,796.98 |        na |
 * year3 |  3,796.98 |        na |
 * year3 |  6,000.00 |        na |
 * yTOT |   9,796.98 |        na |
 * yTOT |   9,796.98 |        na |


 * TUIT |  11,628.86 |  7,322.56 |
 * TUITR | 29,628.00 | 19,322.56 |
 * TUITR | 29,628.00 | 19,322.56 |
 * TUITR | 29,628.00 | 19,322.56 |

OSAP --- out of high school more than 4 years 25,000 last year 4,640 6 months prior 14,144 during study period

out of high school more than 4 years 25,000 last year 4,640 6 months prior 0 during study period

ASCII
########                   #        #################              #     ######################           #    #########################        #  #############################     #               #     #########   #      ##    ###          ####   ##                         ###   ###                       ####   ###   #####################   ####    ###################   ####      ###########        ##         #######          ###        ########          ###      ###########        ######     ########      #########       #####       ########         ###      #########       ######    ############      ########################      #   #   ###  #   #    ##      #########################       ##     ##   ##       ##

Shortcuts
taken f/ http://foliovision.com/seo-tools/computers/windows/xp-run-commands

Run commands

Calc - Calculator Cfgwiz32 - ISDN Configuration Wizard Charmap - Character Map Chkdisk - Repair damaged files Cleanmgr - Cleans up hard drives Clipbrd - Windows Clipboard viewer Cmd - Opens a new Command Window (cmd.exe) Control - Displays Control Panel Dcomcnfg - DCOM user security Debug - Assembly language programming tool Defrag - Defragmentation tool Drwatson - Records programs crash & snapshots Dxdiag - DirectX Diagnostic Utility Explorer - Windows Explorer Fontview - Graphical font viewer Ftp - ftp.exe program Hostname - Returns Computer's name Ipconfig - Displays IP configuration for all network adapters Jview - Microsoft Command-line Loader for Java classes MMC - Microsoft Management Console Msconfig - Configuration to edit startup files Msinfo32 - Microsoft System Information Utility Nbtstat - Displays stats and current connections using NetBios over TCP/IP Netstat - Displays all active network connections Nslookup - Returns your local DNS server Odbcad32 - ODBC Data Source Administrator Ping - Sends data to a specified host/IP Regedit - registry Editor Regsvr32 - register/de-register DLL/OCX/ActiveX Regwiz - Reistration wizard Sfc /scannow - Sytem File Checker Sndrec32 - Sound Recorder Sndvol32 - Volume control for soundcard Sysedit - Edit system startup files (config.sys, autoexec.bat, win.ini, etc.) Systeminfo - display various system information in text console Taskmgr - Task manager Telnet - Telnet program Taskkill - kill processes using command line interface Tskill - reduced version of Taskkill from Windows XP Home Tracert - Traces and displays all paths required to reach an internet host Winchat - simple chat program for Windows networks Winipcfg - Displays IP configuration

Management Consoles

certmgr.msc - Certificate Manager ciadv.msc - Indexing Service compmgmt.msc - Computer management devmgmt.msc - Device Manager dfrg.msc - Defragment diskmgmt.msc - Disk Management fsmgmt.msc - Folder Sharing Management eventvwr.msc - Event Viewer gpedit.msc - Group Policy -XP Pro only iis.msc - Internet Information Services lusrmgr.msc - Local Users and Groups mscorcfg.msc - Net configurations ntmsmgr.msc - Removable Storage perfmon.msc - Performance Manager secpol.msc - Local Security Policy services.msc - System Services wmimgmt.msc - Windows Management

Shortcuts

access.cpl - Accessibility Options hdwwiz.cpl - Add New Hardware Wizard appwiz.cpl - dd/Remove Programs timedate.cpl - Date and Time Properties desk.cpl - Display Properties inetcpl.cpl - Internet Properties joy.cpl - Joystick Properties main.cpl keboard - Keyboard Properties main.cpl - Mouse Properties ncpa.cpl - Network Connections ncpl.cpl - Network Properties telephon.cpl - Phone and Modem options powercfg.cpl - Power Management intl.cpl - Regional settings mmsys.cpl sounds - Sound Properties mmsys.cpl - Sounds and Audio Device Properties sysdm.cpl - System Properties nusrmgr.cpl - User settings firewall.cpl - Firewall Settings (sp2) wscui.cpl - Security Center (sp2)

Windows Environment Commands

%ALLUSERSPROFILE% - Open the All User's Profile %HomeDrive% - Opens your home drive e.g. C:\ %UserProfile% - Opens you User's Profile %temp% Opens - temporary file Folder %systemroot% - Opens Windows folder

Wupdmgr - Takes you to Microsoft Windows Update

General keyboard shortcuts

CTRL+C(Copy) CTRL+X (Cut) CTRL+Z (Undo) DELETE (Delete) SHIFT+DELETE (Delete the selected item permanently without placing the item in the Recycle Bin) CTRL while dragging an item (Copy the selected item) CTRL+SHIFT while dragging an item (Create a shortcut to the selected item) F2 key (Rename the selected item) CTRL+RIGHT ARROW (Move the insertion point to the beginning of the next word) CTRL+LEFT ARROW (Move the insertion point to the beginning of the previous word) CTRL+DOWN ARROW (Move the insertion point to the beginning of the next paragraph) CTRL+SHIFT with any of the arrow keys (Highlight a block of text) CTRL+UP ARROW (Move the insertion point to the beginning of the previous paragraph) SHIFT with any of the arrow keys (Select more than one item in a window or on the desktop, or select text in a document) CTRL+A (Select all) F3 key (Search for a file or a folder) ALT+ENTER (View the properties for the selected item) ALT+F4 (Close the active item, or quit the active program) ALT+ENTER (Display the properties of the selected object) ALT+SPACEBAR (Open the shortcut menu for the active window) CTRL+F4 (Close the active document in programs that enable you to have multiple documents open simultaneously) ALT+TAB (Switch between the open items) ALT+ESC (Cycle through items in the order that they had been opened) F6 key (Cycle through the screen elements in a window or on the desktop) F4 key (Display the Address bar list in My Computer or Windows Explorer) SHIFT+F10 (Display the shortcut menu for the selected item) ALT+SPACEBAR (Display the System menu for the active window) CTRL+ESC (Display the Start menu) ALT+Underlined letter in a menu name (Display the corresponding menu) Underlined letter in a command name on an open menu (Perform the corresponding command) F10 key (Activate the menu bar in the active program) RIGHT ARROW (Open the next menu to the right, or open a submenu) LEFT ARROW (Open the next menu to the left, or close a submenu) F5 key (Update the active window) BACKSPACE (View the folder one level up in My Computer or Windows Explorer) ESC (Cancel the current task) SHIFT when you insert a CD-ROM into the CD-ROM drive (Prevent the CD-ROM from automatically playing) CTRL+SHIFT+ESC (Open Task Manager) Dialog box keyboard shortcuts

If you press SHIFT+F8 in extended selection list boxes, you enable extended selection mode. In this mode, you can use an arrow key to move a cursor without changing the selection. You can press CTRL+SPACEBAR or SHIFT+SPACEBAR to adjust the selection. To cancel extended selection mode, press SHIFT+F8 again. Extended selection mode cancels itself when you move the focus to another control.

CTRL+TAB (Move forward through the tabs) CTRL+SHIFT+TAB (Move backward through the tabs) TAB (Move forward through the options) SHIFT+TAB (Move backward through the options) ALT+Underlined letter (Perform the corresponding command or select the corresponding option) ENTER (Perform the command for the active option or button) SPACEBAR (Select or clear the check box if the active option is a check box) Arrow keys (Select a button if the active option is a group of option buttons) F1 key (Display Help) F4 key (Display the items in the active list) BACKSPACE (Open a folder one level up if a folder is selected in the Save As or Open dialog box)

Microsoft natural keyboard shortcuts

Windows Logo+BREAK (Display the System Properties dialog box) Windows Logo+D (Display the desktop) Windows Logo+M (Minimize all of the windows) Windows Logo+SHIFT+M (Restore the minimized windows) Windows Logo+E (Open My Computer) Windows Logo+F (Search for a file or a folder) CTRL+Windows Logo+F (Search for computers) Windows Logo+F1 (Display Windows Help) Windows Logo+ L (Lock the keyboard) Windows Logo+R (Open the Run dialog box) Windows Logo+U (Open Utility Manager)

Accessibility keyboard shortcuts

Right SHIFT for eight seconds (Switch FilterKeys either on or off) Left ALT+left SHIFT+PRINT SCREEN (Switch High Contrast either on or off) Left ALT+left SHIFT+NUM LOCK (Switch the MouseKeys either on or off) SHIFT five times (Switch the StickyKeys either on or off) NUM LOCK for five seconds (Switch the ToggleKeys either on or off) Windows Logo +U (Open Utility Manager)

Windows Explorer keyboard shortcuts

END (Display the bottom of the active window) HOME (Display the top of the active window) NUM LOCK+Asterisk sign (*) (Display all of the subfolders that are under the selected folder) NUM LOCK+Plus sign (+) (Display the contents of the selected folder) NUM LOCK+Minus sign (-) (Collapse the selected folder) LEFT ARROW (Collapse the current selection if it is expanded, or select the parent folder) RIGHT ARROW (Display the current selection if it is collapsed, or select the first subfolder)

Shortcut keys for Character Map

After you double-click a character on the grid of characters, you can move through the grid by using the keyboard shortcuts RIGHT ARROW (Move to the right or to the beginning of the next line) LEFT ARROW (Move to the left or to the end of the previous line) UP ARROW (Move up one row) DOWN ARROW (Move down one row) PAGE UP (Move up one screen at a time) PAGE DOWN (Move down one screen at a time) HOME (Move to the beginning of the line) END (Move to the end of the line) CTRL+HOME (Move to the first character) CTRL+END (Move to the last character) SPACEBAR (Switch between Enlarged and Normal mode when a character is selected)

Microsoft Management Console (MMC) main window keyboard shortcuts

â€¢ CTRL+O (Open a saved console) CTRL+N (Open a new console) CTRL+S (Save the open console) CTRL+M (Add or remove a console item) CTRL+W (Open a new window) F5 key (Update the content of all console windows) ALT+SPACEBAR (Display the MMC window menu) ALT+F4 (Close the console) â€¢ ALT+A (Display the Action menu) ALT+V (Display the View menu) ALT+F (Display the File menu) ALT+O (Display the Favorites menu)

MMC console window keyboard shortcuts

CTRL+P (Print the current page or active pane) ALT+Minus sign (-) (Display the window menu for the active console window) SHIFT+F10 (Display the Action shortcut menu for the selected item) F1 key (Open the Help topic, if any, for the selected item) F5 key (Update the content of all console windows) CTRL+F10 (Maximize the active console window) CTRL+F5 (Restore the active console window) ALT+ENTER (Display the Properties dialog box, if any, for the selected item) F2 key (Rename the selected item) CTRL+F4 (Close the active console window. When a console has only one console window, this shortcut closes the console)

Remote desktop connection navigation

CTRL+ALT+END (Open the Microsoft Windows NT Security dialog box) ALT+PAGE UP (Switch between programs from left to right) ALT+PAGE DOWN (Switch between programs from right to left) ALT+INSERT (Cycle through the programs in most recently used order) ALT+HOME (Display the Start menu) CTRL+ALT+BREAK (Switch the client computer between a window and a full screen) ALT+DELETE (Display the Windows menu) CTRL+ALT+Minus sign (-) (Place a snapshot of the entire client window area on the Terminal server clipboard and provide the same functionality as pressing ALT+PRINT SCREEN on a local computer.) CTRL+ALT+Plus sign (+) (Place a snapshot of the active window in the client on the Terminal server clipboard and provide the same functionality as pressing PRINT SCREEN on a local computer.)

Microsoft Internet Explorer navigation

CTRL+B (Open the Organize Favorites dialog box) CTRL+E (Open the Search bar) CTRL+F (Start the Find utility) CTRL+H (Open the History bar) CTRL+I (Open the Favorites bar) CTRL+L (Open the Open dialog box) CTRL+N (Start another instance of the browser with the same Web address) CTRL+O (Open the Open dialog box, the same as CTRL+L) CTRL+R (Update the current Web page) CTRL+ CTRL+P (Open the Print dialog box) W (Close the current window)

Note Some keyboard shortcuts may not work if StickyKeys is turned on in Accessibility Options, Some of the Terminal Services client shortcuts that are similar to the shortcuts in Remote Desktop Sharing are not available when you use Remote Assistance in Windows XP Home Edition.

Thanks to The New Tech for the original forum posting.

Microsoft Office run commands If the Microsoft Office is installed you can use following run commands to run its components:

winword – Microsoft Word excel – Microsoft Excel powerpnt – Microsoft PowerPoint msaccess – Microsoft Access outlook – Microsoft Outlook ois – Microsoft Picture Manager

NA
NA Working Steps

The "first" of anything is a beginning, and so it is with the steps: The First Step is the beginning of the recovers process. The healing starts here; we can not go any further until we have worked this

step.

Some NA memebers "feel" their way through the First Step by intuition; others choose a more systematic fasion. Our reasons for formally working Step One will vary from person to person. It may be that we

are new to recovery, and weve just fought and lost an exhausting battle with drugs. It may be that we've been around awhile, abstinent from drugs, but weve discoverd that our disease has become active in

other area of our lives, forcing us to face our powerlessness and the unmanageability of our lives once again. Not every act of growth is motivated by pain; it may just be time to cycle through the steps

again thus beginning the next stage of our never-ending journey.

Some of us find a measure of comfort in realizing that a disease, not a moral failing, has caused us to reach this bottom. Others dont really care what the cause has been we just want out.

Whatever the vase, its time to do some step work: to engage in some concrete activity that will help us find more freedom from our addiction, whatever shape it is taking. Our hope is to internalize the

principles of acceptance, humility, willingness, honesty, and open mindedness a fundamental part of who we are.

First, we must arrive at a point of surrender. There are many different ways to do this. For some of us, the road we traveled getting to the first step was more than enough to convince us that the

unconditional surrender was our only option. Others start this process even though were not entirely convinced that we are addicts or that we have really hit rock bottom. Only in working the first step do

we truly come to realize that we are addicts. That we have hit bottom, and that we must surrender.

Before we begin working the first step, we must become abstinent whatever it takes. If were new in NA and our first step is primarily about looking at the effects of drug addiction in our lives we need to

get clean...

If weve been clean awhile and our first step is about powerlessness over some other behaviour that has made out lives unmanageable, we need to find a way to stop the behaviour so that our surrender isnt

clouded by continued acting out.

Step One: "We admitted that we were powerless over our addiction, that our lives had become unmanageable."

THE DISEASE OF ADDICTION

What makes us addicts is the disease of addiction-not the drugs, not our behaviour, but our disease. There is something within us that makes us unable to control our use of drugs. This same "something" also

makes us prone to obsession and compulsion in other areas of our lives. How can we tell when our disease is active..? When we become trapped in obsessive, compulsive, self-centered routines, endless loops

that lead nowhere but to physical, mental, spiritual, and emotional decay.


 * What does "the disease of addiction" mean to me?

The disease of addiction means many things to me, its become a way of living, its become my solice to know that eventually I can get high. I wish I could say I am not an addict and that I can be responsible

with my intake. But I know that its not true. Once I take that first drug I cant stop as easily as I would like to. Addiction effects many different aspects of my life. I wish that I could be a better

person and make the choices that I know I should make but something inside of me doesnt want it to happen. I could be in the midst of preparing my next fix while at the same time telling myself I do not

want to do this. I realized that the addictive aspect of my persona is not actually me. It is a monster that will do anything to see that next fix. I do not know how to face this monster yet but I am

learning. I made it a month in a half and I relapsed. I thought I had everything under control but really I just wanted to think that I did and thats what my drug of choice helps me acheive. I lie I cheat I

steal and I kill (as in harm others) in order to get what I want. I have reached a point in my life where I just want to be normal. I no longer want to live my life day to day. I want goals and dreams I can

follow. I want to grow into a person that has conquered addiction but its not an easy task. Sometimes easy does it makes me weak. I can no longer be easy on myself. I can no longer idley sit back and not

realize the harm I am doing to myself and others. I need to be a man and face this demon before it is to late. Before I loose everything I have worked so hard for.


 * Has my disease been active recently? In what way?

Yes my disease has been active recently to the extent that I lie everyday to the girl that I love. I cant beleive I made it a month in a half without getting high. Looking back I don't even understand how

it is possible. I have become so lost in my old ways again that I dont remember what it was like to have a clear head any longer. Everyday I wake up telling myself that today is going to be the day I stop,

then it becomes the day that I wont stop by Ill slow down, the next thing I know its not the day that I will stop nor the day I will slow down its another day to get high. I try to have willpower and I try

to not smoke or not care but If i dont have any in stock i will just want it even more. And when I do have it in stock I dont want it but I still do it. Ive tried to increase the amount I smoke just so I

dont have any left and that doesn't help because I just get more. I made a promise to my girlfriend and I break that promise everyday. Its not fair to her nor is it fair to the true me. I wonder how such a

cunning enemy could have taken me over like this but thinking about it I was the one who allowed this enemy to breach the gates. I was young and dumb and thought that there was no such thing as a

consquence. My addiction lately has got the best of me. I just wish I could get it under control.


 * What is it like when Im obsessed with something? Does my thinking follow a patern? Describe.

When I am obsessed I am so stuck in my own mindset I can hardly see how I am hurting others or taking advantage of them. I dont give up until I either get my fix or conclude there is now way I can do so

today. I dont remember the last time I had a choice because even when I choose not to get high the monster in me convinces me that its alright if I do. My thinking follows a simple pattern which goes as

follows: should I or shouldnt I get high? should I or shouldnt I pick up? Im afraid that if I do not have any supply I might die. But I am afraid if I do have supply I will just keep getting high. Once I do

get high and I can finally relax for a bit. A couple hours before I am thinking about my next high. Eventually I break even if I tell myself I will not smoke I find myself doing it.


 * When a thought occurs to me, do I immediately act on it without considering the consequences? In what other ways do I behave compulsively?

Many thoughts occur to me throughout the day. And I almost always consider the consequences but I find myself giving in. I know that I will sooner or later have to face the consequences but for some reason

I think I can go a little longer without having to worry. I do this until I eventually have to learn the hard way. I ponder the consequences but I do not belive that they are real.


 * How does the self centered part of my disease affect my life and the lives of those around me?

The self centeredness of my disease is probably the part I hate the most. I am normally a caring and loving person, I dont have a problem with drugs I have a problem without them. My happiness is dependent

on how much I have smoked each day. If its not enough I am upset and if it is to much I am lazy. I never find a common ground or be responsible in my choices. I worry about getting more when I dont have any

but I complain when I do smoke. I have allowed my relationships to revolve around my drug of choice. I have lie and hurt others to get my fix. I have taken the last crumbs when no one is looking and then

get angry that I didn't share.


 * How has my disease affected me physically? Mentally? Spiritually? Emotionally?

This is a hard one to answer. In one sense I have been physically drained of all energy. I am almost always tired and I just procrastinate until I cant anymore. Mentally I think I have things under control

but I know deep down that is not the case. My drug of choice helps me to feel mentally alright. I have become a recluse and I just want to sit at my computer all night. I do not appreciate the simple things

in life like I used to. Spiritually I am lost. I wish I put more effort into my faith, it is like I am convientiently reglious only when I am in need or I am sad. Praying to god has always helped me but I

need to start praying to myself beacause I am the one who can truly change my behaviour. God may be able to restore me to sanity but god is within me so I ultimatley need to make the effort.


 * Have I been obsessed with a person, place, or thing? If so, how has that gotten in the way of my relationships with others? How else have I been affected mentally, physically, spiritually, and emotionally

by this obsession?

I am obsessed with myself being in my house and using my drug of choice. This prevents me from having friends and it prevents me from loving my girlfriend as much as I could. I used to be obsessed with my

girlfriend and want to talk to her all day long but as I use more we become more distant. I am afraid she will find out who I have become again. I made so much progress with her help and I don't want her to

be upset that I have thrown it all away. I dont known how I got myself in this prediciment again but I have and I need to do something. I have lost my hope I have lost my strength, I have lost my faith and

I have lost my happiness.

DENIAL

Denial is the part of our disease that tells us we dont have a disease. Wehn we are in denial, we are unable to see the reality of our addiction. We minimize its effect. We blame others, citing the too-high

expectations of families, friends, and employers. We compare ourselves with other addicts whos addiction seems worse than our own. We may blame on particular drug. If we have been abstinent from drugs for

some time we might compare the current manifestation of our addiction with our drug use, rationalizing that nothing we do today could possibly be as bad as that was. One of the easiest ways to tell that we

are in denial is when we find ourselves giving plausible but untrue reasons for our behaviour.


 * Have I given plausible but untrue reasons for my behavior? What have they been?


 * Have I compulsively acted on an obsession, and then acted as if I had actually planned to act that way? When were those times?


 * How have I blamed other people for my behavior?


 * How have i compared my addiction with others' addiction? Is my addiction "bad enough" if I dont compare it to anyone else's?


 * Am I comparing a current manifestation of my addiction to the way my life was before I got clean? Am I plagued by the idea that I should know better?


 * Have I been thinking that I have enough information about addiciton and recovery to get my behavior under control before it gets out of hand?


 * Am I avoiding action because I am afraid I will be ashamed when I face the results of my addiction. Am I avoiding action because Im worried about what others will think?

HITTING BOTTOM: DESPAIR AND ISOLATION

Our addiction finally brings us to a place where we can no longer deny the nature of our problem.

General
// ~  CH4 TERMS // ~

?: conditional operator 60 | ternary operator the closely resembles an if else statement condition ? true : false


 * multiplication operator 72 | multiplies the left operand by the right operand


 * = multiplication assignment operator 77 | multiplies and left operand by the right operand and assigns the value to the left operand

/ division operator 72 | performs integer division of left operand by the right operand

/= division assignment operator 77 | performs integer division of left operand by the right operand and assigns the value to the left operand

% remainder operator 72 | calculates the remainder after integer division of the left operand by the right operand

%= remainder assignment operator 77 | calculates the remainder after integer division of the left operand by the right operand and assigns the value to the left operand

-- decrement operator 78 | decreases the variable by 1

++ increment operator 78 | increases the variable by 1

+= addition assignment operator 77 | calculates the sum of the left operand and the right operand

-= subtraction assignment operator 77 | subtracts the left operand by the right operand and then assings the value to the left operand

action 55 | algorithms contains actions to be performed and the order in which these are to be executed

action symbol 57 | in flowcharts the action symbol is represented by a rectangle and is for performing actions like calculations and the input/output of data

addition assignment operator (+=) 77 | add the left operand with the right operand and assigns the value to the left operand

algorithm 55 | a set of actions and decisions to be performed and the order in which these are to be executed

block 62 | the set of statements contained within a set of braces, also known as a compund statement

“bombing” 68 | a term used to indicate the program has crashed or exited without sucessful completion

cast operator 71 | creates a temp variable in memory to promote the operand to a specific type of variable

compound statement 62 | a set of statements contained within a set of braces, also known as a block

conditional expression 60 | the three operands and the conditional operator produce a conditional statement

conditional operator (?:) 60 | ternary operator that resembles a if else statement condition ? true : false

connector symbol 57 | lines that connect flowchart actions and decisions with a arrow idicating flow of control

control statement stacking 58 | stacking statements one after another

control structure 56 | types of program control: sequence(built in), selection(if, if...else, if...else if, switch), repetition (while, for, do...while)

counter 64 | a counter is used to count the amount of iterations that have been performed.

counter-controlled repetition 64 | definite repetition in where the amount of iterations is known before hand, a counter is in/decreased until the counter reaches its max value

“crashing” 68 | a term used to indicate the program has exited without sucessful completion

decision symbol 57 | in a flowchart the diamond symbol is used to represent a decision is to be made

default precision 72 | the default amount of decimal places that will be shown when representing a floating point value, default is .6

definite repetition 65 | repetition in which the amount of iterations are known in advance and uses a counter for the continuation test

diamond symbol 57, 59 | flowchart symbol to represent a decision is to be made

double-selection statement 57 | a selection statment that makes two different decisions based on whether the condition is true or false

dummy value 67 | is a sentinel value that is tested to determine if the loop continuation test should continue and if the end of data entry has been reacher, works like EOF and normally is a -1

explicit conversion 71 | using a cast operator to promote a variable

fatal error 68 | division by zero is a fatal error that causes the program to crash unless the case is tested and fixed during execution

first refinement 67 | the top statement is refined further by dividing the task up into smaller steps

flag value 67 | a sentinel value

float 69 | a type of variable that contains floating point numbers ie a decimal value

floating-point number 69 | a decimal value that is not a whole number

flowchart 56 | a flowchart is a graphical representation of an algorithm or of a portion of an algorithm.

flowline 57 | in a flowchart a flowline is used to demonstrate which way the program flows from statement to statement

“garbage value” 66 | variables hold the last value held in that section of memory and these values are garbage until they are initialized or assigned a new value

goto elimination 56 | all programs can be written without goto statments this improves program clarity

goto statement 56 | c statement that allows you to transfer program control to a specific label noted somewhere in the program

implicit conversion 71 | the promotion of a variable to higher date type

indefinite repetition 67 | repetition in where the amount of iterations is not known in advance uses a sentinel value to indicate end of data entry

integer division 71 | division that does not calculate the remainder and only deals with whole integer values

multiple-selection statement 57 | a selection statment that can make many different actions based on a condition

multiplicative operator 72 | the / * and % operators

nested statements 74 | statements nested within one another eg

nested if...else statement 61 | test for multiple cases by placing if else statements inside if else statments

nesting statements 73 | placing statements within other statements eg and for statment in if...else statement

order 55 | the sequence in which the actions or steps or performed

oval symbol 57 | indicates the beginning or the end of a flowchart only when it represents a full algorithm

postdecrement operator (--) 78 | uses the variable and then decreases the value by 1

postincrement operator (++) 78 | uses the variable and then increases the value by 1

precision 72 | the precision in which a floating point value will be represented default precision is 6

predecrement operator (--) 78 | decrements the variable by 1 and then uses the variable

preincrement operator(++) 78 | increments the variable by 1 and then uses the variable

procedure 55 | a set of steps that are performed to complete a certain task

program control 55 | specifying the order in which statements are to be executed

promotion 71 | promoting a variable to a higher data type to be used in explicit conversion also known as implicit conversion

pseudocode 55 | an artificial programming language used to plan out your code

rectangle symbol 57 | used in flowcharts to indicate an actions is to take place

repetition statement 63 | allow you to specify that a statement is to be repeadted the loop continuation test becomes false

repetition structure 56 | programming technique that performs specific actions repeatedly until some loop continuation condition becomes false

rounded 72 | when a number is rounded to the nearest reference value, can be rounded up or down

second refinement 67 | final stage of refinement in where the actual variables are included and more detailed information is included for each step

selection structure 56 | programming technique that performs specific actions based on a decision or set of decisions

sentinel value 67 | value used to indicate the end of data entry

sequence structure 56 | programming technique that performs statements one after another in sequence

sequential execution 56 | c programs normally peform statements in sequence one after another

signal value 67 | a sentinel value

single-selection statement 57 | selection statement that performs and action if condition is true but is ignored if the condition is false

single-entry/single-exit control statement 58 | statement that has only one point of entry and one point of exit

small circle symbols 57 | used to indicate the start/ finish of a section of flowchart when the entire algorithm is not shown

top 67 | psuedocode that is a single statement that conveys the program’s overall function

top-down, stepwise refinement 67 | a technique that is essential to the development of well-structured programs that involves breaking down the code from the top downwards

total 66 | a variable that is used to accumulate the sum of a series of values

transfer of control 56 | c statements allow you to control which statements are performed next instead of just the next statment in sequence

truncated 71 | when part of a value is lost during calculation for example the floating point value being rounded down to the whole number

unary operator 72 | cast operators are unary operators as they only take one operand

while repetition statement 63 | a repetition statement that allow a compound statement to be reapeated until the loop continuation test becomes false

white-space character 58 | c compilers ignore white space chars like blanks, newlines, tab spots,

// ~  CH4 SUMMARY // ~

Repetition Essentials

- Most programs involve repetition or loopingg. A loop is a group of instructions the computer executes repeatedly while some loop-continuation condition remains true. - Counter-controlled repetition is sometimes called definite repetition because we know in advance exactly how many times the loop with execute. - Sentinel-controlled repetition is sometimes called indefinite repetition because its not known in advance how many times the loop will execute. - In counter-conrtrolled repetition, a control variable is used to count the number of repetitions. The counter variable is incremented usually by 1 each time the iteration is complete. - When the counter correct number of repetitions has been performed, the loop terminates and the program resumes execution with the statement after the repetition statement. - Sentinel values are used to control repetition when the number of repetitions is not known in advance and the loop includes statements that obtain data each time the loop is performed. - The sentinel value indicates "end of data". The sentinel is entered after all regular data items have been supplied to the program. Sentinels must be distinct from regular data items.

Counter-Controlled Repetition

- Counter-controlled repetition requires the name of the control variable, the initial value of the control variable. - Counter-controlled repetition also needs the increment or decrement by which the control variable is modified each time through the loop. - Counter-controlled repetition also needs the condition that tests for the final value of the control variable (whether loopnig should continue).

For Repetition Statement

- The for repeition statement handles all the details of counter-controlled repetition. - When the for statement begins executing, its control variable is initialized. Then the loop continuation condition is tested. - If the condition is true the body of the loop executes. - The control variable is then incremented or decremented accordingly and the loop begins with the loop continuation condition. - The gerneral format of the for statment is: for ( expr1; expr2; expr3 ) { statements; }

Where expr1 initializes the loop-control variable, expr2 is a loop-continuation condition and expr3 is the increment or decrement of the control variable

- In most cases the, the for statement can be written as a while statement as in

expr1; while ( expr2 ) { statement; expr3; }

- The comma operator guarentees that lists of expressions evaluate from left to right, the value of the entire expression is that of the rightmost expression. - The three statements in the for are optional. If expr2 is ommited, C assumes that the condition is true thus creating an infinite loop. - One might omit expr1 if the control variable is initialized elsewhere in the program. - expr3 might be ommited if the increment or decrement is calculated by a statement in the body or if an increment is not required. - The increment expression in the for statements act like a stand-alone C statement at the end of the body of the for. - The two semicolons in the for statement are required.

For Statement: Notes and observations

- The initialization, loop-continuation condition and increment can contain arithmetic expressions. - The increment may be negative in which case it is a decrement. - If the initial loop-continuation test is false, the body portion of the loop will not execute.

Examples Using the for Statement

- Function pow performs exponentiatation. The fucntion pow( x, y ) calculates the value of x raised to the yth power. It takes to arguments of type double and returns a double value. -

GENERAL FORMATS

if ( condition ) { statements; }

if ( condition ) { statements; } else { statements; }

if ( condition ) { statements; } else if ( condition ) { statements; }

while ( condition ) { statements; condition test; }

do { statements; } while ( condition );

switch ( condition ) { case 1 = 'x': case 2 = 'x': statements; break; }

for ( expr1; expr2; expr3 ) { statements; }

ch5
CH 5.11 - An Example Game of Chance

One of the most popular games of chance is a dice game known as "craps", which is played in casinos and back alleys throughout the world. The rules of the game are straightfoward.

A player rolls two dice. Each die has six faces. These faces contain 1, 2, 3, 4, 5, and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. If the sum is 7 or 11 on the first throw, the player wins. If the sum is 2, 3, or 12 on the first throw (called “craps”), the player loses (i.e., the   house” wins). If the sum is 4, 5, 6, 8, 9, or 10 on the first throw, then that sum becomes the player’s “point.” To win, you must continue rolling the dice until you “make your point.” The player loses by rolling a 7 before making the point.

FIG 5.10 simulates the game of craps and FIG5.11 shows several sample executions.

In the Rules of the game, notice that the player must roll two dice on the first roll, and must do so later on all subsequent rolls. We define a function rollDice to roll the dice and compute and print their sum. Function rollDice is defined once, but it's called from two places in the program (lines 23 and 51). Interestingly, rollDice takes no arguments so we've indicated void in the parameter list (line 76). Function rollDice does return the sum of the two dice so a return-type of int is indicated in the fucntion header.

The game is reasonably involved. The player may win or lose on the first roll, or may win or lose on any subsequent roll. Variable gameStatus, defined to be of a new type enum Status - stores the current status. Line 8 creates a programmer defined type called an enumeration. An enumeration introduced by the keyword enum, is a set of integer constants represented by identifiers. Enumeration Constants are sometimes called symbolic constants. Values in an enum start with 0 and are incremented by 1. In line 8, the constant CONTINUE has a value of 0, WON has a value of 1, LOST has the value of 2. It's also possible to assign an integer value to each identifier in an enum. The identifier in an enumeration must be unique, but the values may be duplicated.

When the game is won, either on the first roll or on a subsequent roll, gameStatus is set to won. When the game is lost, either on the first roll or subsequent rolls game status is set to LOST. Otherwise game status is set to CONTIUNE and the game continues.

After the first roll if the game is over, the while statement (line 50) is skipped because gameStatus is not CONTINUE. The program proceeds to the if...else statement at line 65 which prints "Player Wins" if the gameStatus is WON and "Player Looses" if the gameStatus is set to LOST.

After the first roll if the game is not over the sum is saved in myPoint. Execution proceeds with the while statement (line 50) because gameStatus is set to CONTINUE. Each time through the while, rollDice is called to produce a new sum. If sum matches myPoint, gameStatus is set to WON to indicate that the player won, the while-test fails, the if...else statement (line 65) prints "Player Wins" and execution terminates. If sum is equal to 7 (line 58), gameStatus is set to LOST to indicate that the player lost, the while-test fails, the if...else statement (line 65) prints "Player Looses" and execution terminates.

Note the program's interesting control architecture. Weve used two functions main and rollDice and the swtich, while, nested if...else and nested if statements. In the exercises well investigate various interesting characteristics of the game of craps.

5.12 Storage Classes

In CH2-4, we used identifiers for variable names. The attributes of variables include name, type, size, and value. In this chapter we also use identifiers as names for user-defined functions. Actually, each identifier in a program has other atrributes, including storage class, storage duration, scope and linkage.

C provides four storage classes, indicated by the storage class specifiers: auto, register, extern and static. An identifier's storage class determines its storage duration scop and linkage. An identifier's storage duration is the period which the identifier exists in memory. Some exist breifly, some are repeatedly created and destroyed, and others exist for the entire execution of a program. An identifiers scope is where the identifier can be referenced in a program. An identifier's linkage determines for a multiple source-file program whether the identifier is known only in the current source file or in any source file with proper declarations. This section discusses storage classes and storage duration. Section 5.13 discusses scope. Ch14 discusses identifier linkage and programming with multiple source files.

The four storage-class specifiers can be split into two storage durations: automatic-storage-duration and static-storage-duration. Keywords auto and register are used to declare variables of automatic storage duration. Variables with automatic storage duration are created when the block in which they're defined is entered; they exist while the block is active, and they're destroyed when the block is exited.

Local Variables

Only variables can have automatic storage duration. A function's local variables (those declared in the parameter list of function body. Normally have automatic storage duration. Keyword auto explicitly declares variables of automatic-storage-duration. For example the followingdeclaration indicates that double variables x and y are automatic local variables and they exist only in the body of the function in which the declaration appears.

auto double x, y;

Local variables have automatic-storage-duration by default, so keyword auto is rarely used. For the remainder of the text we will refer to variables with automatic-storage-duration simply as automatic variables.

Register Variables

Data in the machine-language version of a program is normally loaded into registers for calculations and other processing.

The compiler may ignore register declatarions. eg there may not be a sufficient number of registers available for the compiler to use. The following declaration suggests that the integer variable counter be placed in one of the computer's registers and initialized to 1

register int counter = 1;

Keyword register can be used only with variables of automatic storage duration.

Static Storage Class

Keywords extern and static are used in the declaration of identifers for variables and functions of static-storage-duration. Identifiers of static storage duration exist from the time at which the program begins execution. For static variables, storage is allocated and initialized once, when the program begins execution. For functions, the name of the function exists from the start of program execution, this does not mean that these identifiers can be accessed throughout the program. Storage duration and scope (where a name can be used) are seperate issues as we will see in section 5.13.

There are two types of identifiers with static storage duration: external identifiers (such as global variables and function names) and local variables declared with the storage-class specifier static. Global variables and function names are of storage class extern by default. Global variables are created by placing variable declarations outside any function definition, and they retain their values throughout the execution of the program. Global variables and functions can be referenced by any function that follows their declarations or definitions in the file. This is one reason for using function prototypes - when we include stdio.h in a program that calls printf, the function prototype is placed at the start of our file to make the name printf known to the rest of the file.

Local variables declared with the keyword static are still known only in the function in which they are defined, but unlike automatic variables, static local variables retain their value when the function is exited. The next time the function is called, the static local variable contains the value it had when the function last exited. The following declares local vairable count to be static and to be initialized to 1.

static int count = 1;

All numeric variables of static storage duration are initialized to zero if you do not explicitly initialize them.

Keywords extern and static have special meaning when explicitly applied to external identifiers. In chapter 14 we discuss the explicit use of extern and static with external identifiers and multiple-source-file programs.

5.13 Scope Rules

The scope of an identifier is the portion of the program in which the identifier can be

referenced. eg when we define a local variable in a block, it can be referenced only following

its definition in that block or in blocks nested within that block. The four identifier scopes

are function scope, file scope, block scope and function prototype scope.

Labels (an identifier followed by a colon such as start:) are the only identifiers with

function scope. Labels can be used anywhere in the function in which they appear, but cannot

be referenced outside the function body. Labels are used in switch statements (as case labels)

and in goto statements. Labels are implementation details that functions hide from one

another. This hiding - more formally known as information hiding - is a means of implementing

the principle of least privelage, one of the most fundamental principles of good software

engineering.

An identifier declared outside any function has file scope. Such an identifier is known ie

accessible in all function from the point at which the identifier is declared until the end of

the file. Global variables, fucntion definitions, and function prototypes placed outside a

function all have file scope.

Identifiers defined inside a block have block scope. Block scope ends at the terminating right

brace of the block. Local variables defined at the beginning of a function have block scope as

do function parameters, which are considered local variables by the function.

template
Chapter x - Topic

=
===========================================================================================================================================================================================


 * Quotes ***

1. | "x" --x 2. | "x" --x 3. | "x" --x 4. | "x" --x 5. | "x" --x

=
===========================================================================================================================================================================================


 * Objectives ***

In this chapter you will learn:

1. | x 2. | x 3. | x 4. | x 5. | x 6. | x

=
===========================================================================================================================================================================================


 * Outline ***

x.1 | x x.2 | x x.3 | x x.4 | x x.5 | x x.6 | x x.7 | x x.8 | x x.9 | x x.10 | x x.11 | x x.12 | x

Summary | Terminology | Self Rev Ex | Answer to Self Rev Ex | Self Ex |

=
===========================================================================================================================================================================================

=
===========================================================================================================================================================================================


 * Ch x.1 | x ***

=
===========================================================================================================================================================================================


 * Ch x.2 | x ***

=
===========================================================================================================================================================================================


 * Ch x.3 | x ***

=
===========================================================================================================================================================================================


 * Ch x.4 | x ***

=
===========================================================================================================================================================================================


 * Ch x.5 | x ***

=
===========================================================================================================================================================================================


 * Ch x.6 | x ***

=
===========================================================================================================================================================================================


 * Ch x.7 | x ***

=
===========================================================================================================================================================================================


 * Ch x.8 | x ***

=
===========================================================================================================================================================================================


 * Ch x.9 | x ***

=
===========================================================================================================================================================================================


 * Ch x.10 | x ***

=
===========================================================================================================================================================================================


 * Ch x.11 | x ***

=
===========================================================================================================================================================================================


 * Ch x.12 | x ***

=
===========================================================================================================================================================================================

=
===========================================================================================================================================================================================


 * Summary ***

x.1 | x

- - - - -

x.2 | x

- - - - -

x.3 | x

- - - - -

x.4 | x - - - - -

x.5 | x

- - - - -

x.6 | x

- - - - -

x.7 | x

- - - - -

x.8 | x

- - - - -

x.9 | x

- - - - -

x.10 | x

- - - - -

x.11 | x

- - - - -

x.12 | x

- - - - -

=
===========================================================================================================================================================================================

=
===========================================================================================================================================================================================


 * Terminology ***

=
===========================================================================================================================================================================================

=
===========================================================================================================================================================================================

Tips and Tricks
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Programming Theroy Quotes

chONE
Things are always at their best at their beginning. -- Blaise Pascal

The cheif merrit of language is clearness. -- Galen

Our life is frittered away by detail, Simplify, Simplify. -- Henry David Thoreau

He had a wonderful talent for packing thought close, and rendering it portable. -- Thomas B. Macaulay

Man is still the most extraordinary computer of all. -- John F. Kennedy

chTWO
What's in a name? That which we call a rose by any other name would smell as sweet. -- Shakespeare

When faced with a decision, I always ask, "What would be the most fun?" -- Peggy Walker

"Take some more tea," the March Hair said to Alice, very earnestly. "I've had nothing yet," Alice replied in an offended tone: "so I can't take more." "You mean you can't take less," said the Hatter: "it's very easy to take more than nothing." -- Lewis Carroll

High thoughts must have high language. -- Aristopanes

chTHREE
Let's all move one place on. -- Lewis Carroll

The wheel is come full circle. -- Skakespeare

How many apples fell on Newton's head before he took the hint. -- Robert Frost

All the evolution we know of proceeds from the vaugue to the definite. -- Charles Sanders Peirce

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Good Programming Practice

- 1.1 write your C programs in a simple and straight foward matter. This is sometimes refered to as KISS(keep is simple stupid). Not not "strech" the language by trying bizarre usages.

- 2.1 Every Function should be preceeded by a comment describing the purpose of the function.

- 2.2 Add a comment to the line containing the right brace, }, that closes every function, including main.

- 2.3 The last character printed by a function that displays output should be a newline(\n). This ensures that the function will leave the screen cursor positioned at the beginning of a new line. conventions of this nature encourage software reusability - a key goal in software development. environments.

- 2.4 Indent the entire body of each function one level of indentation (we recommend three spaces) within the braces that define the body of the function. This indentation emphasizes the functional structure of programs and helps make programs easier to read.

- 2.5 Set a convention for the size of indent you prefer and then uniformly apply that convention. Tabs stops may vary so it is best to use three spaces per level of indent.

- 2.6 Choosing meaningful variable names helps make a program self-documenting, ie. Fewer comments are needed.

- 2.7 The first letter of an identifier used as a simple variable name should be a lowercase letter. Later in the text we will assign special significance to identifiers that begin with a capital letter and to identifiers that use all capital letters.

- 2.8 Multiple word variable names help make programs easier to read. Avoid running the separate words together as in "totalcommisions". Rather, seperate the words with an underscore as in "total_commisions", or if you do prefer to run run the words together, begin each word after the first word with a capital letter as in "totalCommisions". The latter is prefered.

- 2.9 Separate the definitions and executable statements in a function with one blank like to emphasize where the definitions end and the executable statements begin.

- 2.10 Place a space after each comma to make programs more readable.

- 2.11 Place spaces on either side of a binary operator. this makes the operator stand out and makes the program more readable.

- 2.12 Using redundant parenthesis in complex arithmetic expressions can make the expression clearer.

- 2.13 Indent the statement(s) in the body of an if statement.

- 2.14 Place a blank line before and after every if statement in a program for readability..

- 2.15 Although it is allowed, there should be no more than one statement per line in a program.

- 2.16 A lengthy statement may be printed over several lines. If a statement must be split across lines than, choose, breaking points that make sense( such as after a comma in a comma-seperated list). If a statment is split across two or more lines, indent all subsequent lines.

- 2.17 Refer to the operator precedence chart when writing expressions containing many operators. Confirm that the operators are applied in the proper order. If you are uncertain about the order of evaluation in a complex expression, use parenthesis to group expressions or break the statement into several simpler statements. Be sure to observe that some of C's operators such as the assignment operator "= gets" associate from right to left rather than from right to left rather than left to right.

- 3.1 Consistently applying responsible indentation conventions greatly improves program readability. We suggest a fixed tab size of about 1/4 an inch or three blank spaces.

- 3.2 Pseudocode is often used to "think out" a program during the program design process. Then the pseudocode program is converted to C.

- 3.3 Indent both body statements of an if...else statement.

- 3.4 If there are several levels of indentation, each level should be indented the same additional amount of space.

- 3.5 When preforming division by an expression whose value could be zero, explicitly test for this case and handle it appropriatley in your program (such as printing an error message), rather than allowing a fatal error to occur.

- 3.6 In a sentinel-controlled loop, the prompts requesting data entry should explicitly remind the user what the sentinel value is.

- 3.7

-

-

-

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Common Programming Error

- 1.1 Errors like division-by-zero occur as a program runs, so these errors are called runtime errors or execution-time errors. Divide-by-zero is generally a fatal error, for e.g. an error that causes the program to terminate immediatley without sucessfully performing its job. Non fatal errors allow programs to run to completion, often producing incorrect results. [Note: On some systems, divide-by-zero is not a fatal error. Please see your system documentation.]

- 2.1 Forgetting to terminate a comment with */.

- 2.2 Starting a comment with the characters */ or ending /* -should be the other way, ie. /* insert comment */.

- 2.3 Typing the name of the output function printf as print in a program.

- 2.4 Using a capital letter where a lowercase letter should be used, ie. typing Main instead of main.

- 2.5 Placing variable definitions among statements causes syntax errrors.

- 2.6 A calculation in an assignment statement must be on the right side of the = operator. It is a syntax error to place a calculation on the left side of an assingment operator.

- 2.7 Forgetting one or both of the double quotes surrounding the format control string in a printf or scanf.

- 2.8 Forgetting the % in a conversion specification in the format control string of a printf or scanf.

- 2.9 Placing an escape sequence such as "\n" outside the format control string of a printf or scanf.

- 2.10 Forgetting to include the expressions whose values are to be printed in a printf containing conversion specifiers.

- 2.11 Not providing a conversion specifier when one is needed in a printf format control sting to print the value of an expression.

- 2.12 Placing inside the format control sting the comma that is supposed to separate the format control string from the expressions to be printed.

- 2.13 Forgetting to precede a variable in a scanf statment with an ampersand when that variable should, in fact, be preeceded by an ampersand.

- 2.14 Preceding a variable included in a printf statement with an ampersand when, in fact, that variable should not be preceded by an ampersand.

- 2.15 An attempt to divide by zero is normally undefined on computer systems and generally results in a fatal error, ie. an error that causes the program to terminate immediatley without having successfully performed its job. Non fatal errors allow programs to run to completion but often producing incorrect results.

- 2.16 A syntax error will occur if the two symbols in any of ther operators ==, !=, <=, >= are seperated by spaces.

- 2.17 A syntax error will occur if the two symbols in any of ther operators ==, !=, <=, >= are reversed. as in =!, =<, =>, respectivley

- 2.18 Confusing the equality operator "== double equals" with the assingment operator "= gets" - 2.19 Placing a semicolon immediatley to the right of the right parenthesis after the condition in an if statement.

- 2.20 Placing commas (when none are needed) in the format control string of a scanf statement.

- 3.1 Forgetting one or more of the braces that delimit a compound statement.

- 3.2 Placing a semi-colon after the condition in an if statement, as in, if ( grade >= 60 ); leads to a logic error in single-selection if statements and a syntax error in double-selection if statements.

- 3.3 Not providing the body of a while statement with an action that eventually causes the condition in the while to become false. Normally such a repitition structure will never terminate - an error called an infinite loop.

- 3.4 Spelling the keyword while with an uppercase W as in While. Remember C is case sensitive, all of C's keywords like else, while, if all only conatin lowercase letters.

- 3.5 If a counter or total is not initialized before use the results of the C program will be incorrect. Tis is an example of a logic error.

- 3.6 Choosing a sentinel value that is also a legitamate/acceptable data value.

- 3.7 An attempt to divide by zero is a fatal error.

- 3.8 Using precision in a conversion specification in the format control string of a scanf statement is wrong. Precisions are used only in printf conversion specifications.

- 3.9 Using floating-point numbers in a manner that assumes they are represented precisely can lead to incorrect results. Floating-point numbers are represented only approximately by most computers.

- 3.10

- 3.11

- 3.12

- 3.13

- 3.14

- 3.15

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Error Prevention Tip

- 3.1 Typing the beginning and ending braces of compound statements before typing the individual statments within the block(braces), helps avoid omitting one or more of the braces, preventing syntax errors and logic errors (where both braces are indeed required).

- 3.2 Initialize all counters and totals.

- 3.3 Do not compare floating-point values for equality.

-

-

-

-

-

-

-

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Performance Tip

- 1.1 Using standard C functions instead of writing your own comparable versions can improve program performance, because these functions are carefully written to perform efficiently.

- 3.1 Initializing variables when they are defined can help reduce a program's execution time.

- 3.2 Many of the preformance tips we mention in this text result in nominal improvements, so the reader may be tempted to ignore them. Note that the cumulative effect of all these performace enhancements can make a program perform significantly faster. Also, significant improvement is realised when a supposedly nominal improvement is placed in a loop that may repeat a large number of times.

-

-

-

-

-

-

-

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Portability Tip

- 1.1 Because C is a hardware-independent, widely available language, applications written in C can run with little or no modification on a wide range of different computer systems.

- 1.2 Using standard C functions instead of writing your own comparable versions can improve program portability, because these functions are used in virtually all Standard C implementations.

- 1.3 Although it is possible to write portable programs, there are many problems between different C compilers and different computers that make portability difficult to achieve. Simply writing programs in C does not ensure portability. The programmer will often need to deal directly with complex computer variations.

- 2.1 Use identifiers of 31 or fewer characters. This helps ensure portability and can avoid some subtle programming errors.

-

-

-

-

-

- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Software Engineering Observation

- 1.1 Read the manuals for the version of C you are using. Reference these manuals frequently to be sure you are aware of the rich collections of C features and that you are using those features correctly.

- 1.2 Your computer and compiler are good teachers. If you are not sure of how a feature of C works, write a sample program with that feature, compile and run the program to see what happens.

- 3.1 A compound statement can be placed anywhere in a program where a single statement can be placed.

- 3.2 Just as a compound statement can be placed anywhere a single selection statement can be placed, it is also possible to have no statement at all, e.g. an empty statement. The empty statement is represented by placing a semicolon where a statement would normally be.

- 3.3 Each refinement, as well as the top itself, is a complete specification of the algorithmn; only the level of detail varies

- 3.4 Many programs can be divided logically into three phases: an initialization phase that initializes the program variables; a processing phase that inputs data values and adjusts program variables accordingly; and a termination phase that calculates and prints the final results.

- 3.5 You terminate the top-down, stepwise refinement when the pseudocode algorithm is specified in sufficient detail for you to be able to convert the pseudocode to C. Implementing the C program is then normally straightfoward.

- 3.6 Experience has shown that the most difficult part of solving a C problem on a computer is developing the algorithm for the solution. Once a correct algorithm has been specified, the process of producing a working C program is normally straightfoward.

- 3.7 Many programmers write programs without ever using program development tools such as psuedocode. The feel that their ultimate goal is to solve the problem on a computer and that writing pseudoocode merely delays the production of final outputs.

- 3.8

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

ch3selfExRev3point8.c
- Raise x to the y power

ch3selfExRev.txt
3.1 FITB

a) A procedure for solving a problem in terms of the actions to be executed and the order in which the actions should be executed is called an __algorithm__. (p.63)

b) Specifying the execution order of statements by the computer is called __program control__. (p. 64)

c) All programs can be written in terms of three types of control statements: __Sequence Structure__, __Selection Structure__, and __Repetition Structure__. (p. 65)

d) The __if...else__ selection statement is used to execute one action when the statement is true and another action when that condition is false. (p. 68)

e) Several Statements grouped together in braces ({ and }) are called a __compound statement or a block__. (p. 70)

f) The __while__ repetition statement specifies specifies that statement or group of statements is to be executed repeatedly while some condition remains true. (p. 71)

g) Repetition of a set of instructions a specific number of times is called __counter-controlled repetition__.

h) when it is not known in advance how many times a set of statements will be repeated, a __sentinel value__ can be used to terminate the repetition.

3.2 Write four C statments that each add 1 to integer variable x.

x = x + 1; (arithmetic) x += 1;   (comp arithmetic) ++x;      (preincrement) x++;      (postincrement)

3.3 Write a Single C Statement to accomplish each of the following.

a) Assign the sum of x and y to z and increment the value of x by 1 after the calculation.

z = x++ + y;

b) Multiple the variable product by 2 using the *= operator.

product *= 2;

c) Multiple the variable product by 2 using the = and * operators.

product = product * 2;

d) Test if the value of the variable count is greater than 10. If it is print "Count is greater than 10".

if ( count > 10 ){ printf( "Count is greater than 10\n" ); }

e) Decrement the variable x by 1, then subtract it from the variable total.

total = total - --x;

total -= --x;

f) Add the variable x to the variable total then decrement by 1.

total = total + x--;

total += x--;

g) Calculate the remainder after q is divided by divisor and assign the result to q. Write this is two different ways.

q = q % divisor;

q %= divisor;

h) Print the value 123.4567 with 2 digits of precision. What value is printed?

printf( "%.2f", 123.4567 ); output| 123.46 |

j) Print the floating point value 3.14159 with three digits to the right of the decimal point.

printf( "%.3f", 3.14159 );

output| 3.142 |

3.4 Write a C statement to perform each of the following tasks.

a) Define variables sum and x to be of type int.

int sum, x;

b) Initialize variable x to 1.

x = 1;

c) Initialize variable sum to 0.

sum = 0;

d) Add variable x to variable sum and assign the result to variable sum.

sum += x;

e) Print "The sum is: " followed by the value of sum.

printf( "The sum is: %d", sum );

3.5 Combine the statements that you wrote in exercise 3.4 into a program that calculates the sum of the integers 1 to 10. |_ Use the while repetition statement to loop through the caluclation and increment statements. |_ The loop should terminate when the value of x becomes 11.

*See file selfExRev3point5.c for full code.

3.6 Determine the values of variables product and x after the following calculation is performed. |_ Assume that product and x each have a value of 5 when the statement begins executing.

int product = 5; int x = 5;

product *= x++; ||OR|| product = product * x++;

final values| variable x = 6 | variable product = 25 |

3.7 Write single C statements that

a) Input integer variable x with scanf.

scanf( "%d", &x );

b) Input integer variable y with scanf.

scanf( "%d", &y );

c) Initialize integer variable i to 1.

int i = 1;

d) Initialize integer variable power to 1.

int power = 1;

e) Multiply variable power by x and assign the result to power.

power *= x;

f) increment variable i by 1.

++i;

g) Test i to see if it is less than or equal to y in the condidtion of a while statement.

while ( i <= y ){ }

h) Output integer variable power with printf.

printf( "%d", power );

3.8 Write a C program that uses the statements in exercise 3.7 to calculate x raised to the y power. (power of y?) |_ The program should have a while repetition control statement.

See file selfExRev3point8.c for full code.

3.9 Identify and correct the errors in each of the following:

a) Missing the closing bracket of the compound statement.

while ( c <= 5 ) { product *= c;     ++c; }

b) Precisions are only used in printf statements.

scanf( "%.4f", &value );

| SHOULD BE |

scanf( "%f", &value );

| OR |

printf( "%.4f", value );

c) By placing a semicolon immediatley after the condition in a if or else statement causes the condition to lead to an empty statement.  |_ By succeeding a condition of an if statement with a semicolon causes the condition to have no statement or an empty statement.

if ( gender == 1 ) printf ( "Woman\n" ); else; printf( "Man\n" );

| SHOULD BE |

if ( gender == 1 ) { printf( "Woman\n" ); }  else { printf( "Man\n" ); }

3.10 What is wrong with the following while repetition statement which is supposed to calculate the sum of the integers from 100 down to 1. |_ (assume z has a value of 100)

while ( z >= 0 ) sum += z;

| SHOULD BE |

while ( z >= 1 ) { sum += z--; }

ch3selfEx3point13pseudocode.txt
/* ch3selfEx3point13pseudocode.txt */

declare variable int x and initilaize to 1 declare variable int total and initialize to 0 declare variable int y

while x is less than or equal to  variable y gets variable x multiplied by variable x   print value of variable y   add y to total increment x by 1

print value of total

ch3selfEx.txt
3.11 Identify and correct the errors in each of the following. |_ Note: There may be more than one error in each piece of code.

a) Remove the Semicolon that immediatley follows the condition of the if.   |_ Why? If not both printf statements will execute regardless.

if ( age >= 65 ); printf( "Age is greater than or equal to 65\n" ); else printf( "Age is less than 65\n" );

| SHOULD BE |

if ( age >= 65 ) { printf( "Age is greater than or equal to 65\n" ); }  else { printf( "Age is less than 65\n" ); }

b) Variable total should be declared/defined seperatley from variable x as variable x is also being initialized not just declared/defined.

int x = 1, total;

while ( x <= 10 ) { total += x;     ++x; }

| SHOULD BE |

int x = 1; int total;

while ( x <=10 ) { total += x;     ++x; }

c) Immediatley following the condition of the while statement should be a { to indicate the beginning of the compound statement   |_ and a } after the statement in which x is incremented by 1 to indicate the end of the compound statement.

while ( x <= 100 ) total += x;     ++x;

| SHOULD BE |

while ( x <= 100 ) { total += x;     ++x; }

d) The following will result in an infinite loop as y is incremented by 1 in each loop (unless y is initialized to a negative number).  |_ Which means the value of variable y will always be greater than 0.

while ( y > 0 ) { printf( "%d\n", y); ++y; }

| SHOULD BE |

while ( y > 0 ) { printf( "%d\n", y); ++y; }

3.12 FITB

a) The solution to any problem involves performing a series of actions in a specific __order__.

b) A synonym for procedure is __algorithm__ or __routine__.

c) A variable that accumulates the sum of several numbers is a(n) __total__.

d) The proccess of setting certain variables to specific values at the beginning of a program is called __initializing__.

e) A special value used to indicate the "end of data entry" is called a __sentinel value__, a __signal value__, a __flag value__, and a __dummy value__.

f) A __flowchart__ is a graphical representation of an algorithm.

g) In a flowchart, the order in which the steps should be performed is indicated by __flowline__ symbols.

h) The termination symbol indicates the __start__ and __finish__ or the __beginning__ and __ending__ of every algorithm.

i) Rectangle symbols correspond to calculations that are normally performed by __action__ statements   |_ and input/output operations that are normally performed by calls to the __printf__ and __scanf__ STD Lib functions.

j) The item written inside the decision symbol is called an __expression__ (such as a condition, that can be either true or false).

3.13 What does the following program print?

*See file selfExRev3point13.c for full code.

3.14 Write a single pseudocode statement that indicates each of the following.

a) Display the message "Enter Two Numbers"/

Print "Enter Two Numbers"

b) Assign the sum of variable y, x and z to p.

Set p to the sum of x, y and z

c) The following condidtion is to be tested in and if...else selection statement.   |_ The current value of variable m is greater than twice the current value of variable v.

set v2 to v multiplied by 2 if m is greater than v2     Print "M is greater than twice the value of V"   else Print "M is less than twice the value of V"

d) The proccess of setting certain variables to specific values at the beginning of a program is called __initializing__.

e) A special value used to indicate the "end of data entry" is called a __sentinel value__, a __signal value__, a __flag value__, and a __dummy value__.

f) A __flowchart__ is a graphical representation of an algorithm.

g) In a flowchart, the order in which the steps should be performed is indicated by __flowline__ symbols.

h) The termination symbol indicates the __start__ and __finish__ or the __beginning__ and __ending__ of every algorithm.

i) Rectangle symbols correspond to calculations that are normally performed by __action__ statements   |_ and input/output operations that are normally performed by calls to the __printf__ and __scanf__ STD Lib functions.

j) The item written inside the decision symbol is called an __expression__ (such as a condition, that can be either true or false).

3.13 What does the following program print?

*See file selfExRev3point13.c for full code. 3.14 Write a single pseudocode statement that indicates each of the following.

a) Display the message "Enter Two Numbers"/

Print "Enter Two Numbers"

b) Assign the sum of variable y, x and z to p.

Set p to the sum of x, y and z

c) The following condidtion is to be tested in and if...else selection statement.   |_ The current value of variable m is greater than twice the current value of variable v.

set v2 to v multiplied by 2 if m is greater than v multiplied by 2 Print "M is greater than twice the value of V"  else Print "M is less than twice the value of V"

d) Obtain values for variables s, r, and t, from the keyboard.

input variables s, r, and t

3.15 Fomulate a pseudocode algorithm for each of the following

a) Obtain two numbers from the keyboard, compute the sum of the numbers.

define variables input numbers calculate/compute and print the sum of x and y

============================

define variable int x  define variable int y

define and initialize variable int sum to 0

input the first number assign to variable x  input the second number assign to variable y

set variable sum to the sum of x and y  print variable sum

b) Obtain two numbers from the keyboard, and determine and display which (if either) is the larger of the two numbers.

define variables input variables determine and print which number (if either) is larger

============================

define variable int x  define variable int y   define and initialize variable int largest

input the first number and assign to variable x  input the second number and assign to variable y

if variable x is greater than variable y     print "x is larger" else if variable y is greater than variable x     print "y is larger" else print "x is equal to y"

============================

purpose
calculate miles per gallon for each tankful and then for all tankfuls combined

first refinement
init variables obtain the miles driven and gallons consumed for each tankful calculate and display the miles per gallon for each tankful calcluate and display the average miles per gallon for all tankfuls combined

second refinement
init var int miles to zero init var int gallons to zero

init var int milesCounter to zero init var int gallonsCounter zero init var float milesPerGal to zero

init var float totalAverage to zero

while user has not indicated end of data entry (-1) obtain miles driven and assign to miles increase milesCounter by miles

obtain gallons consumed and assign to gallons increase gallonsCounter by gallons

divide miles by gallons then assign to milesPerGal print milesPerGal

divide milesCounter by gallonsCounter then assign to totalAverage print totalAverage

see full code ch3selfEx3point17.c
/* ch3selfEx3point17nofloat.c ver1.0 calculate miles per gallon for each tankful and then for all tankfuls combined */


 * 1) include

int main( void ) {

int miles = 0, gallons = 0; int milesCounter = 0, gallonsCounter = 0; int counter = 0;

int milesPerGal = 0; int totalAverage = 0; while ( miles != -1 ) { printf ( "Enter miles driven, use -1 to finish: " ); scanf ( "%d", &miles );

milesCounter += miles;

printf ( "Enter gallons consumed: " ); scanf ( "%d", &gallons " );

gallonsCounter += gallons;

counter += 1;

milesPerGal = miles / gallons;

printf( "The Miles Per Gallon for this tankful was: %d\n", milesPerGal ); }

totalAverage = milesCounter / gallonsCounter;

printf( "The total miles per gallon for all tankfuls was: %d\n", totalAverage );

return 0;

}

Italic text==== ch4... ==== n

LINKS
http://www.w3schools.com/cssref/default.asp http://w3schools.invisionzone.com/index.php?showtopic=6826\ http://qrfree.kaywa.com/?l=1&s=8&d=http%3A%2F%2Fxdbase.dlinkddns.com http://qrfree.kaywa.com/?l=1&s=8&d=NON+DEPHECTIVE http://stackoverflow.com/questions/2208933/how-do-i-force-a-favicon-refresh

http://www.exclamationsoft.com/exclamationsoft/netmailbot/help/website/HowToFindTheSMTPMailServerForAnEmailAddress.html http://www.sans.org/reading_room/whitepapers/auditing/simple-windows-batch-scripting-intrusion-discovery_33193 http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/batch.mspx?mfr=true http://windowsxp.mvps.org/admins.htm http://wiki.pcworld.com/index.php/How_to_get_into_administrator_account_in_XP_when_you_have_lost_the_password_%3F http://tinybuddha.com/blog/10-tips-to-overcome-negative-thoughts-positive-thinking-made-easy/ http://support.microsoft.com/kb/192806 http://stackoverflow.com/questions/6566835/algorithm-to-check-if-a-number-if-a-perfect-number http://www.rhymezone.com/r/rhyme.cgi?Word=synonymous http://ping.eu/ns-whois http://www.pcruneasy.com/run-commands.php http://mypchell.com/guides/34-guides/69-156-useful-run-commands http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true http://lifehacker.com/5674972/how-to-break-into-a-windows-pc-and-prevent-it-from-happening-to-you http://lifehacker.com/256474/pipe-commands-to-cmdexe-with-switches http://www.joycemeyer.org/articles/ea.aspx?article=how_to_enjoy_life_despite_your_circumstances http://www.jeffwu.net/?p=252 http://www.helpguide.org/life/improving_memory.htm http://foliovision.com/seo-tools/computers/windows/xp-run-commands http://www.ecdl.org/programmes/index.jsp?p=102&n=108&a=0 http://www.certiport.com/PORTAL/desktopdefault.aspx?tabid=669&roleid=101 http://www.mayland.edu/aca111/StudyHabits.pdf http://www.heretohelp.bc.ca/factsheet/cutting-back-or-quitting-using-cannabis

SELF HELP STUFF

 * Find Your Purpose

GRAPHIC DESIGN

 * FB BANNER TIPS
 * DK LARGE

STUDY INFO

 * Study Habits

COMP TIA

 * STRATA OBJ

DOWS

 * pipeCMD
 * CMD Reference
 * Run Commands
 * Sony Windows Shortcuts

Books

 * 1,2,3 Infinity PDF
 * DECISIONS

CCode

 * BLAZING HOW TO PROG C 6
 * Resource Center
 * pearsonhigerEdDeitelBooks
 * ReferenceCards
 * cRefCard
 * IBM HelpCenter
 * GNU C Manual

General Music

 * soundwaves
 * HowSoundWorks
 * WikiSound

Sheet Music

 * musicCounter
 * how2ReadSheetMusic
 * WikiMusicNote
 * WikiNoteValue

Keyboard Piano Stuff

 * How2MakeAPianoSing

DAW Warez

 * FL How To: Use FL Studio BasicWorkflow
 * FLStudioRedesign
 * FLShortcuts

Vinyl Records/ DJ Stuff

 * forLifeVol1
 * forLifeVol2
 * how to clean records
 * stantonDJGuide
 * topDjGear
 * sterioIO adapter

9v Adapters

 * theSource MultiAdapter
 * theSource 9AV adapter
 * mAudio9VAC
 * m212 StantonDE Manual

Art

 * MikeShinoda

SCREEN/ TERMINAL STUFF

 * SCREEN
 * SCREEN QUICK REF
 * CW
 * ARCH
 * ARCH BANG
 * LUNCHBOX
 * DISTROWATCH
 * FREENODE
 * GNU SCREEN
 * GNU SCREEN MANUAL
 * GNU SCREEN MANUAL
 * OPENBOX
 * SCREEN HOW TO
 * SCREEN
 * apple keyboard ubuntu
 * ADDEDBYTES
 * USEFULL SHORTCUTS
 * COLOR PICKER
 * QuoteGIF1
 * QuoteGif2