Posts

Operators

  Operators Operators are symbols that are used to perform operations on data. C++ has a wide variety of operators, including: Arithmetic operators: +, -, *, /, % Relational operators: <, >, <=, >=, ==, != Logical operators: &&, ||, ! Assignment operators: =, +=, -=, *=, /=, %=

Whitespace in C++

Image
  Whitespace in C++: A line containing only whitespace, possibly with a comment, is known as a blank line, and C++ compiler totally ignores it. Whitespace is the term used in C++ to describe blanks, tabs, newline characters and comments. Whitespace separates one part of a statement from another and enables the compiler to identify where one element in a statement, such as int, ends and the next element begins. Statement 1 In the above statement there must be at least one whitespace character (usually a space) between int and age for the compiler to be able to distinguish them. Statement 2 In the above statement 2, no whitespace characters are necessary between fruit and =, or between = and apples, although you are free to include some if you wish for readability purpose.

Data Types – Char & ASCII Value C++

Image
The char data type in C++ is used to store a single character. It is typically represented as a single byte in memory . You can also use the int() function to convert a char variable to its corresponding ASCII value. For example, the following code prints the ASCII value of the variable myChar: #30DaysOFCreative 

Data Types - Bool And Void C++

Image
 Data Types - Bool And Void C++ Bool: Representing True or False Purpose: Stores Boolean values, indicating truth or falsehood. Values: Can hold only two possible values:  true  or  false . Common Uses: Decision-making in control structures (e.g.,  if  statements) Loop conditions Function return values Example: void: Representing No Value Purpose: Indicates the absence of a value. Common Uses: Function return types that don't return a value Function parameter lists to specify no arguments

Data Types - Char And ASCI C++

Image
 Data Types - Char And ASCI C++ ASCII: Representing Characters as Numbers ASCII (American Standard Code for Information Interchange) is a standard character encoding scheme that assigns unique numerical codes to characters. C++ uses ASCII internally to represent characters. The  char  data type in C++ is used to store single characters, such as letters, digits, symbols, and whitespace. It typically occupies 1 byte of memory. Example: Best Practices: Use  char  to store single characters effectively. Be mindful of ASCII codes for character manipulation and comparison. Consider Unicode for broader character support when needed.

Data Types - Integer C++

Image
  Integers: Whole Number Values Integer data types store whole numbers (no decimals) within specific ranges. C++ offers several integer types with varying sizes and storage capacities. Choosing the Right Type: Consider the range of values you need to represent. If you only need non-negative values, use unsigned types to potentially double the positive range. Be mindful of memory constraints when working with large datasets. Example:

Data Types – Integer C++

Integer data types in C++ are used to store whole numbers. They are typically represented as binary numbers in memory. Integer data types can be used to store a variety of values, such as: • Loop counters • Array indices • Mathematical expressions • Enumeration values • Bit masks