• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 2 fuera de 5 páginas
Examen

Introduction To Programming COS1511

Document preview thumbnail
Vista previa 2 fuera de 5 páginas

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.

Vista previa del contenido

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)

Información del documento

Subido en
16 de octubre de 2024
Número de páginas
5
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$10.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
2
Seguidores
1
Artículos
137
Última venta
1 año hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes