 ---------- ---------- ## INTRODUCTION TO PROGRAMMING I am collating my study notes as part of my education into Computer Programming. In an attempt to increase and improve my own learning, and to help others also (learn by teaching) I will be sharing my notes, as neatly presented as possible, for others to follow along with if they so wish. This is Lesson 4's notes. ---------- EARLIER LESSONS [Lesson 1 Notes](https://steemit.com/education/@humate/introduction-to-computer-programming) [Lesson 2 Notes](https://steemit.com/education/@humate/introduction-to-computer-programming-part-2) [Lesson 3 Notes](https://steemit.com/education/@humate/introduction-to-computer-programming-part-3) ----------  ---------- ### INTRODUCTION TO COMPUTER PROGRAMMING – STUDY NOTES **LESSON 4** ---------- **CONTROL FLOW** Control Flow = creating an order in which statements will be executed in a program. Conditional Statements = tells the program to do a certain action if a condition is met. The below are examples of conditional statements. ---------- **IF STATEMENT** if(true) { do this } If the statement is [true] then execute the code [do this] ---------- Example of C++ code utilising the *if* statement.  ---------- **IF ELSE STATEMENT** if(true) { do this } else { do this instead } If statement is [true] then execute the code [do this]. Otherwise execute the second code [do this instead] Defensive programming = offer the else statement to allow for possible issues. LINK: [Defensive Programming](https://en.wikipedia.org/wiki/Defensive_programming) ---------- Example of C++ code utilising the *if...else* statement.  ---------- **IF THEN STATEMENT** if(true) { do this } else if(true) { do this instead } else { just do this } If statement is [true] then execute the code [do this]. If it's not true then check another statement [else] and see if that one is [true]. If it is then execute it's code [do this instead]. There can be more of them to follow. In the above example it is just two. If neither of them is true, then execute the last code [just do this]. ---------- Example of C++ code utilising the *if...then* statement.  Second example of C++ code utilising the *if...then* statement.  ---------- **RECAP OF LESSON 1, 2 AND 3** In **Lesson 1** we briefly looked at: - What is a programming language? - Language Types – especially HIGH Level and LOW Level. - Compiled vs Interpreted Languages - Data Types: Strongly Typed vs Weakly Typed Languages. - Data Types: The most common data types (characters, integers, floating-point, fixed-point, boolean, reference). In **Lesson 2** we looked briefly looked at: - Variables - Constants These both flow on from Data Types and work with these. In **Lesson 3** we looked briefly at: - Operators Used to allow operations (such as multiplication) to be performed on variables or constants. ----------  ---------- **FURTHER DATA** [cpp.sh](cpp.sh) - C++ shell website Scratchpad - Shift + F4 on Firefox - Javascript shell [Dev C++](https://sourceforge.net/projects/orwelldevcpp/) - A free, portable, fast and simple C/C++ IDE [Code::Blocks](http://www.codeblocks.org/) - A free C, C++ and Fortran IDE [Ideone](https://ideone.com/) - an online compiler and debugging tool which allows youto compile source code and execute it online in more than 60 programming languages. ---------- My Posts [Introduction From a Newbie Programmer](https://steemit.com/introduceyourself/@humate/introduction-from-a-newbie-programmer) and [Intro - part 2](https://steemit.com/introduceyourself/@humate/my-introduction-part-2) [Introduction to Computer Programming - part 1](https://steemit.com/education/@humate/introduction-to-computer-programming) (Lesson 1) [Introduction to Computer Programming - part 2](https://steemit.com/education/@humate/introduction-to-computer-programming-part-2) (Lesson 2) [Introduction to Computer Programming - part 3](https://steemit.com/education/@humate/introduction-to-computer-programming-part-3) (Lesson 3) ---------- Images from unsplash.com. I welcome new [followers](https://steemit.com/@humate), and thank you for your upvotes and comments. 
author | humate |
---|---|
permlink | introduction-to-computer-programming-part-4 |
category | education |
json_metadata | {"tags":["education","howto","steemiteducation","technology","teamaustralia"],"image":["https://steemit-production-imageproxy-thumbnail.s3.amazonaws.com/U5drcG3vrppf3JtWrsGUfp8VkX29tCq_1680x8400","https://steemit-production-imageproxy-thumbnail.s3.amazonaws.com/U5drtM9Qos9WMkJj6w1DoVNDSLa3C2C_1680x8400","https://image.ibb.co/bRVGzG/if_statement.jpg\"","https://image.ibb.co/hs7JDb/if_then_statement.jpg","https://image.ibb.co/kwX76w/If_then_statement_2.jpg","https://image.ibb.co/iQU9KG/if_then_statement_3.jpg","https://steemit-production-imageproxy-thumbnail.s3.amazonaws.com/U5dsT9d5jbweoK8z1LMpCpf62x6uPhp_1680x8400","https://steemit-production-imageproxy-thumbnail.s3.amazonaws.com/U5dquXPi98PpoLFfPH1PWfms98r4u97_1680x8400"],"links":["https://steemit.com/education/@humate/introduction-to-computer-programming","https://steemit.com/education/@humate/introduction-to-computer-programming-part-2","https://steemit.com/education/@humate/introduction-to-computer-programming-part-3","https://en.wikipedia.org/wiki/Defensive_programming","cpp.sh","https://sourceforge.net/projects/orwelldevcpp/","http://www.codeblocks.org/","https://ideone.com/","https://steemit.com/introduceyourself/@humate/introduction-from-a-newbie-programmer","https://steemit.com/introduceyourself/@humate/my-introduction-part-2","https://steemit.com/@humate"],"app":"steemit/0.1","format":"markdown"} |
created | 2018-01-20 04:44:33 |
last_update | 2018-01-26 22:55:33 |
depth | 0 |
children | 1 |
last_payout | 2018-01-27 04:44:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 2.446 HBD |
curator_payout_value | 0.492 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 5,183 |
author_reputation | 107,931,380,458 |
root_title | "Introduction to Computer Programming - part 4" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,781,745 |
net_rshares | 258,417,441,963 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
christoryan | 0 | 174,897,715 | 1% | ||
ausbitbank | 0 | 166,151,924,931 | 1% | ||
edrivegom | 0 | 112,631,605 | 0.1% | ||
gomeravibz | 0 | 2,015,196,019 | 0.6% | ||
stephen.king989 | 0 | 1,048,546,698 | 0.2% | ||
naquoya | 0 | 22,158,758,273 | 100% | ||
jhermanbeans | 0 | 333,087,744 | 0.1% | ||
steemprentice | 0 | 1,149,458,000 | 0.1% | ||
naq1 | 0 | 777,581,455 | 100% | ||
pomperipossa | 0 | 319,309,343 | 0.1% | ||
humate | 0 | 489,387,783 | 100% | ||
sixexgames | 0 | 69,674,098 | 1% | ||
numpypython | 0 | 170,366,938 | 0.1% | ||
looftee | 0 | 296,113,243 | 0.1% | ||
decibel | 0 | 139,840,912 | 0.5% | ||
gindor | 0 | 221,231,118 | 0.2% | ||
qwasert | 0 | 116,309,875 | 0.2% | ||
cryptohustler | 0 | 185,568,603 | 1% | ||
minnowsupport | 0 | 17,850,479,953 | 1% | ||
crypto-learnings | 0 | 249,017,489 | 100% | ||
teamaustralia | 0 | 3,665,311,853 | 9% | ||
centerlink | 0 | 36,521,843,556 | 10% | ||
myday | 0 | 166,189,650 | 0.1% | ||
gamerveda | 0 | 703,940,793 | 0.5% | ||
jonknight | 0 | 52,002,610 | 0.1% | ||
alanzheng | 0 | 53,086,667 | 2% | ||
blinkybill | 0 | 3,225,685,039 | 100% |
<p>Congratulations! This post has been upvoted from the communal account, @minnowsupport, by humate from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the <a href="https://discord.gg/HYj4yvw"> Peace, Abundance, and Liberty Network (PALnet) Discord Channel</a>. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.</p> <p>If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=102530.639667%20VESTS">50SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=205303.639667%20VESTS">100SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=514303.639667%20VESTS">250SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=1025303.639667%20VESTS">500SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=2053030.639667%20VESTS">1000SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=minnowsupport&vesting_shares=10253030.639667%20VESTS">5000SP</a>. <br><strong>Be sure to leave at least 50SP undelegated on your account.</strong></p>
author | minnowsupport |
---|---|
permlink | re-introduction-to-computer-programming-part-4-20180120t070921 |
category | education |
json_metadata | "" |
created | 2018-01-20 07:09:21 |
last_update | 2018-01-20 07:09:21 |
depth | 1 |
children | 0 |
last_payout | 2018-01-27 07:09:21 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,702 |
author_reputation | 148,902,805,319,183 |
root_title | "Introduction to Computer Programming - part 4" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,802,864 |
net_rshares | 489,387,783 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
humate | 0 | 489,387,783 | 100% |