C++ BASICS - Parts of C++ program

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Preprocessor Directives

-> allow the programmer to use different functions effectively; -> located at top-most part of a C++ program. -> This is where all the functions are imported or in C++ terms "included". -> Without it, you wont be able to execute any command at all, since all commands are always included from other functions. -> always start with a hash symbol (#) example: #include <iostream>

statements

-> an instructional code that commands the computer to do a certain action upon its execution. -> a semicolon (;) signifies the end of any statement

comments

-> are *line of code that are NOT executed* during the program. -> they are *used to either give brief labelling and explanation to lines of codes or to temporarily disable lines of code* during the development phase.

functions

-> consists of lines of code grouped together to perform several task in a program. example: main( )

constant

-> fixed value used in certain mathematical or programming contexts -> should be given initial (starting) values which they retain (fixed/not changing) throughout the whole program Example: 1. #define standardAge 18 2. const int standardAge 18;

variable

-> symbols used in a program that stands for a value or data stored in a computer's memory. -> given an initial value that changes its value throughout the program

info

-> when declaring or naming a variable, make sure it always start with a letter or underscore ( ____ ); self-explanatory that the name tells what it does to easily trace errors that may occur. example: int studentAge int is the data type studentAge is the variable name storing age of student

parts of C++ program

1. objects, 2. functions, 3. variables, 4. expressions, 5. constants and 6. host of other components

multi-line comment

[types of comment] - several lines of code that can be disabled by placing the code block between a slash-asterisk (/*) and an asterisk-slash (*/)

single-line comment

[types of comment] - a double slash (//) at the beginning of a line of code disables the entire statement and considers it merely as a comment.

local variables

are similar to variables found under global declarations BUT they can only be accessed and manipulated within the code block they were initialized in.

global declarations

contains the user-defined variables and constant

expression

refers to any valid combination of symbols that represent values and operations.

keywords

reserved words in a programming language that have specific uses Examples: words : if, do-while, switch functions: main (), getch(), clrscr()

expression

statement that is composed of at least one operator and one operand; it evaluates to a particular value based on the result of the operation.

floating-point literal or float

variable that stores real numbers or numbers with fractional parts


संबंधित स्टडी सेट्स

Java: Tools and Libraries for Everyone

View Set

Thomas Hobbes (Political Theory)

View Set

Collocations in Use tous les exercices

View Set

Chapter 13: Fluid and Electrolytes: Balance and Disturbance (2)

View Set

PRIMITIVE GOV'T, ANCIENT GREECE AND ANCIENT ROME

View Set

Nicholls > Business Law (BSAD 221) > Gene Gouaux > Test 2

View Set

AP Language & Composition - Rhetorical Modes/Devices/Strategies

View Set

CHEM 1035 - SmartBook Chapter 9 Part I

View Set