Found 34489 Articles for Programming

What are multiplicative operators in C++?

Naveen Singh
Updated on 11-Feb-2020 07:37:45

190 Views

The multiplicative operators are −Multiplication (*)Division (/)Modulus or “remainder from division” (%)These binary operators have left-to-right associativity. The multiplicative operators take operands of arithmetic sorts. The modulus operator (%) contains a stricter requirement in this its operands should be of integral type.The multiplication operator yields the result of multiplying the first operand by the second.The division operator yields the result of dividing the first operand by the second.The modulus operator yields the remainder given by the subsequent expression, wherever e1 is that the 1st operand and e2 is that the second: e1 – (e1 / e2) * e2, where both ... Read More

What is typedef declarations in C++?

Naveen Singh
Updated on 11-Feb-2020 07:35:59

342 Views

The typedef keyword in C++ can be used to give a type a new name. For example, you can give a new name of BYTE to unsigned characters −typedef unsigned char BYTE;After this type definition, the identifier BYTE can be used as an abbreviation for the type unsigned char, for example −BYTE  b1, b2;This will declare 2 variables b1 and b2 of type unsigned char. Typedefs are really useful when you have huge names due to namespaces, class names, etc. For example, if you want a variable of type std::vector::iterator multiple times throughout your program. You can just rename it ... Read More

What type of comments does C++ support?

Naveen Singh
Updated on 11-Feb-2020 07:33:15

196 Views

Program comments are explanatory statements that you can include in the C++ code. These comments help anyone reading the source code. All programming languages allow for some form of comments.C++ supports single-line and multi-line comments. All characters available inside any comment are ignored by C++ compiler.Single line commentsTo create a single line comment, we use the // notation. Wherever you want to start the comment, start it with //. For example,// This is a comment cout

What is Bitwise OR in C++?

Naveen Singh
Updated on 11-Feb-2020 07:31:31

131 Views

The bitwise OR operator (|) compares each bit of first operand to the corresponding bit of second operand. If either bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0. Both operands to the bitwise inclusive OR operator must be of integral types. For example,Example#include   using namespace std;   int main() {      unsigned short a = 0x5555;      // pattern 0101 ...      unsigned short b = 0xAAAA;      // pattern 1010 ...      cout

What is Bitwise AND in C++?

Naveen Singh
Updated on 11-Feb-2020 07:30:01

128 Views

The bitwise AND operator (&) compares each bit of first operand to the corresponding bit of second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0. Both operands to the bitwise inclusive AND operator must be of integral types. For example,Example#include   using namespace std;   int main() {      unsigned short a = 0x5555;      // pattern 0101 ...      unsigned short b = 0xAAAA;      // pattern 1010 ...      cout

What are fundamental data types in C++ programming?

Naveen Singh
Updated on 11-Feb-2020 07:28:40

2K+ Views

A fundamental or primitive type is a data type where the values that it can represent have a very simple nature (a number, a character or a truth-value); the primitive types are the most basic building blocks for any programming language and are the base for more complex data types.C++ has the following primitive data types −S.NoTypeDescription1boolStores either value true or false.2charTypically a single octet (one byte). This is an integer type.3intThe most natural size of an integer for the machine.4floatA single-precision floating point value.5doubleA double-precision floating point value.6voidRepresents the absence of type.Read More

What is Bitwise XOR in C++?

Naveen Singh
Updated on 11-Feb-2020 07:23:15

221 Views

The bitwise exclusive OR operator (^) compares every bit of} its 1st operand to the corresponding bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0. Both operands to the bitwise exclusive OR operator must be of integral types. For example,Example#include   using namespace std;   int main() {      unsigned short a = 0x5555;      // pattern 0101 ...      unsigned short b = 0xFFFF;      // pattern 1111 ...      cout  

What is overloading a unary operator in C++?

Naveen Singh
Updated on 11-Feb-2020 07:21:47

240 Views

The single operators operate on one quantity and following are the samples of single operators − - The increment ( ) and decrement (--) operators. The compiler distinguishes between the different meanings of an operator by examining the types of its operands.The unary operators operate on a single operand and following are the examples of Unary operators −The increment (++) and decrement (--) operators.The unary minus (-) operator.The logical not (!) operator.The unary operators operate on the object for which they were called and normally, this operator appears on the left side of the object, as in !obj, -obj, and ... Read More

What are primitive data type in C++?

Naveen Singh
Updated on 11-Feb-2020 07:19:29

4K+ Views

A primitive type is a data type where the values that it can represent have a very simple nature (a number, a character or a truth-value); the primitive types are the most basic building blocks for any programming language and are the base for more complex data types.C++ has the following primitive data types −S.NoTypeDescription1boolStores either value true or false.2charTypically a single octet (one byte). This is an integer type.3intThe most natural size of an integer for the machine.4floatA single-precision floating point value.5doubleA double-precision floating point value.6voidRepresents the absence of type.

What does 'using namespace std' mean in C++?

Naveen Singh
Updated on 30-Jul-2019 22:30:21

11K+ Views

Consider a situation, when we have two persons with the same name, Piyush, in the same class. Whenever we need to differentiate them definitely we would have to use some additional information along with their name, like either the area, if they live in a different area or their mother’s or father’s name, etc.The same situation can arise in your C++ applications. For example, you might be writing some code that has a function called xyz() and there is another library available which is also having same function xyz(). Now the compiler has no way of knowing which version of ... Read More

Advertisements