Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Introduction In today’s lesson we will look at: • what programming is • what we’ll be doing on the course • installing the software you need • writing your first program What is Programming? • Put very simply, programming is telling the computer what to do! • “Program” is another name for applications, software, “apps”, utilities, etc. – things that run on your computer • Almost every program that you use will have been “written” by a person – or more likely a team of people. • Programs are written using a “programming language” What is a Programming Language? • When you write a program, you use a special set of words as the instructions – these are called commands or keywords – and these make up the programming language. • Examples of programming languages include BASIC, C and C++, Java, Python, JavaScript, Pascal, PHP, Ruby, Perl – there are loads! • Luckily they are quite similar in that they mostly use the same ideas, and often a lot of the commands are the same, so it’s fairly easy to swap from one to another. Which is Best? • Actually, learning to program isn’t just about learning the language. • All languages include things like: – Variables – Decisions – Repetition – Events • The real skill is being able to take an idea for a program and to use these things to create it What Will We Use? • After months of research, I’ve decided on BASIC • BASIC isn’t basic – it’s an acronym and stands for Beginners All-Purpose Symbolic Instruction Code • We will start with Just BASIC and move on to Visual Basic. • Visual Basic is used by professional programmers to create large Windows applications • Both are free to download, there will be links in the assignments. BASIC • It’s easy to swap from one to the other – you can even copy and paste some things Installing the Software • Just BASIC is a small download, and it can be installed from http://justbasic.com/download.html • There is a free version of Visual Basic called Visual Basic Express, which is fine for home use • The full version of Visual Basic can de downloaded from Dreamspark if you have an account (check with your school) • Visual Basic is a large download, and takes up a lot of resources on your computer, so I recommend that you wait until you’re sure you want it! Can We Start Now? • OK! • Looking at a very simple level, programs take an input, process it, and produce an output, so we’ll look at those key steps first. • The command for output in Just BASIC is PRINT • The keyword for input is INPUT PRINTing • You can print a number: PRINT 123 • You can print text: PRINT “Hello” • You can print the result of a calculation: PRINT 4*2 • You can join words together: PRINT “Hello ” + “Everyone” • The next PRINT command prints on the next line unless you use a semi-colon (;) INPUT • When you ask a user for input, you need: – A question, or prompt, to tell them what you want – A variable to store the response • e.g. INPUT “What is your name?”; n$ • We will look at variables in more detail next week, so don’t worry about this too much for now.