0% found this document useful (0 votes)
180 views148 pages

Coding Programing User Manual Ed22 2024

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
180 views148 pages

Coding Programing User Manual Ed22 2024

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
Papercut’s June \ dune 2024 edition edition Coding & Programming USER MANUAL -~<\\ DIGITAL MAGAZINE DOWNLOAD Worth £9.99 See inside for details Discover more about the most popular coding languages in the world mam Aol tas Learn new coding skills Professional tricks, with Python, Linux, C++ ss tips and step-by-step and Raspberry Pi tutorials + projects 100% INDEPENDENT Don’t miss our essential tech {USER} Magazines Packed with exclusive tutorials, tricks & tips! Available now on em p MORE THAN CODE For those of you old enough to remember the ‘80s, the golden era of home computing, the world of computing was a very different scene to how it is today. Bbit computers that you could purchase as a whole, as opposed to being in kt Form and you having to solder the parts together, were the stuff (of dreams; and getting your hands on one was sheer bliss contained within a large plastic box. However, it wasn't so much the new technology that computers then offered, moreover it was the fact that forthe first time ‘ever, you could control what was being viewed on the ‘television Instead of simply laying one ofthe thousands of games available atthe time, many users decided they wanted to create their own content, their ‘own games; or simply something that could help them with their homework ‘or home Finances. The simplicity ofthe 8-bit home computer meant that creating something from a few lines of BASIC code was achievable and so the First generation of home-bred programmer was born, From that point on, programming expanded exponentially. It wasnt long before the bedroom coder was a thing ofthe past and huge teams of designers, coders, artists and musicians were involvedin making asingle ‘game. This of course led to the programmer becoming more than simply ‘someone who could Fashion a sprite on the screen and make it move atthe press of akey. "Naturally time has moved on and with t the technology that we use. However, the fundamentals of programming remain the same; but what exactly does it take to be a programmer? The single most common trait of any programmer, regardless of what they're doing isthe ability to see a logical pattern. By this we mean ‘someone who can logically Follow something fram star to finish and envisage the intended outcome. While you may not feel you're such a person, itis possible to train your brain into this way of thinking. Yes, it takes time but once you start to think in this particular way you will be able to construct and follow code. ‘Second to logicis an understanding of mathematics. You don't have to be ‘at agenius evel but you do need to understand the rudiments of maths ‘Maths is all about being able to solve a problem and code mostly falls under the umbrella of mathematics, Being able to see the big picture is certainly beneficial for the modern programmer. Undoubtedly, as a programmer, you willbe part of ateam (of other programmers, and more than likely part of an even bigger team (of designers, all of whom are creating a final product. While you may only bbe expected to create a small element ofthat final product, being able to understand what everyone else is doing willhelp you create something that's ultimately better than simply being locked in your own coding cubicle Finally, there's also level of creativity needed to be a good programmer. ‘Againthough, you don't need to be a creative genius, just have the imagination to be able to see the end product and how the user will interact with it. ‘There is oF course alot more involved in being a programmer, including learning the actual code itself: However, with time, patience and the determination to learn, anyone can become a programmer. Whether you want to be part ofa triple-A video game team or simply create an ‘automated routine to make your computing life easier, i's up to you how far to take your coding adventure! ——— A Brief History of Coding It’s easy to think that programming a machine to automate a process or calculate a value ee Tore eo es ae le Coal COREE A Ae eo CA that assumption is quite wrong, coding has actually been around for quite some time. OTTO MMMM RCM R RTO Essentially all forms of coding are made up of ones and zeros, on Or off states. This works for a modern computer Ber St atari nc ace 850 Al 1842-1843 eRe an ec Pere eet) Peed fener ty ey ay eens eae! preierete et ec See cues Sree es Scere eee ee ee ened Renee Rte aci) punched holes to create the textile design. Sea a design on a previous automated weaving ‘Ada Lovelace translated eee Deu ae! ‘Maneclang, regarding ees eerie made copious notes Se eee eo Cea Pa tg t i Pee Sea ete es \N. C Crea) Peete ety parece Pen eer cet f a errata ee a tydro-powered organ that played r | Peres Eee eres to ee cet core Pe cat Ce cence! Re) Sete eee ed Peer aaah ee cad Pea er eee ed renee array cee cs Reeser reas 1951-1958 Se roc eer ae Dee ets Oa Stead Peete SE Ree rere the generic term Autocode. Soon meet ram) Perrot el Ceo em nas Cee eects ee ey developed a compiler Forit.intime, Pee rere cea [eek eo eee ere eu teara ts stilin use today. Reus ne ee aD Classes (C+), MATLAB, Common Lisp and more came to the ee es eee eee ee ec MIC Na era cr Cee Serta! ee eau mainly utised by universities, Cee Se Ee ares toward amore userfriendly, ‘or home user language, was Reo (Crean ee aestes aces! Deere ey Ce er) Pie reece eer) knowledge needed to learn coding in 2 cee eet hhow to code but they could freely share ogee eee ee Ces ED Ala 7 a! Choosing a Programming Language It would be impossible to properly explain every programming language in a single book of this size. New languages and ways in which to ‘talk’ to a computer mel Tle Fale esa alae to 1K UL Te) TN ls telelUnleis CLUE RLS eeea Mental complex methods are being born. Here eM eel Mee Reo R Cle tte ( cy £ along with their key features. | es Tals Cd aS) Ra Ee fe} a See aE et tae te ance ns Cer eee Cee meno) (American National Standards Institute) standard, there are different versions of Cea ene Cee eat Se LCE aad JavaScript (often shortened to JS) sa lightweight, einer ieee ee teensy rere arene ee ee ete eT) ‘program how the web pages behave on the occurrence of an event. JavaScript is {an easy to learn and also powerful scripting language, widely used for controling reece eri Se aR ey sr application and isthe global standard for developing enterprise software, web-based content, games and mobile apps. The two main components Creer ee ea ee aoe es Java Virtual Machine (JVM) that translates Java code into machine language. og Cee eer ee) Dee ee ee eas Fae te ere een ee client server applications, database applications and much more. The curiy-brace syntax of C# will be instantly recognisable to anyone familiar with C, C++ or Java, cae Pee te et emer) for general purpose programming, created by Guido van ee eee cet philosophy that emphasises code readability and a syntax that allows programmers to express concepts in Fewer lines of code. This can make it easier for new Secs Qe ee te Leon ca language. It has imperative, object-oriented and generic programming Features. It was designed with a bias toward system programming and embedded, resource-constrained and large systems, with performance, efficiency and Flexibility of use asits design highlights ee eee gee em era ‘Matsumoto, blended parts of his favourite languages (Per, Smalltalk, Eifel, Ada and Lisp) to Form a new language. From its release in 1995, Ruby has Eee eee Pen eee ae stent eee) Perlis a general purpose programming language, used fora wide ae oer aes ‘network programming, GUI development and more. Its major Features are that i's eet eet ore tre ects oon a ea powerful builtin support for text processing and has one ofthe most impressive escorts Cee era eee 10S, watchOS and tvOS. Writing Swift code is interactive and Fun; Pes ee ee Ee eed developers love. Swift code is safe by design, yet also produces software that runs Pee eae ee ee eee oT —— = Welcome, Future Coder Creating a Coding Platform ee ea cer rere pie eieenteiemnereor ming) eee ieee en ees ha heer nen ton et ears ai nicnapeinien. en ene pair eben gene piety Sree TET ERI Pee a ccaieeanee ‘iron datetine inport date, tinedel aoe cores hankfully, coding atthe ion level doesa you can begin to learn how to code. Naturally iFthe computer in question is Commodore 64 then youmay have some difficulty Following 3 modern language tutorial, But some of the best programmers around today started on an &bit machine, so there's hope yet ‘You will need access to the internet to download, install an update the coding development environment, alongside a computer with W an use ather operating jows 11, macOS, or Linux, installed, You stems, but these are the ‘big three" and you wil find that most code resources are written with one, or all, ofthese in mind, ‘w.pelpublictions om Ree ee er ete eenuercentic eee ee vere ee eee ee Sete eer ote Ss allalittletoo much at first. ‘The tricks to slow down and, to begin with, not look too deeply into coding, Like all good projects, you need a sold Foundation ‘on which to build your skillset and to have all the necessary tools Cees ans ead Pie ee eer ee et neta Foundation while Preeti neater In terms of software, ‘most of the development environments have the toals that allo code, compile nd install, There a tools available that will cost, but at this level they're no necessary, so don’tbe Fooled int thinking you need to purchase any extra sofoware in order to start learning howto code. (Over time, you may find yourself progressing from the mainstream development environment and using a collection ‘of your awn, discovered, tools to write your code. t's all personal preference in the end and as you become more experienced, you will tart to use different tools to get the job done. tos eu ‘Windows 11 isthe most widely used operating system in the ‘world, so i's natural thatthe vast majority of coding tools are written For Microsoft's leading operating system, However, don't discount macOS and especially Linux ? Eres Avitual machineisa piece of sofware thet allows you to installa Fully working operating system within the confines ofthe sofware sel. The installed OS wil allocate user-defined resources from the host computer, providing memory, hard drive space et, aswell as sharing the host computer's intemet connection. macO users enjoy an equal number of coding tools to their ‘windows counterparts. In Fact, you will probably find that a lot of professional caders use a Mac over aPC, simply because ‘of the fact that the Mac operating system is built on top of Unix (the commandline OS that powers much of the world’s filesystems and servers). Tis Unix ayer lets you test programs in almost ay language without using a specialised IDE. COLES However, Linux i, by far and away, one ofthe most popular and important coding operating systems avalable. Not only does it have a Unixclike backbone, it's also free to download, install and use and comes with most of the tools necessary to start learning how to code. Linux powers mast ofthe servers that make up the internet. t's used on nearlyallof the top supercomputers, as well as specifically in organisations such as NASA, CERN and the military, it also forms the base of ‘Android-powered devices, smart TVs and in-car systems. Linu, 35. coding platform, isan excellent idea andi can be installed inside a virtual machine without ever affecting the installation ‘of Windows or macOS. The advantage ofa virtual machine i that you can work with Linux, fr example, withoutit affecting your currently installed host OS. This means that you can have Windows 11 running and launch your virtual machine client, bootinto Linux and use all the Functionality of Linu, while stil being able to use Windows, “This, of course, makes it Fantastic coding platform, as you can have different installations of operating systems running from the host computer while using diferent coding languages. You can test your code without fear of breaking your host OS and it's easy to return to a previous configuration without the reed to reinstall everything again. Virtualisation isthe key to most big companies now. You will probably Find, rather than having a single server with an installation of Windows Server, For example, the IT team have instead opted fora virtualised environment whereby each Windows Server instance isa virtual machine running from several powerful machines. This cuts down on the number of physical machines, allows the team to better manage resources and enables them to deploy an entre server dedicated to a particular taskin a Fraction ofthe time. Baal IF you haven't already heard ofthe Raspberry Pi, then ‘we suggest you head over to www.raspberrypiorg and check tout. In short, the Raspberry Pisa smal, fully functional computer. tcomes with ts own customised, Linuxcbased operating system that's pre-installed with everything youneed to start learning how to code in Python, C++, Scratch and mare. YOUR OWN CODING PLATFORM ‘Whichever method you choose, remember that your coding platform will probably change, as you gain experience and. Favour one language over another. Don’t be afraid to experiment along the way, as you will eventually create your own unique platform that can handle all the code you enter into it. Costing around £35, it's incredibly cheap and allows you to utilise different hardware, n the Form (of robatics and electronics projects, aswell as offering a complete desktop ‘experience. Although not the most powerful ‘computing device in the world, the Raspberry PI has alot going frit, especially in terms of being one (of the best coding platforms available. os ieee 01110 1110001010110 11000: 101110:010100000110 t 01001 i r 00010 a) 11010 10 11000 00010 C++ C++ is an amazing programming language. Most of what you see in front of you when you power up your computer, regardless of whether you're using Windows, macOS or Linux, is created using C++. Being able to code in C++ will open a whole new world for you, in terms of desirable professional skills and the ability to code amazing apps and games. C++ is an efficient and powerful language that's used to develop operating systems, applications, games and Tal a aM oleMa ee RU Xe aCe Tae PRAT SUS FY education, the space industry, and much more. Learn more > ee ret =fd Sena miata} = o=g Eat ie sts s°ssss SISter reef fot ttt ttt faa i=} per Y FFT TTT Ter T-} EEE 8 ete TE et Peter retry ray er ere O-==000-00-— =5 EP Introducing C++ Why C++? eee tgs oC cc euter eae cic sce Men Polke kee ecom lene Rect ur Leesan em eek nasil” the original C language, and is a general purpose object-oriented (OOP) environment. C EVERYTHING Due to both the complexity of the language and its power and performance, C++ is often used to develop games, programs, device drivers, and even entire operating systems. Dating back to 1979, the start of the golden era of home computing, C++, oF rather Cwith Clases, was the brainchild of Danish computer scientist Bjarne Stroustrup, while working on his PRD, thesis Stroustrup’ plan wast Further the original C language, which had been widely used since the early seventies. C++ proved to be popular among the developers ofthe 80s, since it was a much easier environment wich which to getto grips, and, more importantly, e was 99% compatible withthe original C language. This meant that, beyond the mainstream computing labs, regular people who didn't have access to the mainframes and large computing data centres could use it C++simpactin the digital worldis immense. Many ofthe programs, ‘applications, games, and even operating systems are coded ++ code is much faster than other programming languages. using C++, For example all of Adobe's major applications, such as Photoshop, InDesign and so on, are developed in C+, You will find that the browser you use to surf the Internet is written in C++, a5, ‘well as Windows 11, Microsoft Office, and the backbone to Google's search engine, Apple's macOS fs written largely in C++ (with some. ‘other languages mixed in depending on the Function, and the likes. ‘oF NASA, SpaceX, and even CERN use C++ for various applications, programs, controls, and umpteen other computing tasks. ‘As wellas being an easier adaltion to the core Clanguage, C++is, ‘also extremely efficient and performs well across the board. This higher level of performance over other languages, such as Python, BBASIC and such, makes it an ideal development environment for modern computing; hence the aforementioned companies using it sowidely, summary ln Pte wh ~ Desitop deopmen with casey tne anne C++putsthe developer in a much wider world of coding. By improvements to the engine, or when creating a new game, iF ‘mastering C++, you wil find yourself being able to develop cade for _ the developers want to add something that the engine can't do, the kes of Microsoft, Apple and so.on, Generally, C++ developers they willuse Cxs tocreate the new content of link between two enjoy a higher salary than programmers of some otherlanguages, different engines. The end result, of course, is a game that contains and, due to its versatility the C++ programmer can move between the latest graphical technology, while being seamlessly bound jobs and companies without the need to re-learn anything specific. together with some pretty clever C++ coding, ‘You wil discover as you becomea more advanced coder, that many Getting to use C+ is quite easy, all you need isthe right et of tools, of the developers in variaus coding jobs araund the world tendto in which to communicate with the computer in C++, and you can Use pre-designed development engines. For example, when creating _ start your journey. A C++ IDE is free of charge, even the immensely ‘games, the likes of Bethesda, the team behind Oblivion and Skyrim, powerful Visual Studio From Microsoft is Freely avallable to utilise @ 30 game engine called The Creation Engine. Thisenables | download and use. You can get into C++ From any operating system, the team to quickly create animations, characters, tems, terrains, elit macOS, Linux, Windows, or even mobile platforms. rooms, and just about everything else you'd see inthe game. The. engine itselrhas been modified to make the most ofthe current _So, to answer the question of Why C+, the answer is because it’ Fast, ‘graphics card hardware, and computer or console processing efficient and developed by mast ofthe applications youregularly power. These engines are mastly written in C++, andwhen making use. I's cutting edge, and a fantastic language to have mastered, Indeed, the operating system you're using is written in C+. Mac ubuntu ompitiaiocon CE EP Introducing C++ ) C++ is one of the top programming languages in the industry. It's quick, powerful, and used by nearly every major tech and gaming company in the world. Here's some interesting facts about the rather wonderful C++. C++ is one of the predominant programming languages for the development of all kinds of technical and commercial software. NASA, CERN, MICROSOFT, ORACLE, PAYPAL, LINKEDIN, AMAZON AND THE MILITARY USE C++. (C++ IS USED FREQUENTLY JOC FT pe) C++ has (+e) IN ANIMATION PROCESSES. influenced other programming Chrpl 3D ANIMATION, languages, such as Gi hee MODELLING, C#f and Java. eS, iS AND SIMULATIONS S Alot of the Linux operating 0 system is coded BP sig C++, therefore 0 l you could say that most of the world’s Internet. hosting servers are available thanks to C++. SUPERCOMPUTING USES C++ CODE More than 70% of all TO CALCULATE VAST AMOUNTS OF trading is known as ze) S } DATA, INCLUDING THE NASA-BASED Priepinediesiel (HFT), and the software SUPERCOMPUTING FARM THAT RUNS responsible is written in C#+ to make use of its high speed. SIMULATIONS OF THE UNIVERSE. Sounb6bl SouresMebswah, ‘ooste, Quara, stack ‘Exchange, duc, a Stackoveriow, stockshore, ‘The Xbox Aopoynamies ‘operating system uses C+t asits backbone. ‘Many database applications are built using C+, such as MySQL, it's also used by Wikipedia, Yahoo and YouTube. Windows 95,98, 2000, XP,7,8:1, 10and 11 aswell as ‘Microsoft Office, use C++ ‘as the backbone programming language of choice. TU 3 atoll ci ef TECHNOLOGIES USE'C##, AS ae ADVANCED Nissin pTaiseailel Bye His used in computer networking as the Gaming is one of the biggest users of C++. Tthandles the complexities of 3D games, supports multiplayer options, and enables intensive CPU and GPU hardware Functions. main code behind the Most of Adobe's Programmable Logic PERCENTILE SALARY ais Sere Controller, connecting FOR A UK-BASED C++ ‘redeveloped servers, processors, other DEVELOPERIS| Sec hardware, and S se £120,000 MRI scanning oth Google Chrome, Mozila's Firefox, and even Microsoft's Edge web browsers are ‘coded in C+. A machines and Computer Aided Design The Unreal 4 Engine, all use C++ to help with which is coded in C++, the enhanced imagery is used for hundreds. produced by these ‘of games, including systems. Fortnite. FLIGHT CONTROL SYSTEMS IN MODERN AIRCRAFT, INCLUDING MILITARY AIRCRAFT, USE C++. wornpcipubtiationscon 3] EP Introducing C++ ) Equipment You Will Need Soiree Maen eu en aad eee ha don’t need an entire computing lab at your disposal either. Providing you have a fairly modern computer, everything else is Freely available. C++ SETUPS ‘As most, if not all, operating systems have C++ at their code, it stands to reason that you can learn to program in C++ no matter what OS you're currently using, COMPUTER Unless you fancy writing out your C++ code by hand on a sheet of paper (which is something many older coders used to do), then a computer is an absolute must have component. PC users can have any recent Linux distro or Windows OS, Macusers the latese macs, [J AN IDE ‘An IDE's used to enter and execute your C++ code, Many IDEs come with extensions and pluginsthat help make it work better, or add an extra level of Functionality. Often, an IDE will provide enhancements depending on the core OS being used, such as enhancements For Windows 11 COMPILER compiler isa program that converts the C++ language into binary that the computer can understand, While some IDEs come with a compiler builtin, others dont. Coder:8locks is our Favourite IDE that comes with a C++ compiler as part ofthe package. More on this later TEXT EDITOR ‘Some programmers much prefer to use a text editor to assemble thelr C++ code before running it through a compiler. Essentially, you can use any text editor to write code, just save itwith a.cpp extension, However, Notepad++ is one of the best code text editors available, INTERNET ACCESS. While it's entirely possible to learn how to code on a computer thats not attached tothe interne, it’s extraordinarily dificult You will need to instal the relevant, software, keep it up to date, install any extras or extensions, and look for help when coding, All of which require access to the Internet. TIME AND PATIENCE You're going to need to set aside significant time to spend on learninghow to code in C+ Sadly, unless you're a genius, it'snat going to happen overnight, or even in a = week. A good C++ coder has spent many years honing their craft, so be patient, start small and keep learning, OS SPECIFIC NEEDS C++ will work in any operating system; however, getting all the necessary pieces together can be confusing to a newcomer. Here's some OS specifics for C++. ri) WINDOWS ‘As we've mentioned previously, one good IDE is Microsoft's ‘Visual Studio. However, a better IDE and compilers. Code::Blocks, which s kept regularly up to date with a new release twice yearly, or so. Otherwise, Windows users can ‘enter their code in Notepad++ then compile it wth MinGW ~ which Code::Blacks uses Linux users are Lucky in that they already have a compiler and text editor butt into their operating system. Any text editor willalow you to type out your C+ cade, when it's saved with a cpp extension, use g++ to complet. Sa The Raspberry P's operating systems Raspberry PiOS, ‘which is Linux based, Therefore, you're ableto write yourcode ‘out using atext editor and then compileit with g++, as you would in any other Linux distro. ‘Mac owners wll need to download and install Xcode, inorderto compile their (C++ code natively, Other ‘options For the macoS include Netbeans, Eclipse or Code:Blocks. Note: the latest CoderBlocksisn’t available for Mac, due toe lackof Mac developers. —— ee Structure of C++ Code C++ is an amazing programming language to learn. IF your dream is to become a games designer, or work at the cutting edge of science or engineering technology, then being able to code in C++ is a must. Remember, you're never too old to learn how to code. #INCLUDE Theditectiveinstructsthe —_@"| *newcode.cpp preprocessor to inciudea section of thestandardci+ #include code. For example: FineLude ‘ includes the lostream header to support input/output operations INT MAIN() ’ 1emain( initiates the File Edit View Search Tools Documents Help declaration ofa Function, which {sa group of code statements under the name main. Al C++ code begins at the main function regardess of where _(¢)*newcode.cpp. ites thin the man body of the code. bower include int main() 1A, BRACES . *newcode.cpp(-/Documents) - Thecpenbncet ere something that you may. ee not have come across before, espedalyif you're used to other coding languages. The ‘open brace indicates the beginning of the main, Function, and contains allthe code belonging to that Function, COMMENTS Lines that begin with a double slash are comments. This means they won't be executed in the code and are ignored by the compiler, Why are they there? Comments are designed to help you, or another ‘programmer looking at your code, explain what's going on, There {are two types of comment: * covers multiple line comments, 2 singleline, a *newcode. using namespace std; int main) { 17 My first Cee progras COUT Inthis example we're using cout, which is apart ofthe Standard ‘Namespace —hence why its there, as youre asking C++ to useit from that particular namespace. Cout means Character OUTput, which clsplays, or prints, something to the screen. IF we leave std: out we have to declare itat the start ofthe code; as mentioned previously : *newcode.cpp (/Bocuments) Fle ESE Vem Search Tools Documents. Hep Aoale~/yoniag "nena cap include SRR csc tives coucansa pyre inthe new window, enter the Following Int main() 1 My ficat: Cee program sti ‘cout << “Hello World!\n"7 Notice how Code:Blocks auto-inserts the braces and speech quotes. FSTTSETRD ick File> Save as and save the code with a cpp extension (hellowarld.cpp, For example). Code:Blocks changes the view to colour code according to C++ standards, To execute the code click on the Build and Run icon ‘along the top of the screen l’sa green play icon together with 3 yellow cog. wmpictasocon CE EP Introducing C++ How to Set Up C++ ona Mac To begin C++ coding on a Mac you can use Apple's own developer platform: Xcode. This MMe hacen cal hersicacieena rice eee saa e also able to be used to create C++ code relatively easily. XCODE Apple's Xcode is primarily designed for users to develop apps for macOS, iOS, tvOS and watchOS applications in Swift or Objective-C, but we can use it for C++ too. FETTSERD 21tby opening the App Store on your Mac, Apple "Menu > App Store. nthe Search box enter Xcode, and press Return. There will be many suggestions filing the App ‘Store window, butt’ Fist option, Xcode, that you need to click on, * Results for "xcode” = PEPE DD) Take amomentto browse through the app's information, including the compatibility to ensure you have the correct version of macOS. Xcode requires macOS 10.12.6 or later to install and work ESTER When you're ready, click on the Get or cloud icon button which willinstall the Xcode app. Enter your ‘Apple ID, and Xcode wilbegin to download and instal. It may take ‘some time depending on the speed of your Intemet connection, as, Xcode is in excess of 1168. Results for "xcode" = PEP D when the installation is complete, click on the Open button to launch Xcode. Click Agree tothe licence terms, and enter your password to allow Xcode to make changes tothe system. When you've done that, Xcode will begin to install, ‘additional components g Xcode and IS SDK License Agreement Xcode and Apple SDKs Agreement ‘Bows oF vou coum OR OnsanON TO TERS With everything now installed, including the acitional components, Xcode wil launch displaying the version number along with three choices and any recent projects ‘that you've worked on although Fora Fresh instal this wile blank, Welcome to Xcode BS mrt ESTEE 2rtby cicking on Create New Xcode Project this opensa template window to choose which platform yout developing code For, Click the macOS tab, then cick the Command Line Tool option. Click Nextto continue STEP7 Fillin all the fields, but ensure that the Language ‘option at the bottom is set to C++. Simply choose it From the drop-down list. When you've fille inthe Fields, and ‘made sure that C++is the chosen language, click on the Next button to continue, BREED The next step asks where to create Git Repository forall your Future code. Choose a location on your Mac, a network location, and click the Create button. When you've done all that, you can start to code, The left-hand pane ‘details the files used in the C++ program you're coding, lick onthe ‘main.cpp file inthe lst FETED You will notice that Xcode has automatically completed a basic Hello World program For you. ‘The differences here are thatthe int main (function now contains multiple functions and the layout i sightly diferent. Thisisjust Xcode utilising the content that’s available to your Mac. ‘When you want to run the code, click on Product > un. You may be asked to enable Developer Mode ‘on the Mac, thisis to authorise Xcode to perform Functions without needing your password every session. When the program executes, the output wil be displayed at the bottom of the Xcode window. EP Introducing C++ How to Set Up C++ in Linux Linuxis a great C++ coding environment, Most Linux distros already have the essential components preinstalled, such as a compiler and the text editors are excellent For Clee Ne Keele (M nominee ale Reo OU meee Meme ECON Lo CECA available to help you out. LINUX++ ‘There are many different versions of Linux available, for this example we're using one of the more popular distributions: Linux ‘Mint. However, these steps will work in any Debian-based Linux. FRTTSEDD The fist step with ensuring Linux isready for your RANE Amazinaly that'sit. Everything sll ready for you C+ codeis check the system and software are to start coding. Here's how to get your First C++ Lp to date. Open a Terminal and enter: sudo apt=get update _programup and running n Linux Mint the main text editor is xed f& sudo apt-get: upgrade. Press Return and enter your ‘canbe launched by clicking on the Menu and typing Xed into the password. These commands updates the entire system and any _—_search bar. Click on the Text Editor button inthe right-hand pane to installed software. ‘open Xed. File Edit View Search Terminal Help EET errr a [sudo] password for david BEPTSED) ost Linux distros come preinstalled with all the Eee '2%d, or any other text editor you may be using, necessary components to stat coding in C++ enter the lines of code that make up your C++ Hello However, it's always worth checking tosee if everything ispresent, World program. To remind you, it: sostillwithin the Terminal enter: sudo apt=get. install build-essential and pressRetum. If you have the right components, nothingjs installed but Fyou'e missingsomethen int) main() they are installed by the command, a Getto Ihay siest CH program Hinclude = —-— std: scout << “Hello Worla!\n": int main) BRR i rconcciyarcau Garicrsncn 7 The Fist thing ou can ses that xed as SEH automatically recognised this asa C++ file, since the fie extend snow seo ep. The colour codgispresentin he Code and you open opthe fle manager you cana see that the fie'sconhascrr stamped on PEPER) With your code now saved, drap into the Terminal again. You need to navigate to the location of the C++ file you've just saved. Our example isin the Documents, Folder, so we can navigate tot by entering: ed. Documents Remember, the Linux Terminals case sensitive so any capitals must be entered correctly. Before you can execute the C+ fileyou need to compile it. In Linux t's common to use g++, an open source C++ compiler and as you're now inthe same folder as the C+ file, goto the Terminal, enter: g## helloworld.cpp and press return, . davidemit File Edt View Search Terminal Help davidenint-nate Perce faeerartraeerny ‘There willbe abrief pause asthe code is complled bby 9++ and providing there are no mistakes or ‘errors inthe code you are returned to the command prompt. The ‘compiling of the code has created a new file. you enter 1s into the Terminal you can see that alongside your C++ file's aout. davide Fle Edit View Search Terminal Help roe ars Carearnreert ie Sereieert) eereronetss ares PEAETR the acutfileis the complied C++ code. Torunthe code enter: ./a.0ut and press Return. The words Hello Worl appearson the screen, However, acutisntvery friendly ‘To name it something else post comping, you can recompile with: tt helloworld.cpp =o) helloworld. This creates an output file called hellaworld which can be run with: /hel Lowor a File Edit View Search Terminal Help cd Documents Feet View Seach Temial_ Help att i wera pclpubliations.com BD wcuinac Other C++ IDEs to Install IFyou want to try a different approach to working with your C++ code, then there are Meusoke stout icin ota are M eit atuets telid ceceauiion cad [>= but there are plenty for Mac and Lini sers too. DEVELOPING C++ Here are ten great C++ IDEs that are worth looking into. You can install one or all of them if you like, but find the one that works best For you. Eclipse isa hugely popular C++ IDE that offers the programmer a wealth of Features. thas ‘great, clean interfaces easy to se and available For Windows, Linux and Mac, Head over to www.eclipse.org/downloads/ to New=empy corres GavshfeNonthekejeoed sutblelocaion on your hardrive odin the Fe Home ox al kone? Ne Eno Fe ores uSHron Pew Thelowordepy, clk the saveaspedoxandsele ler es. Giathe swe buen, ESTED ow you can see. blank screen, withthe tab BETTER You can see that Code:Blocks has now changed labelied *Untitiedt, and the number one inthe top the colour coding, recognising thatthe file is now left of the main Code:Blocks window. Begin by clicking in the main C++ cade. This means that code can be auto-selected from the window, so the cursor isnextto the number one, and entering CodesBlocks repository. Delete the include line and iin re-enter it. You can see the auto-select boxes appearing, (tog testes 2 nar -caaeas Fin td Vy toch Pet ld Dp Fen wth Teh Tae ote Fe tit Vor seh tog. foten wins tan toe Pina tert [oem mle e| ie alos ool [2ea@ler/xmalagiorseon, ri Oe cee co o/h BR Rig sim n int masa’) ETE) On thenexttine below int maind, enter acurty bracket 1 ‘This can be done by pressing Shift and the key tothe right of Pon an English UK keyboard layout @ &[m* int main() FY Notice that Code:Blacks has automatically created a corresponding closing curly bracket a couple of lines below, inking the pair, as well as a slight indent. Tisis due to the structure of C++ andi’ where the meat ofthe code is entered, Now enter (My fizst CH program ws | scl NEA bio eee ne main) lac Note again the colour coding change Press Retum at Sue8 the end of the previous step’s line, and then enter: std: cout << “Hello, worla!\n": Xmalagiorson Ea | r*<] ial] Sd irate FETIEDD ust as before, Code:Blacks auto-completesthe Code you're entering, including placing a closing speech mark as soon as you enter the first. Dont forget the ‘semicolon atthe end of the line; ths fs one ofthe most important ‘elements to a C++ program and we'll tell you why in the next section. Far naw, move the cursor down to the closing curly bracket and press Return. |Qaforsoa ia] Qe oh Ee eRERD 120s allyounced to do for the moment. t may not look terribly amazing but C++ is best absorbed in small chunks. Don't execute the cade at the moment as you need tolookat how a C++ program is structured First; then you can build ~and run the code. For now, click on Save, the single floppy disc icon. 26ua\e>|xmalaalorson, Gale ae iaa)W Bw 6 me] ai aS Ea © ho se [Omer Coding with C++) Compile and Execute You've created your First C++ program and you now understand the basics behind the structure of one. Let’s actually get things moving and compile and execute, or run if you prefer, the program and see how it looks. GREETINGS FROM C++ Compiling and executing C++ code From Code::Blocks is extraordi the result. Here's how it’s done. ; it's just a matter of clicking an icon and seeing Open CodeBlocks, if you haven't already, and load up the previously saved Hello World code you created. Ensure that there are no visible errors, such as missing semicolons at the end of the std:cout line, Start by clicking on the Build con, the yellow cog. {A this point, your code has now been run through the Coder:Blacks compiler and checked For any errors. You can see the results of the Build by looking to the bottom window pane. Ary messages regarding the quality of the code ae displayed here. Buldlog | # Build messages x /) CppCheckVe in “no project" (compiler: unknown) === 5), 0 warning(s) (0 minute(s), 0 second(s)) ciee+ PEPER your code is looking similar tothe one in our screenshot, then look to the menu bar along the top of the screen. Under the Fortran entry in the topmost menu you can see a group oFcons:a yellow cog, green play button and acog/play button together. These are Build, Run, uild and Run Functions. RRO QAAiorson apm @ 5 [ rec] ieli) QEd + ho ou T_ finclude 2 «ek 6 [| starscout << *Hetio, woria!\nts el PEPIIPD vow click on the Run icon, the green play button. ‘Acommand tine box appears on your screen displaying the words: Hello, world, followed by the time it's taken tocexecute the code, and asking you press a key to continue. Well done, youjust compiled and executed your First C+ program. Presingamyniheconmand inet, ERRERE rena dels erarinte coe Reeve te S15 returning you to Code::Blocks. Let's alter the code Sue8 ‘semicolon from the cout line, so it reads: sight Under the silude ie enter cout << “Hello, world! \n" Starthere | *helloworkd.cpp 1 #include ‘Then, delete the std: part of the Cout ine; like so: cout << “Hello, world\n" 2 using namespace std: 3 4 int main( BE csiozisessernce sve s mt : 9 tameepace ss . = 7 || cout << "He1l0, wortd!\n" 5 8 >; 7 a} 5 10 : nh z 2 Inorertoapy te eu chnssto te co y00 EERESPQ Now cite uldandnconagano ante SIG need to re-compile, build, and run it again. This time, SHEP) changes to the code. This time Code::Blocks refuses however youcensimpy lckthe Bul/Runicon, te combined. toexectethe code, de tothe error you putin. nthe Log pane a velo cog and green pla button, thebottomafthesceen you are formed of he eon tics: Expected’ before token, indicating the missing semicolon. s oF TAA] ome ia\n omy PETIA Just aswe mentioned in che previous pages, you BSTSERE RD Replace the semicolon and under the cout tine, don't need to have stdcaut i you already declare enter anew line to your code: using namespace std at the beginning of the code. We could have easily clicked the Build/Run icon to begin with but it's worth going through the avaliable options. ou can also see that by building and The \nsimply adds a new line under the last line of outputted text. running, the file has been saved. Build and Run the code, to display your handiwork. cout << wand grestings from Cr+!\n"7 wesioticionen CE EP Coding with C+ » Using Comments While comments may seem like a minor element to the many lines of code that OUI Oe Cer rete ameenen acne scunicet rl cad CM Reuse cere THE IMPORTANCE OF COMMENTING ‘Comments inside code are basicaly human readable descriptions that detail what the code is doing at that particular point. They don't sound especialy important but code without comments is one ofF the many Frustrating areas of programming, regardless of whether you're a professional or ust starting out, In short, all code should be commented in such a manner asto effectively describe the purpose of line, section, or individual elements. You should getin to the habit oF commenting as much as possible, by imagining that someone who doesn't know anything about programming can pickup your code and understand what i's ‘going todo simply by reading your comments Ina professional environment, comments are vital to the success of the code and ultimately the company. nan organisation, many ‘programmers work in teams alongside engineers, other developers, hardware analysts and so on. f you're a part ofthe team that’s \wrting a bespoke piece of software forthe company, then your comments help save a lot of time should something go wrang, and ~another team member has to pick up and follow the tail to pinpoint the issue, Place yourself the shoes of someone whose jab it isto Find out what's wrong with a program. The program has in excess of 800,000 lines of code, spread across several different modules. You can soon appreciate the need for alittle help From the original programmers Inthe Form of a good comment. ‘The best comments are always concise a” 2 using namespace std; ao 4 _ int maint) || = 5 a & 7 cout << "Hello, world! \n"; 3 2 | = a ly a n es FER weve, youconsoacdonmeristotieend, ERB obvious tyouty andbuldondonce te fain feos todexbeins beter way aha’ coleterosoutconplaningoternsingciy organ bret tof ofthe ace! ede yorvemodethe tre tes hence ine coisuingtogobacand Sonis ello, world!”= the (n enotes anew Line.” ‘6. Thniy.the clo codngincodestedshls deny Note, you darth puta semicon tthe end of comment This is because it's a line in the code that's ignored by the compiler. Yovcncenmnteuseeainestysingte ERIS ae ving ox coments snosmactie SiS Forward slash and asterisk: S356 in C++ to add an asterisk to each new line of the ‘comment block. Ths also helps you to remember to close the ee comment boc off befer continuing with he code: without the need to add nore slashes */ + This comment can cover several Tines Just emembe tons the block commen withthe opposite - ; Auzremenber ofa ‘thou the need to add nore slashes */ tat pe! 2 A ' sotto . EP Coding with C++) Variables Nee ese eee ele Mae ESTs) e a ear a equals 10 and a variable is assigned. However, in C++ a variable has to be declared with its type before it can be used. THE DECLARATION OF VARIABLES You can declare a C++ variable by using statements within the code. There are several distinct types of variables you can declare. Here's how it works. PEPTIEBD Open upanew, blank C++ ile and enter the usual code headers Hinelude using namespace staz int main () fi , Finclade ‘using namespace sta ant main() Start simple by creating two variables, a and b, with (one having a value of 10 and the other S. You can se the data type int to declare these variables. Within the curly brackets, enter: int ar int bz 10; ‘esiog namespace std: iegesandb To ouput conentsof te van a ‘The cout <<"\nspart simply places anew tine ie between the output of toands, ae int resuity [Naturally you can declare a new variable, calt result and output some simple arithmetic: result =a + by cout << result; Insert the above into the cade as per the screenshot. FEPTSED) You canassignavalue toa variableassoon asyou IPB the previousstep creates the variable StartLives, declare’. The cade you've typed in could look ike which sa global variable. n 2 game, For example, this, instead: pla + lives go up or down depending on how wel or how bad ea = 10 they/re doing, when the player restarts the game, the StartLives int a= 10; retyinsto its defaut state: 3, Here we've assigned 3 ves, then ee a subtracted 1, leaving 2 ives let PEED The modern C++ compilers far more intelli than most programmers give it credit. While ‘are numerous datatypes you can. fact use the auto Feature: her lare for variables, you can in Finclude FETED Soecificto C++, you can also use the Following int main() toassign values toa variable as soon as you declare them: - double area, radius = 1.57 int a (10)? ——, area = pi + radius + radius; ‘Then, from the C++ 2011 standard, using curly brackets: — int result (atb , FEED You cancreate global variables, which are variables that are declared outside any Function and usedin any function within the entire code. what you've used sofar are SIRE) covet fnew elements here: frst, auto wont local variables: variables us re eo ies So oe Sens 2 Cone tickthe box labeled Have G++ follow the C++11 5O.C++ Language seam Standard [std=c++T]. Then, the new datatype, double, which cts means double-precisonfostng point value. Enable C++11, then int Startbives = 3; bid andrun the code. The result should be 7.06858, Hinclude using namespace stdz double PI = 3.141592653589793238463; int main() ‘ cout << Pry Finclude using namespace ata: [ doubie Pr = 3.1sisszesssesr0s2se463; B 2 3 4 Sint main() 6 7 cout << PI; e 8 15 CAUser\detDocument\Co-\DaeTypee Build and run the code and as you can see the output is only 3.14159, representing cout’ limitations inthis example. ‘You can alter the code including the aforementioned cout.precision Function, For greater accuracy. Take precision all the way up to 22 decimal places, with the Following code: Hinclude using namespace stdj double PI = 3.1415926535897932384637 int main(y ‘ precision (22); Starthere | Datatypescpp using namespace std 3 double Pr ~ 3.14159265358979323846 4 Sint main() ‘Again, build and run the code; as you can see from the command line window, the number represented by the variable Pls diferent to the number you've told C++ to use in the variable. The output reads the value of Plas 3.141592653589793115998, with the ‘numbers going awry from the fifteenth decimal place. Calculator C Scientific 15.142857142857142857142857142857 DEG HYP FE Me Ms. sin cos tan v 10" log Exp Mod cE ie oN WO ‘This is mainly due to the conversion from binaryin the compiler and that the IEEE 754 double precision standard occupies 64bits of data, of which 52-bits are dedicated to the significant (the significant digits in a floating-point ruber) and roughly 3.5-bits are taken holding the values 0 to 9. IFyou divide 53 by 3.5, then you artive at 15.142857 recurring, which is 15-ciits of precision To be honest, ifyou're creating code that needsto be accurate to more than fifteen decimal places, then you wouldn't be using C+, you would use some scientific specficlanguage with C++ as the connective tissue between the two languages. a types, using an alastike system called Finclude -ypedef int space stds tnt main() { 2 new int datatype called metres. Then, in the main code block, there's anew variable called distance, which is an integer; so you'e basically telling the compiler that there's another name forint. We assigned the value 15 to distance played the output: distance in metresis 15. lemight sound alittle confusing to begin with but the more you use reate your ow" oe BD coins) Strings Sse rae ca CR tec ece ere cunt eon Ea ett tuN timed ay concen cent ace eet feol Meee cas neice STRING THEORY There are different ways in which you can create a string of characters, which historically are all carried over from the original language, and are still supported by C++. Sia ‘Hinelude using namespace stay ‘Tocreate a tring you use the char function. Open 3 new C++ file and begin with the usual header: int main c , [xe Qaporseon Fe si mecislall®) lets easy to confuse a string with an array. Here's an array, which can be terminated with a null character: ‘include using namespace stay int main fi char greets] = ‘NOE cout << greet using namespace std; int main () ‘ char greet {1 = “Welcome”; cout << greet << “\n"s Ines there's also a string Function, which works in ‘much the same way. Using the greeting code again, Oiag you can enter: Hinelude using namespace stdj int main «) ‘ string greet = ‘welcome; cout << greet << “\n" PEPER) There are also many different operations that you can apply with the string Function. For instance, to get the length ofa string you can use: Hinclude tnt main ( string gree “welcome”? length of the string is: << greets ze() << *\n"7 You can see that we used greet size()to output the length, the numberof characters there are, of the contents ofthe string. Naturally if you call your string something ‘ther than greet, then you need to change the carmmand to reflect this. t's always stringname.operation. Build and run the code to see the resus. STEP 6 Hinclode using namespace atdz You can of course add strings together, or rather combine them to Form longer strings: int main () string greet] tring gree string grect3 cHeL10"; ty world?s grestl + greet2; cout << greets << “\n"7 FEED estes you might expect, you can mixin ann {and store something to do withthe sting. n this spl, we created int length, which stores the result of string, sizeQ) and outputs ito the user Hinelude int main 0 ‘ int lengths string greet string greet? string greet’ = cHeLio"s *) world!"s greet + greet2; Length grest3.siz0(07 out <¢ “The length of the combined strings ist ™ << length << "\n"; ) Using the available operations that come with the string Function, you can manipulate the contents of a string, For example, to remove characters from a string you could use: Hinclude using namespace =! int main () t string stra) ("Here string”); is a long sentence in a cout << stra << ‘\nts rg.erase (10,5) erg.erase (etrg.begin() +8)? rg.erase (etrg.begin() +9, cout << atrg << \n! steg.end 0-9) le’s worth spending some time playing around with the numbers, which are the character positions in the string, Occasionally, it can be hit and miss whether you get Tight, so practice makes perfect. Take alookat the screenshot to see ult ofthe code. sensation BED - gwithC++ ) C++ Maths Se AEE DEtcea Eo Mul aeesem cet chines LIU eee) Teo ee aA] EEN ole coool oa AON y implementing mathematical models into their code. It can be extremely complex or PaclaN les iu Ce The basic mathematical symbols apply in C+ as they do in most other programming languages. However, by using the C++ ‘Math Library, you can also calculate square roots, powers, trig and more. CC++'s mathematical operations Follow the same patterns as those taught.n school in that ‘multiplication and division take precedence over addition and subtraction. You can alter that though. For now, create a new fle and enter: Hinclude using namespace std; int main () fi float numbers = 100; numbers = numbers +10; // This adds 10 to the initial 100 cout << numbers << “\n"7 numbers = numbers - 102 from the new 110 11 This subtracts 10 cout << numbers << *\n"? While simple, it does get the old maths muscle warmed up. Note that we used afloat forthe numbers variable, While you can happily use an integer if you suddenly started to use decimals, you would need to change toa Float or a double, depending on the accuracy needed, Run the code and see the results FETTER) Multiplication and division can be applied as such: Hinclude lasing namespace std: int main () ‘ float nunbers = 100; punbers = numbers * 10; // This multiplies 100 by 10 cout << numbers << “\n"? nunbers = numbers / 107 // And this divides: 1000 by 10 cout << numbers << \n"? ‘Again, execute the simple code and see the results Sry hile not particulary interesting, isa start into C++ maths. We used afloat here, soyou can play around with the code _and multiply by decimal places, as well as divide, add and subtract. BEPTED) The interesting maths content comes when you call upon the C++ Math Library. Within thisheader are dozens of mathematica Functions along with Further operations. rything rom computing cosine to arc tangent with two parameters, to the value of Pl, You can call the header with: Hinclude Hinclude using namespace sta int main () ( BETS 2"tby getting the square root of a number: Hinelode using name i int main @ fi float number = 134; << “the square root of * << munber << * de: * << sqrt (number) << “\n" Here we created a new float called number and Used the sartinumber) Function to dsplay the square root of 134, the value ofthe variable, number. Build and run the code, and your answer reads 11.5758. can be done with: FED alcuating powers of num Finclude Hinelude lasing namespace stdz int main 0 ‘ float nunber = 124 cout << munber <¢* to the power of 2 ia * << 2) << “\n"s cout << munber << * pox (number, 3) << “\n"? << number << ° to the power of .08 i << pow(number, 0.8) << “\n"s ) ox (number, the power of 3 is * << FSTISED tere we created afloat called number withthe value of 12, and the pow(varable, power) is where the calculation happens. Ofcourse, you can calculate powers and ‘square roots without using variables. For example, pow (12,2) outputs the same value a the firs cout line in the code. ‘Thevalue of Pis aso storedin the cath header SHEP IO library. it can be called up with the M_P1 function. Enter cout << MP into the coe and you ge 3.14159; 0ryou can vseittocaialate Hinclude Hinclude using namespace std7 int main ‘ double area, radius = 1.57 area = MPI * radius * radiue; ee EP Coding with C+ ) User Interaction Peek eee Cat eer aE Tc crate NOOR basic user interaction is one of the most taught aspects of any language and with it SNE r elo eeReo Meno Men MES Re Kok an ee oe HELLO, DAVE You have already used cout, the standard output stream, throughout our code. Now you're going to be using cin, the standard put stream, to prompt a user response. TEP en input must first be declared asa variable, so it’s ready to be used by the user. Start by creating a blank C+ file with headers. Finciude ‘using namespace std: int main () FETTSER The data type ofthe variable must also match the type of input you want from the user. For example, to-ask a user their age, you would use an integer ike this Hinclode using namespace staj int main () fi int age? cout << “what is your age: ein >> ager cout <<"\nYou are * << age << * years old.\n"7 BER to cnccmanivatguconatmnren input is put into the integer age and called up in the second cout ‘command, Build and run the code. FETED you're asking a question, you need tostore the Inputas string; to ask the user their name, you would use: Hinclude using namespace stay int main 4) ‘ string name: cout << what is your name: "s cin >> name: cout << *\nHelio, well today?\n"; ) * using namespace stdj in in Ant mum, puns cout << “Enter two whole numbers: ein >> num) >> nun2; cout << “you entered " << num << * and ™ << numa << *\n"s Hinclode using namespace stdj int main () fi float num, numa; cout << “Enter two numbers: \n"s ein >> uml >> numa; cout << mumt << 4% < muna uusing namespace stdz int main () ‘ string mystre cout << “enter a getline(cin, mystr): tence: \n"s cout << “Your * characters Long.\n"? > << mystr.sizet) < FETED uid and execute the code, then enter asentence with spaces. When you're done the code reads the number of characters. If you remove the getline line and replace it with cin >> mystr and try again, the result displays the number of characters upto the frst space, Hinelude using namespace std7 int main «) ‘ string names cout << “Enter your full getline (ein, nane) + Anns cout << \nello, * << name << *\n"s ———: Ce eee vy Introducing Python Python is one of the most respected and used programming languages in the world. It's designed to help beginners get into code, but also has some amazingly powerful features that are utilised by data scientists and engineers around the world. You don’t need to look too far to Python at work. It’s used throughout the Internet, and helps drive some of the biggest projects and companies in a multitude of industries. In this section, we will look at what you will need to get started with Python. First steps into a new learning experience are always the hardest, but we're here to help. TCM U O1 ‘phn f° Du ee owe Why Python? Dee Liccns ae UME cuetr ee Coma ture reon tis PI Renee ee cma cacru hatte om eueaaiccl cnetete ac Preece eee a eam Cemuee neta igen Python out ofall the rest? PYTHON POWER Ever since the earliest home computers were available, enthusiasts, users and professionals have toiled away until the wee hours, saving over an overheating heap of circuitry to create something akin to magic. ‘These pioneers of programming carved their way into anew Regardless of whether you use an Android device, iOS device, PC, Frontier, Forging small routines that enabled the letter’ toscroll Mac, Linux, Smart TV, ames console, MP3 player, GPS device builtin ‘across the screen It may not sound terribly exciting toa generation to a car, set-top box or a thousand other connected and ‘smart that’s used to ultra high-definition graphics and open world, multi appliances, behind them alls programming player online gaming, However, Forty-something years ago it was blindingly biliant. ‘All those aforementioned digital devices need instructions to tell. them what to do, and allow them to be interacted with, These ‘Naturally these bedroom coders helped form the foundations for instructions Form the pragramming core of the device and that core every piece of diaital technology we use today. Some went onto canbe built using a variety of programming languages. become chief developers for top software companies, whereas ‘others pushed the available hardware toits limits and founded the The languages in use today differ depending on the situation, the billion pound gaming empire that continually amazes us. platform, the device's use and how the device wil interact with ts Se eras “segs onenet) 0 environment or users. Operating systems, such as Windows, macOS Python was created over twenty sixyears ago and has evolved to {and such are usually a combination of C++, Ci assembly and some become an ideal beginner's language for learning how to programa Form of visual-based language. Games generally use C++ whilst web computer. t's perfect forthe hobbyist, enthusiast, student, teacher pages can use a plethora of available languages such as HTML, Java, and those who simply need to create their own unique interaction Python and so on. between either themselves ora piece of external hardware and the computer itself ‘More general-purpose programming is used to create programs, apps, software or whatever else you want to cll them. They're Python is free to download, install and use and is available for Linux, widely used across allhardware platforms and sult virtually every Windows, macOS, MS-DOS, 05/2, 8eOS, IBM iseries machines, and conceivable application. Some operate faster than others andsome even RISC OS. thasbeen voted one of the top five programming are easier to learn and use than others. Python is one such genecal-_languagesin the world and is continually evalving ahead of the purpose language. hardware and Internet development curve. Python is what's known asaHigh-Level Language, in hati talks’ So to answer the question: why Python? Simply put, it's Free, easy to to the hardware and operating system using a variety of arrays, lear, exceptionally powerful, universally accepted, effective and a| variables, objects, arthmetic, subroutines, loops and countless superb learning and educational tool. ‘more interactions. Whilst it's not as streamlined asa Low-Level Language, which can deal drectiy with memory addresses, call, stacks and registers, ts benefitis that it's universally accessible and easy to learn. TTS awe Tava pore java aig reflect; ass, tavoke { , pubrterstaele void mang sering () args > Eiass ¢ = class.fornane( args{0) 9; fethod‘g = crgetmetnodt argeids, new class Geis, oe Gbsect hee = m-tnyokeC null, null 95 Syaten.out.prinin ye vokee. arate method! om Gteclass: © args{o] + wich no args\nmesules: "+ ret 3; catch ( Classnotroundcxeeption ¢ ) I class: Fornane(. can't: find.the class Gach” C wosuehweshodexeeption 2’) { IF that method doesn'ecexise Gacch'( Heganaccesstxception 03) { {ve n't Rave“perwission co Savoke that BASIC was once the starer language thet earty } catch ( tovocationrargevexception e# ) { ‘-ithome computer users leamed. If'en excepeion acurred nhvie Invoking that nechod Syst + args(1] out print n¢ econo, jathod threw an: " + e4. Fer ene «4 getTargetexception( ")")} y ~ } i i ene paisa Powerit ernpt"wleee ac» sar etn £2 +“) language that's used in a if ieee orien sie» re tome z eccisp boaaet Th ote, an) TVsand even ers. . Fe ee ae Python isa more modern take on BASIC, i's easy to learn and makes for an ideal beginner's programming language. eacnon CE

You might also like