Found 9321 Articles for Object Oriented Programming

What type of comments does C++ support?

Samual Sam
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 are fundamental data types in C++ programming?

Rama Giri
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 are primitive data type in C++?

Fendadis John
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++?

Moumita
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

Whitespace in C++

V Jyothi
Updated on 11-Feb-2020 06:48:24

7K+ Views

Whitespace is a term that refers to characters that are used for formatting purposes. In C++, this refers primarily to spaces, tabs, and (sometimes) newlines. The C++ compiler generally ignores whitespace, with a few minor exceptions. For example, all the 4 lines below mean the same thing −cout

Print Hello World without semicolon in C++

Syed Javed
Updated on 11-Feb-2020 06:57:23

969 Views

There are multiple ways to write a C++ program without semicolons. Note that doing this is very bad practice and should never be used in real code. This is presented just as informational content. The easiest way to write a C++ Program without Semicolons is using if statements. Almost all statements in C++ can be treated as expressions. So, if we place the statement inside an if statement with a blank pair of parentheses, we don’t have to end it with a semicolon anymore. ExampleLive Demo#include int main() {    if (std::cout > N) {}       if (std::cout

Putting semicolons after while and if statements in C++

Moumita
Updated on 11-Feb-2020 06:55:05

2K+ Views

When you have a statement like −while (expression);the while loop runs no matter if the expression is true or not. However, if you put −if (expression);the statement runs no matter if the expression is true or not. This is because the syntax for if and while is −if () // or while () So the is only executed if the evaluates to true. In while, it will enter an infinite loop.So the question what it executes. If there are not braces {} then the next statement is terminated by; even if that statement is EMPTY. Note ... Read More

Identifiers in C++

Manikanth Mani
Updated on 30-Jul-2019 22:30:21

5K+ Views

The C++ identifier is a name used to identify a variable, function, class, module, or any other user-defined item. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores, and digits (0 to 9).C++ does not allow punctuation characters such as @, $, and % within identifiers. C++ is a case-sensitive programming language. Thus, Manpower and manpower are two different identifiers in C++.Here are some examples of acceptable identifiers −mohdPiyushabcmove_namea_123myname50_tempja23b9retVal

Reserved keywords in C++?

Arjun Thakur
Updated on 19-Jun-2020 05:31:50

9K+ Views

A reserved word is a word that cannot be used as an identifier, such as the name of a variable, function, or label – it is "reserved from use". This is a syntactic definition, and a reserved word may have no meaning.There are a total of 95 reserved words in C++. The reserved words of C++ may be conveniently placed into several groups. In the first group, we put those that were also present in the C programming language and have been carried over into C++. There are 32 of these. There are another 30 reserved words that were not in ... Read More

Trigraphs in C++

Jai Janardhan
Updated on 30-Jul-2019 22:30:21

200 Views

The ISO-646 character set does not have all the characters of the C syntax, therefore there are some systems with keyboards and displays that cannot deal with some characters. These characters can be constructed using a sequence of 3 characters called trigraphs. In C, before any other processing takes place, each occurrence of one of the following sequences of three characters (“trigraph sequences”) is replaced by the single character.trigraphreplacementtrigraphreplacementtrigraphreplacement??=#??([??}??’ˆ??!|??-˜They are there mostly for historical reasons. Nowadays, most modern keyboards for most languages allow access to all those characters, but this used to be a problem once with some European keyboards. ... Read More

Advertisements