Module1.1MOdule 1.2MOdule 2.1 module 2.1 with a jpegall in a zipped file
PowerPoint Presentation Introduction to Programming MODULE 1 07/01/2019 MODULE 1: INTRODUCTION TO PROGRAMMING 1 Module 1 Introduction ◦ C++ as a middle-level language ◦ Expectations 1.1 Programming Basics ◦ Compiler vs Interpreter ◦ Code Editor ◦ Integrated Development Environment (IDE) 1.2 Variables, Types and Structs 07/01/2019 MODULE 1: INTRODUCTION TO PROGRAMMING 2 Build Environment Compiler ◦ MinGW (g++ compiler) Build Environment ◦ Visual Studio Code – Microsoft ◦ Code Blocks (codeblocks-17.12mingw-setup.exe) – Open-source 07/01/2019 MODULE 1.1 PROGRAMMING BASICS 3 Running your first code 07/01/2019 MODULE 1.1 PROGRAMMING BASICS 4 Running your first code Alternative: CodeBlocks 07/01/2019 MODULE 1.1 PROGRAMMING BASICS 5 Running your first code Alternative: (Online) http://cpp.sh 07/01/2019 MODULE 1: INTRODUCTION TO PROGRAMMING 6 http://cpp.sh/ Modifying the first code 07/01/2019 MODULE 1.1 PROGRAMMING BASICS 7 Module 1.1 Activity (needed for Assignment 2) Need to submit this together with the first two programs, save in a zip file 1. Build a program that prints your name and address to the screen. Be sure to put carriage returns in the appropriate places and use appropriate sentence capitalisation. Compile your program, ensuring there are no errors and then run it. 2. Build a second program that accepts two names, the user’s first and last names. With the data read in, display a welcome message to the user. Compile your program, ensuring there are no errors and then run it. 07/01/2019 MODULE 1.1 PROGRAMMING BASICS 8 Readings 10 Programming Languages in ONLY 15 Minutes https://www.youtube.com/watch?v=7bE2mI4ePeU Understanding Programming Languages https://www.youtube.com/watch?v=_zusEe3GOe8 07/01/2019 MODULE 1.1 PROGRAMMING BASICS 9 https://www.youtube.com/watch?v=7bE2mI4ePeU https://www.youtube.com/watch?v=_zusEe3GOe8 Module 1 Introduction ◦ C++ as a middle-level language ◦ Expectations 1.1 Programming Basics ◦ Compiler vs Interpreter ◦ Code Editor ◦ Integrated Development Environment (IDE) 1.2 Variables, Types and Structs 07/01/2019 MODULE 1: INTRODUCTION TO PROGRAMMING 10 Variable Naming convention ◦ strName ◦ intAge Declaring variables Assigning values to variables 07/01/2019 MODULE 1.2: VARIABLES, TYPES AND STRUCTS 11 Primitive Data Types Type Keyword Example Data Boolean Bool TRUE, FALSE Character Char ‘c’, ‘r’, ‘!’, ‘5’ Integer Int 1, 5, 459, 0 Floating point Float 3.1415 Double floating point double 3.1414899582923038238 Valueless Void [Nothing] 07/01/2019 MODULE 1.2: VARIABLES, TYPES AND STRUCTS 12 Code Samples 07/01/2019 MODULE 1: INTRODUCTION TO PROGRAMMING 13 Constant 07/01/2019 MODULE 1: INTRODUCTION TO PROGRAMMING 14 Struct 07/01/2019 MODULE 1: INTRODUCTION TO PROGRAMMING 15 Array 07/01/2019 MODULE 1: INTRODUCTION TO PROGRAMMING 16 Module 1.2 Activity (needed for Assignment 2) If you don’t know already, using your information finding skills to find out what a ‘byte’ is. What number base is the basis for computer science as we currently have it? Do you know your 2-times-tables? What about your 2 powers? 1. Build a program that asks the user for two whole numbers, and then adds them together, displaying the result to the user. Compile your program, ensuring there are no errors and then run it. 2. Build a program that asks the user for two whole numbers. Multiply those numbers by a constant you set to 3 (or any other number). Explain to the user that you are displaying multiples of 3 (or any other number) back to them, only after they provide the input. 3. Build a program that sets up a structure of four variables, one each for a person’s first name, surname, address and age. Greet the user and ask them for their personal details and store them in the structure. Ask them for details of their friend or partner. Display the data the user typed in back to them. 4. Build a program that declares an array of 7 integers. Ask the user to enter the number of steps they took (perhaps reading from their pedometer, or otherwise guessing) for each day of the week. Add the number of steps together and advise the user what total steps they took for the week. 07/01/2019 MODULE 1.2: VARIABLES, TYPES AND STRUCTS 17 Readings The Applications Developed With C++ https://www.youtube.com/watch?v=do55AFRGYWM 07/01/2019 MODULE 1.2: VARIABLES, TYPES AND STRUCTS 18