Week 2 PRELIMS Flashcards
It is a standardized communication technique for expressing instructions to a computer.
Programming Language
It is a low-level code that relies on a strong relationship between the instructions input using the coding language and how a machine interprets the code instructions
Assembly Language
It uses a more natural and human-readable syntax which makes it easier for humans to understand and write.
High Level Programming Language
It stands as a highly abstracted language designed to simplify computer programming.
High Level Programming Language
user writes code which is almost identical to the one computers understand.
Low Level Programming Language
It is a programming language that provides little or no abstraction from a computer’s instruction set architecture; commands or functions in the language are structurally similar to a processor’s instructions. Generally, this refers to either machine code or assembly language
Low Level Programming Language
It is a general-purpose programming language.
C++
When was C++ invented?
early 1980s
Who invented C++?
Bjarne Stroustrup
Where did Bjarne Stroustrup invented C++?
Bell Labs
This programming language is case - sensitive
C++
It is an extension of the C programming language, or “C with Classes”.
C++
The language has expanded significantly over time, and it now has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
C++
It is one of the world’s most popular programming languages.
C++
It is an object-oriented programming language which gives a clear structure to programs and allows code to be reused, lowering development costs.
C++
2 Categories of Programming Language
High Level Programming Language
Low Level Programming Language
2 Kinds of software that you need to start C++
Text Editor
C++ Compiler
It is portable and can be used to develop applications that can be adapted to multiple platforms.
Text Editor
They are used to compile your source code and translate it into a machine code, a code that a computer can actually understand.
C++ Compiler
It stands for standard input-output stream.
<iostream>
</iostream>
It contains everything we needed for handling input and output.
<iostream>
</iostream>
Is an object-oriented library that provides input and output functionality using streams.
<iostream>
</iostream>
It is a sequence of bytes.
A stream
It is a short form of standard.
std
It tells the compiler to use the standard namespace.
using namespace std;
It is used to organize code into logical groups.
Namespace
It contains the built-in classes and declared functions.
std namespace
It is the main function where program execution begins.
int main ()
defines the entry or the starting point of the C/C++ program code.
int main ()
is a keyword that tells us about the integer data type
int main ()
So when one runs the file on their local computer, the operating system executes the ______________.
main () function
terminates main( )function and causes it to return the value 0 to the calling process.
return 0;
a zero return is success and one or non-zero is failure or error
return 0;
is a command used in programming, especially in languages like C or C++, to indicate that a program or a function has completed its execution successfully.
return 0;
indicate the beginning and end of a function, which can also be called the function’s body.
Curly Brackets {}
The information inside of it indicates what the function does when executed.
Curly Brackets {}
is the stream object used to access it.
cout
is used in combination with the insertion operator.
cout
It enable the user to input a value, use _____ in combination with the extraction operator (»). The variable containing the extracted data follows the operator.
cin
It is to insert the data that comes after it into the stream that comes before.
Insertion operator («)
It is the easiest way to get bytes from an input stream object.
the extraction operator (»)
is used to terminate a statement.
semicolon (;)
Each statement must end with this.
semicolon (;)
It indicates the end of one logical expression
semicolon (;)
What alternative can we use with endl?
\n
One way to print two lines is to use the ________ manipulator, which will put in a line break.
endl or \n
It moves down to a new line to print the second text.
endl or \n
It ensures that all the text you’ve sent to cout so far is actually displayed on the screen immediately.
endl or \n
is a set of logically connected statements, surrounded by opening and closing curly braces.
A block
Provides tools for writing source code.
Integrated Development Environment (IDE)
Compiles source code into the final executable program.
Compilers
Think of it as a waiting area where data sits before it’s shown on the screen or written to a file. It’s like a bucket that collects water before pouring it out.
Buffer
Its like dumping the bucket to empty it completely.
Flush
Why are buffer used?
They help programs run faster by gathering data and writing it all at once, instead of doing it piece by piece.
This means forcing the data that’s sitting in the buffer to be displayed or written out immediately.
Flushing the Buffer
It is called an escape character and indicates a “special” character
backslash \
Using this is like dumping the bucket right after you add water, while using \n is like waiting until the bucket is full before emptying it.
std::endl
are explanatory statements that you can include in the C++ code to explain what the code is doing.
Comments
The compiler ignores everything that appears in the __________, so none of that information shows in the result.
Comments
It can be written anywhere, and can be repeated any number of times throughout the code.
Comments
Within a comment marked with /* and */, // characters have no special meaning, and vice versa. This allows you to “nest” one comment type within the other.
Comments
Comments that require multiple lines begin with /* and end with */. You can place them on the same line or insert one or more lines between them.
Multi-Line Comments
are nothing but reserved memory locations to store values.
Variables
are like containers that hold data, such as numbers or text, so your program can use and manipulate that data.
Variables
Before using a variable, you need to ___________ it, which means telling the program what kind of data it will hold. (int age;)
Declaring a Variable
After declaring a variable, you can store a value in it: (age = 25;)
Assigning a Value
You can also declare and assign a value in one line: (int age = 25;)
Declaring and Assigning in One Step:
Once you have a variable, you can use it in your program: (int age = 25; cout «_space;“Your age is “ «_space;age «_space;endl;)
Using Variables:
You can change the value of a variable whenever you need to: (age = 30;)
Changing Values
Variables can hold different types of data.
Some common ones are:
int or integer: For whole numbers (e.g., int age = 25;)
float or double: For decimal numbers (e.g., double price = 9.99;)
char: For single characters (e.g., char grade = ‘A’;)
string: For text (e.g., string name = “Alice”;)
For whole numbers (e.g., int age = 25;)
int or integer
For decimal numbers
float or double
For single characters
char
It used for text
string
It is a built-in type that represents a whole number value.
Integer
is a name for a variable, function, class, module, or any other user-defined item.
Identifier
An ____________ starts with a letter (A-Z or a-z) or an underscore (_), followed by additional letters, underscores, and digits (0 to 9).
Identifier