• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 5 pages
Exam (elaborations)

Introduction To Programming COS1511

Document preview thumbnail
Preview 2 out of 5 pages

Introduction To Programming COS1511 IDE - ANSWERSIntegrated Development Environment cout - ANSWERSStands for console output; the standard output stream object in C++; used with the insertion operator to display information on the computer screen #include iostream - ANSWERSThe include directive needed to allow use of the various I/O operators such as cout and cin. using namespace std; - ANSWERSDeclares that the program will be accessing entities whose names are part of the namespace called std int main() - ANSWERSThe header for the main function of the program, int tells compiler function will be returning an integer (return 0;) Statement Terminator - ANSWERSThe semicolon (;) is used to indicate the end of a statement. Comments - ANSWERSUsing descriptive text to explain portions of code. Comments do not change the way a robot behaves, but are important for the programmer to remember what the code does. endl; - ANSWERSA stream manipulator used with cout that can be used to advance the cursor to the next line on the computer screen Syntax Rules - ANSWERSProgramming syntax rules must be followed for the compiler to understand you Good Programming Style - ANSWERSLeaving open lines, putting statements on seperate lines, using comments in code, indenting code etc. BODMAS - ANSWERSBrackets, Order, Division, Multiplication, Addition, Subtraction Data Type: Integer - ANSWERSInteger numerical ; No decimals/fractions (Even with division); Positive and Negative Numbers; Variable - ANSWERSWe declare a var with a name so we can refer to the value stored in the memory position in a program; Use meaningful names; Always declare or initialise before use. Variable and Function Name Rules - ANSWERSCannot start with a numeric character, but numbers and all letters can be used after that; Can start with or have an underscore _ ; Cannot used reserved names, eg. int, return. Case Sensitive. Can use CamelNotation.

Content preview

Introduction To Programming COS1511
IDE - ANSWERSIntegrated Development Environment

cout - ANSWERSStands for console output; the standard output stream object in C++;
used with the insertion operator to display information on the computer screen

#include <iostream> - ANSWERSThe include directive needed to allow use of the
various I/O operators such as cout and cin.

using namespace std; - ANSWERSDeclares that the program will be accessing entities
whose names are part of the namespace called std

int main() - ANSWERSThe header for the main function of the program, int tells
compiler function will be returning an integer (return 0;)

Statement Terminator - ANSWERSThe semicolon (;) is used to indicate the end of a
statement.

Comments - ANSWERSUsing descriptive text to explain portions of code. Comments
do not change the way a robot behaves, but are important for the programmer to
remember what the code does.

endl; - ANSWERSA stream manipulator used with cout that can be used to advance
the cursor to the next line on the computer screen

Syntax Rules - ANSWERSProgramming syntax rules must be followed for the compiler
to understand you

Good Programming Style - ANSWERSLeaving open lines, putting statements on
seperate lines, using comments in code, indenting code etc.

BODMAS - ANSWERSBrackets, Order, Division, Multiplication, Addition, Subtraction

Data Type: Integer - ANSWERSInteger numerical ; No decimals/fractions (Even with
division); Positive and Negative Numbers;

Variable - ANSWERSWe declare a var with a name so we can refer to the value stored
in the memory position in a program; Use meaningful names; Always declare or
initialise before use.

Variable and Function Name Rules - ANSWERSCannot start with a numeric character,
but numbers and all letters can be used after that; Can start with or have an underscore
_ ; Cannot used reserved names, eg. int, return. Case Sensitive. Can use
CamelNotation.

, Modulo (or "mod") - ANSWERSthe name of the mathematical operation. Modulo gives
the remainder from dividing two numbers. For example: 17 MOD 13 is 4.
X MOD 1 is always 0.

Assignment Operator - ANSWERSThe '=' character causes the compiler or interpreter
to evaluate to the expression on its right and store the result in the variable(s) on its left.
Variable = Expression;

Compound Assignment Operator - ANSWERSan operator that combines assignment
(setting value of the variable) with another operation, such as addition or subtraction.

Unary Increment and Decrement Operators - ANSWERSThese operators (++, --)
together with the variable they are operating on, return a value, which depends on if
operator is used in prefix or postfix form.

Prefix Form (++i or--i) - ANSWERSFirst increments/decrements the variable, then uses
the incremented value in the expression.

Postfix Form (i++ or i--) - ANSWERSFirst uses the current variable value in the
expression, and then increments/decrements the variable.

Variable Diagrams - ANSWERSCan be used to work out what complicated programs
do, help you find bugs in your program.

Data type: double - ANSWERSFundamental data type built into compiler used to define
numeric variables holding numbers with decimal points.

Data Type: Float - ANSWERSShortened term for Floating Point; Fundamental data
type built into compiler used to define numerical variables with floating decimal points.

cout.setf(ios::fixed) - ANSWERSSets numbers to non-scientific

cout.precision(2); - ANSWERSSets decimals to 2, default is 6

Implicit Conversion / Coercion - ANSWERSA conversion from one data type to another
that occurs automatically by the compiler, information can be lost (eg, conversion of
Float to Int)

Explicit Conversion / Type Casting - ANSWERSThe data type transformation caused
using a cast operator. We place value to be converted in parenthesis and procede it
withnthe type we wish to convert it to.

Scientific Notation - ANSWERSC++ outputs floating point in fixed or scientific notation,
which is a method of writing or displaying numbers in terms of a decimal number
between 1 and 10 multiplied by a power of 10. Prevented using cout:setf(ios::fixed)

Document information

Uploaded on
October 16, 2024
Number of pages
5
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$10.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
2
Followers
1
Items
137
Last sold
1 year ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions