C++ Support Classes (Data and Variables)

Size: px
Start display at page:

Download "C++ Support Classes (Data and Variables)"

Transcription

1 C++ Support Classes (Data and Variables) School of Mathematics 2018

2 Today s lecture Topics: Computers and Programs; Syntax and Structure of a Program; Data and Variables; Aims: Understand the idea of programming a computer; Write a simple program to input and output data.

3 An Idealized Computer Memory Input CPU Output CPU - Central Processing Unit CPU and memory work together File Store

4 An Idealized Computer Memory Input CPU Output File Store CPU - Central Processing Unit CPU and memory work together Input may be from keyboard, mouse or a file Output may be to screen or a file

5 Programming What is a program?

6 Programming What is a program? A program is sequence of instructions to enable a computer to complete a task.

7 Programming What is a program? A program is sequence of instructions to enable a computer to complete a task. Computers can remember programs Originally programs had to be written in machine code - low-level

8 Programming What is a program? A program is sequence of instructions to enable a computer to complete a task. Computers can remember programs Originally programs had to be written in machine code - low-level Now we write programs in code

9 Programming What is a program? A program is sequence of instructions to enable a computer to complete a task. Computers can remember programs Originally programs had to be written in machine code - low-level Now we write programs in code - and let the computer write the machine code for us! C/C++ are best described as mid-level languages Higher-level languages include java, Fortran and others. Scripting languages such as python compile on the fly, giving instant results

10 Writing C++ Raw C code make absolutely no inferences about what you want. C++ code is constantly being updated to become more intelligent. Many scripting languages make assumptions about data types this makes it easier to code...

11 Writing C++ Raw C code make absolutely no inferences about what you want. C++ code is constantly being updated to become more intelligent. Many scripting languages make assumptions about data types this makes it easier to code... but easier to make mistakes (of the kind you can t spot).

12 Writing C++ Raw C code make absolutely no inferences about what you want. C++ code is constantly being updated to become more intelligent. Many scripting languages make assumptions about data types this makes it easier to code... but easier to make mistakes (of the kind you can t spot). C++ is the fastest and most powerful language because it lets the user take control

13 Writing C++ Raw C code make absolutely no inferences about what you want. C++ code is constantly being updated to become more intelligent. Many scripting languages make assumptions about data types this makes it easier to code... but easier to make mistakes (of the kind you can t spot). C++ is the fastest and most powerful language because it lets the user take control Uncle Ben - Spiderman 2002 Remember, with great power, comes great responsibility.

14 Writing C++ The key elements of C/C++ syntax are: Semicolon used to mark end of statements Case is important Totally free form, lines and names can be as long as you like! Comments take the form /* C style comment */ or // C++ style comment Code blocks are surrounded by braces {}

15 An example Program Libraries/Methods Program Declare Include libraries and methods Declare data types and variable names Input values for variables Input Calculate Output

16 An example Program Libraries/Methods Program Declare Input Calculate Include libraries and methods Declare data types and variable names Input values for variables Required calculations are carried out in sequence Output to the screen or a file Output

17 An example program First we see a library at the top, allowing for input/output

18 An example program First we see a library at the top, allowing for input/output The top area should contain global options - but not calculations.

19 An example program First we see a library at the top, allowing for input/output The top area should contain global options - but not calculations. The calculations are carried out underneath. Note that // is used for comments (they appear green).

20 An example program First we see a library at the top, allowing for input/output The top area should contain global options - but not calculations. The main program is called main. There can be only ONE of these functions in your code.

21 An example program Curly brackets are used to indicate the start and finish of the function block.

22 An example program Curly brackets are used to indicate the start and finish of the function block.

23 An example program Curly brackets are used to indicate the start and finish of the function block. You first set up your code. Each line is ended by a semi colon.

24 An example program Curly brackets are used to indicate the start and finish of the function block. You first set up your code. Each line is ended by a semi colon. Then we carry out some calculations - later on this may be 10 s, 100 s or even 1000 s of lines long.

25 An example program Curly brackets are used to indicate the start and finish of the function block. You first set up your code. Each line is ended by a semi colon. Then we carry out some calculations - later on this may be 10 s, 100 s or even 1000 s of lines long. The result from your calculation is output on the screen (or perhaps into a file).

26 IDEs and simple text files A C++ code is saved as an ASCII text file and can written in any editor. However, in this course we will encourage the use of an Integrated Development Environment (IDE). The two recommended peices of software are: Visual Studio (Windows only) Netbeans (Windows/Linux/Mac) For our purposes in this course, it will not matter on which platform you write the code. Visual Studio has limitations at the University and at home, but is probably the best choice.

27 Getting started on Visual Studio First open up the start menu, type in visual and select Visual Studio

28 Getting started on Visual Studio First open up the start menu, type in visual and select Visual Studio Select Not now maybe later when it asks you to sign in.

29 Getting started on Visual Studio First open up the start menu, type in visual and select Visual Studio Select Not now maybe later when it asks you to sign in. Select FILE > New > Project from the top menu.

30 Getting started on Visual Studio Now select Visual C++ on the left hand bar, and Empty Project in the centre. You can change the project name if you like.

31 Getting started on Visual Studio Now select Visual C++ on the left hand bar, and Empty Project in the centre. You can change the project name if you like. Right click on Source Files on right hand bar, select Add > New Item...

32 Getting started on Visual Studio Now select Visual C++ on the left hand bar, and Empty Project in the centre. You can change the project name if you like. Right click on Source Files on right hand bar, select Add > New Item... Select C++ File (.cpp), you can change the name of the file if you like.

33 Getting started on Visual Studio Now copy in the text for the Hello World program (see image). Getting lost? Click here to download the code for this demonstration.

34 Getting started on Visual Studio Now copy in the text for the Hello World program (see image). You are now ready to run the program select DEBUG > Start Without Debugging from the top menu. Getting lost? Dr P. V. Click Johnson here to download the code for this demonstration.

35 Getting started on Visual Studio Now copy in the text for the Hello World program (see image). Whoops! That disappears before I can see it! We need to edit some more settings... Getting lost? Click here to download the code for this demonstration.

36 Getting started on Visual Studio Now copy in the text for the Hello World program (see image). Whoops! That disappears before I can see it! We need to edit some more settings... Select PROJECT > Project Properties from the top menu. Getting lost? Click here to download the code for this demonstration.

37 Getting started on Visual Studio Now on the left hand bar select Configuration Properties > Linker > System. You should see a SubSystem setting appear.

38 Getting started on Visual Studio Now on the left hand bar select Configuration Properties > Linker > System. You should see a SubSystem setting appear. Press the little triangle button on the right hand side to reveal options, choose Console(/SUBSYSTEM:CONSOLE).

39 Getting started on Visual Studio Now on the left hand bar select Configuration Properties > Linker > System. You should see a SubSystem setting appear. Press the little triangle button on the right hand side to reveal options, choose Console(/SUBSYSTEM:CONSOLE). Run DEBUG > Start Without Debugging from the top menu and you should see the output!

40 Saving your work Every time you compile and run the code your work is saved. To transfer the work between different computers, you must set up a new project and copy/paste the code DO NOT TRY TO TRANSFER THE WHOLE DIRECTORY. You CANNOT have more than one program in a project. If you want to do something different, you will NEED to open up a new project! You will need to go through the steps outlined above EVERY time you start a new project.

41 So, where is it saved? Open up the Visual Studio 2013 folder in My Documents. Now open Projects.

42 So, where is it saved? Open up the Visual Studio 2013 folder in My Documents. Now open Projects. You should see a folder with the name of your project open it.

43 So, where is it saved? Open up the Visual Studio 2013 folder in My Documents. Now open Projects. You should see a folder with the name of your project open it. Here you find some folders and a *.sln file. This file does not contain your code!

44 So, where is it saved? Open up the Visual Studio 2013 folder in My Documents. Now open Projects. You should see a folder with the name of your project open it. The Debug folder contains the executable file and any file outputs default to this location.

45 Where is it saved? If you open it with notepad you will see it contains some global options about your system.

46 Where is it saved? If you open it with notepad you will see it contains some global options about your system. Open the file folder with the name of your project and you should see you C++ file.

47 Where is it saved? If you open it with notepad you will see it contains some global options about your system. Open the file folder with the name of your project and you should see you C++ file. The VC++ Project File file contains information about which C++ files are in your project, as well as external libraries and options.

48 Libraries Unlike higher level programming languages, there are almost no intrinsic functions in C++ This includes the ability to print to screen. We can include standard libraries for: Input/Output Advanced Storage Strings Mathematical functions The syntax for including libraries is: #include <library name > Include statements must appear before any other statements.

49 What is in a name? Each variable requires a unique name (in the same scope) In large projects this becomes very difficult A namespace is like adding a surname to a variable The prefix std means functions from the standard library We can use the statement: using namespace std; to assume an undeclared function, data type or variable is in the standard library.

50 Simple Input and Output We use stream variables to access the screen, keyboard and files. They allow us to associate a name with a physical output. We need to include stream libraries at the top of the program #include<iostream> using namespace std main(){ int i; cout << " Enter a number. " << endl; cin >> i; //read in a number cout << " Your number is " << i << endl; }

51 Simple Input and Output cout is the standard screen variable, and cin the standard keyboard variable To pass data to and from the stream we use the << and >> operators.

52 Simple Input and Output cout is the standard screen variable, and cin the standard keyboard variable To pass data to and from the stream we use the << and >> operators. << data is passed right to left, in the example the string is passed to cout >> data is passed left to right, in the example the integer is passed from cin to i

53 Simple Input and Output cout is the standard screen variable, and cin the standard keyboard variable To pass data to and from the stream we use the << and >> operators. << data is passed right to left, in the example the string is passed to cout >> data is passed left to right, in the example the integer is passed from cin to i Multiple bits of data can be passed to the stream by stringing them together in the same command. Use endl to finish a line.

54 Simple Input and Output Tasks Try out the following code in your main program, can you predict what will happen? cout << " This "; cout << "is a "; cout << "sentence " << endl; cout << " This "<< endl << "is a "<< endl<< "sentence " << endl; Output strings are enclosed in quotes can you find out how to print a quote? Special characters are preceded by a backslash find out what \r, \n, \b and \\ do to the output? What is the difference between \n and endl?

55 Finding BUGs Computers are not humans! Computers can only follow the instructions they are given. If they are not doing what you want it is because you haven t told them explicitly what to do!

56 Finding BUGs Computers are not humans! Computers can only follow the instructions they are given. If they are not doing what you want it is because you haven t told them explicitly what to do! The best way to avoid bugs is to start with working solution and make small changes. I hardly ever make mistakes because of the way I approach coding.

57 Finding BUGs Computers are not humans! Computers can only follow the instructions they are given. If they are not doing what you want it is because you haven t told them explicitly what to do! The best way to avoid bugs is to start with working solution and make small changes. I hardly ever make mistakes because of the way I approach coding. IDEs can help us spot mistakes as they constantly check your code, lets show an example of this...

58 Finding BUGs Open up a new empty project, with an empty C++ file.

59 Finding BUGs Open up a new empty project, with an empty C++ file. Type in an include statement, but misspell some of the words. You will notice they do not look colourful and have a red line underneath.

60 Finding BUGs Open up a new empty project, with an empty C++ file. Type in an include statement, but misspell some of the words. You will notice they do not look colourful and have a red line underneath. Try to build the project - click yes. It will say there were build errors, click no this time.

61 Finding BUGs Open up a new empty project, with an empty C++ file. Type in an include statement, but misspell some of the words. You will notice they do not look colourful and have a red line underneath. Try to build the project - click yes. It will say there were build errors, click no this time.

62 Finding BUGs We need to see what the errors are. Make sure you can view the error list. Click VIEW > Error List from the top bar you should see an error list box at the bottom.

63 Finding BUGs We need to see what the errors are. Make sure you can view the error list. Click VIEW > Error List from the top bar you should see an error list box at the bottom.

64 Finding BUGs We need to see what the errors are. Make sure you can view the error list. Click VIEW > Error List from the top bar you should see an error list box at the bottom. Correctly spell include now, iostrem appears slightly darker because it can t be found. Correct this as well.

65 Finding BUGs We need to see what the errors are. Make sure you can view the error list. Click VIEW > Error List from the top bar you should see an error list box at the bottom. Correctly spell include now, iostrem appears slightly darker because it can t be found. Correct this as well.

66 Finding BUGs We need to see what the errors are. Make sure you can view the error list. Click VIEW > Error List from the top bar you should see an error list box at the bottom. Correctly spell include now, iostrem appears slightly darker because it can t be found. Correct this as well. Try to build the project - there are unresolved externals errors you haven t got a main function.

67 Finding BUGs Now add in the main function, it should compile and run without errors.

68 Finding BUGs Now add in the main function, it should compile and run without errors. Add in the following code: cout << "Hello World" You will see red underlines and errors if you try to run it.

69 Finding BUGs Now add in the main function, it should compile and run without errors. Add in the following code: cout << "Hello World" You will see red underlines and errors if you try to run it.

70 Finding BUGs Now add in the main function, it should compile and run without errors. Add in the following code: cout << "Hello World" You will see red underlines and errors if you try to run it. Fix the undefined with the correct namespace at the top. There is still one more error to fix. Add in the semi colon.

71 Finding BUGs Now add in the main function, it should compile and run without errors. Add in the following code: cout << "Hello World" You will see red underlines and errors if you try to run it. Fix the undefined with the correct namespace at the top. There is still one more error to fix. Add in the semi colon.

72 Finding BUGs Now add in the main function, it should compile and run without errors. Add in the following code: cout << "Hello World" You will see red underlines and errors if you try to run it. Fix the undefined with the correct namespace at the top. There is still one more error to fix. Add in the semi colon.

73 Finding BUGs Now add in the main function, it should compile and run without errors. Add in the following code: cout << "Hello World" You will see red underlines and errors if you try to run it. Fix the undefined with the correct namespace at the top. There is still one more error to fix. Add in the semi colon.

74 Finding BUGs Tasks Open a new project and copy the following code into your project: Click here to download the code for this example. Can you find all the errors in this code and make it work?

75 Standard Data Types There are six basic data types in C++: char a character (short/long) int integers with different sizes float single precision real number (long) double double (or higher) precision number bool true or false binary number void this is used when a function doesn t return a value The precision of numbers will effect the maximum and minimum values they can take and also how big errors are.

76 Assigning and Outputting Variables First open up a new project, and follow the initial steps from earlier on Getting lost? Click here to download the code for this demonstration.

77 Assigning and Outputting Variables First open up a new project, and follow the initial steps from earlier on Don t forget to change the SubSystem to console. Getting lost? Click here to download the code for this demonstration.

78 Assigning and Outputting Variables First open up a new project, and follow the initial steps from earlier on Don t forget to change the SubSystem to console. Create a simple program that declares an integer variable, and outputs to screen. Getting lost? Click here to download the code for this demonstration.

79 Assigning and Outputting Variables Now add in a code block using curly brackets and redeclare a variable with the same name Getting lost? Click here to download the code for this demonstration.

80 Assigning and Outputting Variables Now add in a code block using curly brackets and redeclare a variable with the same name What happens to the value of the variable inside and outside the block? What happens if you remove the curly brackets? Getting lost? Click here to download the code for this demonstration.

81 Assigning and Outputting Variables Now add in a code block using curly brackets and redeclare a variable with the same name What happens to the value of the variable inside and outside the block? What happens if you remove the curly brackets? Tasks Try declaring each of the six different types of variable and output them to screen. What happens if you print out the variables without assigning them a value? Getting lost? Click here to download the code for this demonstration.

82 Using Variables Each line of code is called a statement. We can assign a variable a value using = We can do calculations on the right hand side of an = data 1 = ; The data types on both sides of = must be compatible

83 Using Variables Each line of code is called a statement. We can assign a variable a value using = We can do calculations on the right hand side of an = data 1 = ; The data types on both sides of = must be compatible We can add/subtract, multiply/divide most standard data types double a,b,c; b = 5. ; c = 4.1; a = 10. * b + c;

84 Other Operators We call +-*/ operators Other operators are: a%b :: returns a modulus b a++ :: increment a by 1 a-- :: decrement a by 1 a+=b :: set a equal to a plus b a*=b :: set a equal to a times b

85 Example: Dividing with integers First open up a new project, create a cpp file with an empty main function. Getting lost? Click here to download the code for this demonstration.

86 Example: Dividing with integers First open up a new project, create a cpp file with an empty main function. Now declare two integers, ask the user to input the values and read them in. Then output a calculation of one over the other. Getting lost? Click here to download the code for this demonstration.

87 Example: Dividing with integers First open up a new project, create a cpp file with an empty main function. Now declare two integers, ask the user to input the values and read them in. Then output a calculation of one over the other. The example shows 20/4=5 what happens if you do 1/2=?? Getting lost? Click here to download the code for this demonstration.

88 Doing Calculations Tasks Try doing some simple calculations with integers and doubles. Work out a x + bx where ax 2 + bx + c a + b x c 4 a = , b = 3, c = , and x = Use brackets to order the calculations. Try declaring the variables a, b, c and x as int, float or double what difference does it make to the solution?

89 Doing Calculations Tasks Now include the cmath library in your program. Calculate:- where sin(ax) x 5 (a + bx) i i=1 sin(e x a ) a = , b = 3, c = , and x = The functions you will need are sqrt, sin, cos, exp and, pow. Look them up if required. What happens to the result of the top expression if x = 0?.

90 Todays Lecture Topics: Computers and Programs; Syntax of C++; Data and Variables; Input and Output. Aims: Understand the idea of programming a computer; Write a simple program to input and output data.

Scientific Computing

Scientific Computing Scientific Computing Martin Lotz School of Mathematics The University of Manchester Lecture 1, September 22, 2014 Outline Course Overview Programming Basics The C++ Programming Language Outline Course

More information

A SHORT COURSE ON C++

A SHORT COURSE ON C++ Introduction to A SHORT COURSE ON School of Mathematics Semester 1 2008 Introduction to OUTLINE 1 INTRODUCTION TO 2 FLOW CONTROL AND FUNCTIONS If Else Looping Functions Cmath Library Prototyping Introduction

More information

Chapter 1 INTRODUCTION

Chapter 1 INTRODUCTION Chapter 1 INTRODUCTION A digital computer system consists of hardware and software: The hardware consists of the physical components of the system. The software is the collection of programs that a computer

More information

Chapter 2: Basic Elements of C++

Chapter 2: Basic Elements of C++ Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers

More information

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program Overview - General Data Types - Categories of Words - The Three S s - Define Before Use - End of Statement - My First Program a description of data, defining a set of valid values and operations List of

More information

C++ Basics. Data Processing Course, I. Hrivnacova, IPN Orsay

C++ Basics. Data Processing Course, I. Hrivnacova, IPN Orsay C++ Basics Data Processing Course, I. Hrivnacova, IPN Orsay The First Program Comments Function main() Input and Output Namespaces Variables Fundamental Types Operators Control constructs 1 C++ Programming

More information

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It

More information

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine

More information

Objectives. In this chapter, you will:

Objectives. In this chapter, you will: Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about

More information

Introduction to Programming using C++

Introduction to Programming using C++ Introduction to Programming using C++ Lecture One: Getting Started Carl Gwilliam gwilliam@hep.ph.liv.ac.uk http://hep.ph.liv.ac.uk/~gwilliam/cppcourse Course Prerequisites What you should already know

More information

Understanding main() function Input/Output Streams

Understanding main() function Input/Output Streams Understanding main() function Input/Output Streams Structure of a program // my first program in C++ #include int main () { cout

More information

Lab # 02. Basic Elements of C++ _ Part1

Lab # 02. Basic Elements of C++ _ Part1 Lab # 02 Basic Elements of C++ _ Part1 Lab Objectives: After performing this lab, the students should be able to: Become familiar with the basic components of a C++ program, including functions, special

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College October 24, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Expressions and Operator Precedence

More information

Week 2: Console I/O and Operators Arithmetic Operators. Integer Division. Arithmetic Operators. Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5.

Week 2: Console I/O and Operators Arithmetic Operators. Integer Division. Arithmetic Operators. Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5. Week 2: Console I/O and Operators Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5.1) CS 1428 Fall 2014 Jill Seaman 1 2.14 Arithmetic Operators An operator is a symbol that tells the computer to perform specific

More information

Computer Programming : C++

Computer Programming : C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming : C++ Experiment #1 Basics Contents Structure of a program

More information

Program Organization and Comments

Program Organization and Comments C / C++ PROGRAMMING Program Organization and Comments Copyright 2013 Dan McElroy Programming Organization The layout of a program should be fairly straight forward and simple. Although it may just look

More information

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING KEY CONCEPTS COMP 10 EXPLORING COMPUTER SCIENCE Lecture 2 Variables, Types, and Programs Problem Definition of task to be performed (by a computer) Algorithm A particular sequence of steps that will solve

More information

These are notes for the third lecture; if statements and loops.

These are notes for the third lecture; if statements and loops. These are notes for the third lecture; if statements and loops. 1 Yeah, this is going to be the second slide in a lot of lectures. 2 - Dominant language for desktop application development - Most modern

More information

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS

More information

Getting started with C++ (Part 2)

Getting started with C++ (Part 2) Getting started with C++ (Part 2) CS427: Elements of Software Engineering Lecture 2.2 11am, 16 Jan 2012 CS427 Getting started with C++ (Part 2) 1/22 Outline 1 Recall from last week... 2 Recall: Output

More information

2 nd Week Lecture Notes

2 nd Week Lecture Notes 2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous

More information

Chapter 2 Basic Elements of C++

Chapter 2 Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion

More information

BITG 1233: Introduction to C++

BITG 1233: Introduction to C++ BITG 1233: Introduction to C++ 1 Learning Outcomes At the end of this lecture, you should be able to: Identify basic structure of C++ program (pg 3) Describe the concepts of : Character set. (pg 11) Token

More information

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program:

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program: Welcome Back CSCI 262 Data Structures 2 - Review What you learned in CSCI 261 (or equivalent): Variables Types Arrays Expressions Conditionals Branches & Loops Functions Recursion Classes & Objects Streams

More information

Your First C++ Program. September 1, 2010

Your First C++ Program. September 1, 2010 Your First C++ Program September 1, 2010 Your First C++ Program //*********************************************************** // File name: hello.cpp // Author: Bob Smith // Date: 09/01/2010 // Purpose:

More information

Lab: Supplying Inputs to Programs

Lab: Supplying Inputs to Programs Steven Zeil May 25, 2013 Contents 1 Running the Program 2 2 Supplying Standard Input 4 3 Command Line Parameters 4 1 In this lab, we will look at some of the different ways that basic I/O information can

More information

Compilation and Execution Simplifying Fractions. Loops If Statements. Variables Operations Using Functions Errors

Compilation and Execution Simplifying Fractions. Loops If Statements. Variables Operations Using Functions Errors First Program Compilation and Execution Simplifying Fractions Loops If Statements Variables Operations Using Functions Errors C++ programs consist of a series of instructions written in using the C++ syntax

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture 04 Programs with IO and Loop We will now discuss the module 2,

More information

CSCE 121 ENGR 112 List of Topics for Exam 1

CSCE 121 ENGR 112 List of Topics for Exam 1 List of Topics for Exam 1 If statements o How is an if statement constructed? o Does every if need an else? Looping o While loop! What does a while loop look like?! How do you ensure you will not have

More information

CMPE110 - EXPERIMENT 1 * MICROSOFT VISUAL STUDIO AND C++ PROGRAMMING

CMPE110 - EXPERIMENT 1 * MICROSOFT VISUAL STUDIO AND C++ PROGRAMMING CMPE110 - EXPERIMENT 1 * MICROSOFT VISUAL STUDIO AND C++ PROGRAMMING Aims 1. Learning primary functions of Microsoft Visual Studio 2008 * 2. Introduction to C++ Programming 3. Running C++ programs using

More information

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004 GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004 Functions and Program Structure Today we will be learning about functions. You should already have an idea of their uses. Cout

More information

CSCE 110 PROGRAMMING FUNDAMENTALS

CSCE 110 PROGRAMMING FUNDAMENTALS CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 2. Overview of C++ Prof. Amr Goneid, AUC 1 Overview of C++ Prof. Amr Goneid, AUC 2 Overview of C++ Historical C++ Basics Some Library

More information

C++ Basic Elements of COMPUTER PROGRAMMING. Special symbols include: Word symbols. Objectives. Programming. Symbols. Symbols.

C++ Basic Elements of COMPUTER PROGRAMMING. Special symbols include: Word symbols. Objectives. Programming. Symbols. Symbols. EEE-117 COMPUTER PROGRAMMING Basic Elements of C++ Objectives General Questions Become familiar with the basic components of a C++ program functions, special symbols, and identifiers Data types Arithmetic

More information

By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program

By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program 1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize

More information

Object-oriented Programming for Automation & Robotics Carsten Gutwenger LS 11 Algorithm Engineering

Object-oriented Programming for Automation & Robotics Carsten Gutwenger LS 11 Algorithm Engineering Object-oriented Programming for Automation & Robotics Carsten Gutwenger LS 11 Algorithm Engineering Lecture 3 Winter 2011/12 Oct 25 Visual C++: Problems and Solutions New section on web page (scroll down)

More information

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program

More information

Chapter 2. Outline. Simple C++ Programs

Chapter 2. Outline. Simple C++ Programs Chapter 2 Simple C++ Programs Outline Objectives 1. Building C++ Solutions with IDEs: Dev-cpp, Xcode 2. C++ Program Structure 3. Constant and Variables 4. C++ Operators 5. Standard Input and Output 6.

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College October 22, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers ords Data Types And Variable Declarations

More information

C++ PROGRAMMING. For Industrial And Electrical Engineering Instructor: Ruba A. Salamh

C++ PROGRAMMING. For Industrial And Electrical Engineering Instructor: Ruba A. Salamh C++ PROGRAMMING For Industrial And Electrical Engineering Instructor: Ruba A. Salamh CHAPTER TWO: Fundamental Data Types Chapter Goals In this chapter, you will learn how to work with numbers and text,

More information

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 1 1. Please obtain a copy of Introduction to Java Programming, 11th (or 10th) Edition, Brief

More information

Your first C++ program

Your first C++ program Your first C++ program #include using namespace std; int main () cout

More information

Structured Programming Using C++ Lecture 2 : Introduction to the C++ Language. Dr. Amal Khalifa. Lecture Contents:

Structured Programming Using C++ Lecture 2 : Introduction to the C++ Language. Dr. Amal Khalifa. Lecture Contents: Structured Programming Using C++ Lecture 2 : Introduction to the C++ Language Dr. Amal Khalifa Lecture Contents: Introduction to C++ Origins Object-Oriented Programming, Terms Libraries and Namespaces

More information

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage:

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage: Discussion 1H Notes (Week 3, April 14) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 More on Arithmetic Expressions The following two are equivalent:! x = x + 5;

More information

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable Basic C++ Overview C++ is a version of the older C programming language. This is a language that is used for a wide variety of applications and which has a mature base of compilers and libraries. C++ is

More information

Chapter 2: Introduction to C++

Chapter 2: Introduction to C++ Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++

More information

Cpt S 122 Data Structures. Introduction to C++ Part II

Cpt S 122 Data Structures. Introduction to C++ Part II Cpt S 122 Data Structures Introduction to C++ Part II Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Objectives Defining class with a member function

More information

CS 241 Computer Programming. Introduction. Teacher Assistant. Hadeel Al-Ateeq

CS 241 Computer Programming. Introduction. Teacher Assistant. Hadeel Al-Ateeq CS 241 Computer Programming Introduction Teacher Assistant Hadeel Al-Ateeq 1 2 Course URL: http://241cs.wordpress.com/ Hadeel Al-Ateeq 3 Textbook HOW TO PROGRAM BY C++ DEITEL AND DEITEL, Seventh edition.

More information

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley

More information

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 1/9/ Review. Here s a simple C++ program:

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 1/9/ Review. Here s a simple C++ program: Welcome Back CSCI 262 Data Structures 2 - Review What you learned in CSCI 261 (or equivalent): Variables Types Arrays Expressions Conditionals Branches & Loops Functions Recursion Classes & Objects Streams

More information

Introduction to C++ Dr M.S. Colclough, research fellows, pgtas

Introduction to C++ Dr M.S. Colclough, research fellows, pgtas Introduction to C++ Dr M.S. Colclough, research fellows, pgtas 5 weeks, 2 afternoons / week. Primarily a lab project. Approx. first 5 sessions start with lecture, followed by non assessed exercises in

More information

DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++

DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++ DHA Suffa University CS 103 Object Oriented Programming Fall 2015 Lab #01: Introduction to C++ Objective: To Learn Basic input, output, and procedural part of C++. C++ Object-orientated programming language

More information

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1

ADARSH VIDYA KENDRA NAGERCOIL COMPUTER SCIENCE. Grade: IX C++ PROGRAMMING. Department of Computer Science 1 NAGERCOIL COMPUTER SCIENCE Grade: IX C++ PROGRAMMING 1 C++ 1. Object Oriented Programming OOP is Object Oriented Programming. It was developed to overcome the flaws of the procedural approach to programming.

More information

Chapter 1 Introduction to Computers and C++ Programming

Chapter 1 Introduction to Computers and C++ Programming Chapter 1 Introduction to Computers and C++ Programming 1 Outline 1.1 Introduction 1.2 What is a Computer? 1.3 Computer Organization 1.7 History of C and C++ 1.14 Basics of a Typical C++ Environment 1.20

More information

Add Subtract Multiply Divide

Add Subtract Multiply Divide ARITHMETIC OPERATORS if AND if/else AND while LOOP Order of Operation (Precedence Part 1) Copyright 2014 Dan McElroy Add Subtract Multiply Divide + Add - Subtract * Multiply / Divide = gives the quotient

More information

LESSON 2 VARIABLES, OPERATORS, EXPRESSIONS, AND USER INPUT

LESSON 2 VARIABLES, OPERATORS, EXPRESSIONS, AND USER INPUT LESSON VARIABLES, OPERATORS, EXPRESSIONS, AND USER INPUT PROF. JOHN P. BAUGH PROFJPBAUGH@GMAIL.COM PROFJPBAUGH.COM CONTENTS INTRODUCTION... Assumptions.... Variables and Data Types..... Numeric Data Types:

More information

1007 Imperative Programming Part II

1007 Imperative Programming Part II Agenda 1007 Imperative Programming Part II We ve seen the basic ideas of sequence, iteration and selection. Now let s look at what else we need to start writing useful programs. Details now start to be

More information

Computing and Statistical Data Analysis Lecture 3

Computing and Statistical Data Analysis Lecture 3 Computing and Statistical Data Analysis Lecture 3 Type casting: static_cast, etc. Basic mathematical functions More i/o: formatting tricks Scope, namspaces Functions 1 Type casting Often we need to interpret

More information

CS2141 Software Development using C/C++ C++ Basics

CS2141 Software Development using C/C++ C++ Basics CS2141 Software Development using C/C++ C++ Basics Integers Basic Types Can be short, long, or just plain int C++ does not define the size of them other than short

More information

A First Program - Greeting.cpp

A First Program - Greeting.cpp C++ Basics A First Program - Greeting.cpp Preprocessor directives Function named main() indicates start of program // Program: Display greetings #include using namespace std; int main() { cout

More information

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple

More information

WARM UP LESSONS BARE BASICS

WARM UP LESSONS BARE BASICS WARM UP LESSONS BARE BASICS CONTENTS Common primitive data types for variables... 2 About standard input / output... 2 More on standard output in C standard... 3 Practice Exercise... 6 About Math Expressions

More information

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.1

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.1 Superior University Department of Electrical Engineering CS-115 Computing Fundamentals Experiment No.1 Introduction of Compiler, Comments, Program Structure, Input Output, Data Types and Arithmetic Operators

More information

c++ keywords: ( all lowercase ) Note: cin and cout are NOT keywords.

c++ keywords: ( all lowercase ) Note: cin and cout are NOT keywords. Chapter 1 File Extensions: Source code (cpp), Object code (obj), and Executable code (exe). Preprocessor processes directives and produces modified source Compiler takes modified source and produces object

More information

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018

C++ Basics. Lecture 2 COP 3014 Spring January 8, 2018 C++ Basics Lecture 2 COP 3014 Spring 2018 January 8, 2018 Structure of a C++ Program Sequence of statements, typically grouped into functions. function: a subprogram. a section of a program performing

More information

Linux Tutorial #1. Introduction. Login to a remote Linux machine. Using vim to create and edit C++ programs

Linux Tutorial #1. Introduction. Login to a remote Linux machine. Using vim to create and edit C++ programs Linux Tutorial #1 Introduction The Linux operating system is now over 20 years old, and is widely used in industry and universities because it is fast, flexible and free. Because Linux is open source,

More information

Programming Language. Functions. Eng. Anis Nazer First Semester

Programming Language. Functions. Eng. Anis Nazer First Semester Programming Language Functions Eng. Anis Nazer First Semester 2016-2017 Definitions Function : a set of statements that are written once, and can be executed upon request Functions are separate entities

More information

4. Structure of a C++ program

4. Structure of a C++ program 4.1 Basic Structure 4. Structure of a C++ program The best way to learn a programming language is by writing programs. Typically, the first program beginners write is a program called "Hello World", which

More information

CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011

CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011 CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011 Date: 01/18/2011 (Due date: 01/20/2011) Name and ID (print): CHAPTER 6 USER-DEFINED FUNCTIONS I 1. The C++ function pow has parameters.

More information

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE a) Mention any 4 characteristic of the object car. Ans name, colour, model number, engine state, power b) What

More information

Technical Questions. Q 1) What are the key features in C programming language?

Technical Questions. Q 1) What are the key features in C programming language? Technical Questions Q 1) What are the key features in C programming language? Portability Platform independent language. Modularity Possibility to break down large programs into small modules. Flexibility

More information

LECTURE 02 INTRODUCTION TO C++

LECTURE 02 INTRODUCTION TO C++ PowerPoint Slides adapted from *Starting Out with C++: From Control Structures through Objects, 7/E* by *Tony Gaddis* Copyright 2012 Pearson Education Inc. COMPUTER PROGRAMMING LECTURE 02 INTRODUCTION

More information

CS50 Supersection (for those less comfortable)

CS50 Supersection (for those less comfortable) CS50 Supersection (for those less comfortable) Friday, September 8, 2017 3 4pm, Science Center C Maria Zlatkova, Doug Lloyd Today s Topics Setting up CS50 IDE Variables and Data Types Conditions Boolean

More information

Fast Introduction to Object Oriented Programming and C++

Fast Introduction to Object Oriented Programming and C++ Fast Introduction to Object Oriented Programming and C++ Daniel G. Aliaga Note: a compilation of slides from Jacques de Wet, Ohio State University, Chad Willwerth, and Daniel Aliaga. Outline Programming

More information

More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4

More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4 More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4 Ziad Matni Dept. of Computer Science, UCSB Administrative CHANGED T.A. OFFICE/OPEN LAB HOURS! Thursday, 10 AM 12 PM

More information

C++ for Python Programmers

C++ for Python Programmers C++ for Python Programmers Adapted from a document by Rich Enbody & Bill Punch of Michigan State University Purpose of this document This document is a brief introduction to C++ for Python programmers

More information

Computer Science II Lecture 1 Introduction and Background

Computer Science II Lecture 1 Introduction and Background Computer Science II Lecture 1 Introduction and Background Discussion of Syllabus Instructor, TAs, office hours Course web site, http://www.cs.rpi.edu/courses/fall04/cs2, will be up soon Course emphasis,

More information

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College October 25, 2017 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Function Details Assert Statements

More information

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program?

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program? Intro to Programming & C++ Unit 1 Sections 1.1-4 and 2.1-10, 2.12-13, 2.15-17 CS 1428 Spring 2019 Jill Seaman 1.1 Why Program? Computer programmable machine designed to follow instructions Program a set

More information

Chapter 1 - What s in a program?

Chapter 1 - What s in a program? Chapter 1 - What s in a program? I. Student Learning Outcomes (SLOs) a. You should be able to use Input-Process-Output charts to define basic processes in a programming module. b. You should be able to

More information

First C or C++ Lab Paycheck-V1.0 Using Microsoft Visual Studio

First C or C++ Lab Paycheck-V1.0 Using Microsoft Visual Studio C & C++ LAB ASSIGNMENT #1 First C or C++ Lab Paycheck-V1.0 Using Microsoft Visual Studio Copyright 2013 Dan McElroy Paycheck-V1.0 The purpose of this lab assignment is to enter a C or C++ into Visual Studio

More information

Maciej Sobieraj. Lecture 1

Maciej Sobieraj. Lecture 1 Maciej Sobieraj Lecture 1 Outline 1. Introduction to computer programming 2. Advanced flow control and data aggregates Your first program First we need to define our expectations for the program. They

More information

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

Engineering Problem Solving with C++, Etter/Ingber

Engineering Problem Solving with C++, Etter/Ingber Engineering Problem Solving with C++, Etter/Ingber Chapter 2 Simple C++ Programs C++, Second Edition, J. Ingber 1 Simple C++ Programs Program Structure Constants and Variables C++ Operators Standard Input

More information

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

Programming with C++ as a Second Language

Programming with C++ as a Second Language Programming with C++ as a Second Language Week 2 Overview of C++ CSE/ICS 45C Patricia Lee, PhD Chapter 1 C++ Basics Copyright 2016 Pearson, Inc. All rights reserved. Learning Objectives Introduction to

More information

Algorithms and Programming I. Lecture#12 Spring 2015

Algorithms and Programming I. Lecture#12 Spring 2015 Algorithms and Programming I Lecture#12 Spring 2015 Think Python How to Think Like a Computer Scientist By :Allen Downey Installing Python Follow the instructions on installing Python and IDLE on your

More information

C++ Functions. Last Week. Areas for Discussion. Program Structure. Last Week Introduction to Functions Program Structure and Functions

C++ Functions. Last Week. Areas for Discussion. Program Structure. Last Week Introduction to Functions Program Structure and Functions Areas for Discussion C++ Functions Joseph Spring School of Computer Science Operating Systems and Computer Networks Lecture Functions 1 Last Week Introduction to Functions Program Structure and Functions

More information

Lab Instructor : Jean Lai

Lab Instructor : Jean Lai Lab Instructor : Jean Lai Group related statements to perform a specific task. Structure the program (No duplicate codes!) Must be declared before used. Can be invoked (called) as any number of times.

More information

CSCI Wednesdays: 1:25-2:15 Keller Thursdays: 4:00-4:50 Akerman 211

CSCI Wednesdays: 1:25-2:15 Keller Thursdays: 4:00-4:50 Akerman 211 C++ Basics CSCI 1113 Wednesdays: 1:25-2:15 Keller 1-250 Thursdays: 4:00-4:50 Akerman 211 Peer-assisted Learning sessions - PAL Weekly practice with course concepts Work with peers to reinforce understanding

More information

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. 1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. B. Outputs to the console a floating point number f1 in scientific format

More information

Introduction to C++ Dr Alex Martin Room 6.10

Introduction to C++ Dr Alex Martin Room 6.10 Introduction to C++ Dr Alex Martin Room 6.10 Introduction to C++ Week 1 Dr Alex Martin 2013 Slide 1 Timetable There are two lecture slots for this module on Mon/Tues and two Computing labs scheduled for

More information

C++ Programming Lecture 1 Software Engineering Group

C++ Programming Lecture 1 Software Engineering Group C++ Programming Lecture 1 Software Engineering Group Philipp D. Schubert Contents 1. More on data types 2. Expressions 3. Const & Constexpr 4. Statements 5. Control flow 6. Recap More on datatypes: build-in

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

CPS122 Lecture: From Python to Java last revised January 4, Objectives: Objectives: CPS122 Lecture: From Python to Java last revised January 4, 2017 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.

More information

Chapter 1: Why Program? Computers and Programming. Why Program?

Chapter 1: Why Program? Computers and Programming. Why Program? Chapter 1: Introduction to Computers and Programming 1.1 Why Program? Why Program? Computer programmable machine designed to follow instructions Program instructions in computer memory to make it do something

More information

How to approach a computational problem

How to approach a computational problem How to approach a computational problem A lot of people find computer programming difficult, especially when they first get started with it. Sometimes the problems are problems specifically related to

More information

Operators. Java operators are classified into three categories:

Operators. Java operators are classified into three categories: Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.

More information